project QadFinancials > class BMfgPO > method Createpod_det

Description

Initialize a new record in class table tpod_det.


Parameters


ic_ParentRowidinputcharacter= tpod_det.tc_ParentRowid
BMfgPOoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bmfgpo.p)

    assign oiReturnStatus = -98.

    empty temp-table t_spo_mstr.
    empty temp-table t_spod_det.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    find first tFcRowidConvert where
               tFcRowidConvert.tcFcOldRowid = ic_ParentRowid and
               tFcRowidConvert.tlFcOk       no-error.
    if available tFcRowidConvert
    then assign ic_ParentRowid = tFcRowidConvert.tcFcNewRowid.

    find tpo_mstr where
         tpo_mstr.tc_Rowid = ic_ParentRowid no-error.
    if not available tpo_mstr
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tpo_mstr.tc_Rowid':U,
                         input ic_ParentRowid,
                         input 'S':U,
                         input 3,
                         input ic_ParentRowid,
                         input '',
                         input '',
                         input '',
                         input '',
                         output oiReturnStatus" }
        assign oiReturnStatus = -3.
        return.
    end.

    create tpod_det.
    assign tpod_det.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tpod_det.tc_Status = "N":U.
    assign tpod_det.tc_ParentRowid = tpo_mstr.tc_Rowid
           tpod_det.pod_domain = tpo_mstr.po_domain
           tpod_det.pod_nbr = tpo_mstr.po_nbr.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'pod_det':U,
                     output oiReturnStatus" }

    create t_spod_det.
    raw-transfer tpod_det to t_spod_det.
    assign t_spod_det.tc_ParentRowid = ic_ParentRowid.