project QadFinancials > class BDebtor > method CreateDebtor

Description

Initialize a new record in class table tDebtor.


Parameters


ic_ParentRowidinputcharacter= tDebtor.tc_ParentRowid
BDebtoroutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bdebtor.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sDebtor.
    empty temp-table t_sDebtorSafDefault.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    create tDebtor.
    assign tDebtor.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tDebtor.tc_Status = "N":U.
    { includes/bfcrun.i
      &procedure  = "StartPersistence"
      &parameters = "output vh_persistence,
                     output viFcReturnSuper" }
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.
    assign tDebtor.Debtor_ID = dynamic-function ("GetNextValue":U in vh_persistence,"ObjectNumber":U).
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'Debtor':U,
                     output oiReturnStatus" }

    create t_sDebtor.
    raw-transfer tDebtor to t_sDebtor.