project QadFinancials > class BMfgAllocationAccount > method Createald_det

Description

Initialize a new record in class table tald_det.


Parameters


ic_ParentRowidinputcharacter= tald_det.tc_ParentRowid
BMfgAllocationAccountoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bmfgallocationaccount.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sal_mstr.
    empty temp-table t_sald_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 tal_mstr where
         tal_mstr.tc_Rowid = ic_ParentRowid no-error.
    if not available tal_mstr
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tal_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 tald_det.
    assign tald_det.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tald_det.tc_Status = "N":U.
    assign tald_det.tc_ParentRowid = tal_mstr.tc_Rowid
           tald_det.ald_code = tal_mstr.al_code
           tald_det.ald_domain = tal_mstr.al_domain.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'ald_det':U,
                     output oiReturnStatus" }

    create t_sald_det.
    raw-transfer tald_det to t_sald_det.
    assign t_sald_det.tc_ParentRowid = ic_ParentRowid.