project QadFinancials > class BMFGInvoiceHistory > method Createidh_hist

Description

Initialize a new record in class table tidh_hist.


Parameters


ic_ParentRowidinputcharacter= tidh_hist.tc_ParentRowid
BMfgInvoiceHistoryoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bmfginvoicehistory.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sih_hist.
    empty temp-table t_sidh_hist.
    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 tih_hist where
         tih_hist.tc_Rowid = ic_ParentRowid no-error.
    if not available tih_hist
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tih_hist.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 tidh_hist.
    assign tidh_hist.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tidh_hist.tc_Status = "N":U.
    assign tidh_hist.tc_ParentRowid = tih_hist.tc_Rowid
           tidh_hist.idh_domain = tih_hist.ih_domain
           tidh_hist.idh_inv_nbr = tih_hist.ih_inv_nbr
           tidh_hist.idh_nbr = tih_hist.ih_nbr.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'idh_hist':U,
                     output oiReturnStatus" }

    create t_sidh_hist.
    raw-transfer tidh_hist to t_sidh_hist.
    assign t_sidh_hist.tc_ParentRowid = ic_ParentRowid.