project QadFinancials > class BMfgCosting > method Createspt_det

Description

Initialize a new record in class table tspt_det.


Parameters


ic_ParentRowidinputcharacter= tspt_det.tc_ParentRowid
BMfgCostingoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bmfgcosting.p)

    assign oiReturnStatus = -98.

    empty temp-table t_ssct_det.
    empty temp-table t_sspt_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 tsct_det where
         tsct_det.tc_Rowid = ic_ParentRowid no-error.
    if not available tsct_det
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tsct_det.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 tspt_det.
    assign tspt_det.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tspt_det.tc_Status = "N":U.
    assign tspt_det.tc_ParentRowid = tsct_det.tc_Rowid
           tspt_det.spt_domain = tsct_det.sct_domain
           tspt_det.spt_part = tsct_det.sct_part
           tspt_det.spt_sim = tsct_det.sct_sim
           tspt_det.spt_site = tsct_det.sct_site.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'spt_det':U,
                     output oiReturnStatus" }

    create t_sspt_det.
    raw-transfer tspt_det to t_sspt_det.
    assign t_sspt_det.tc_ParentRowid = ic_ParentRowid.