project QadFinancials > class BDDocument > method CreateDDocumentPostingLine
Description
Initialize a new record in class table tDDocumentPostingLine.
Parameters
ic_ParentRowid | input | character | = tDDocumentPostingLine.tc_ParentRowid |
BDDocument | output | dataset | class dataset, containing only the newly initialized record |
oiReturnStatus | output | integer | error status |
program code (program/bddocument.p)
assign oiReturnStatus = -98.
empty temp-table t_sDDocument.
empty temp-table t_sDDocInvoiceXrefStage.
empty temp-table t_sDDocumentInvoiceXref.
empty temp-table t_sDDocumentPostingLine.
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 tDDocument where
tDDocument.tc_Rowid = ic_ParentRowid no-error.
if not available tDDocument
then do:
{ includes/bfcrun.i
&PROCEDURE = "SetMessage"
&PARAMETERS = "input 'Invalid parent ID':U,
input '',
input 'tDDocument.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 tDDocumentPostingLine.
assign tDDocumentPostingLine.tc_Rowid = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
tDDocumentPostingLine.tc_Status = "N":U.
{ includes/bfcrun.i
&procedure = "StartPersistence"
¶meters = "output vh_persistence,
output viFcReturnSuper" }
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
assign tDDocumentPostingLine.DDocumentPostingLine_ID = dynamic-function ("GetNextValue":U in vh_persistence,"ObjectNumber":U).
assign tDDocumentPostingLine.tc_ParentRowid = tDDocument.tc_Rowid
tDDocumentPostingLine.DDocument_ID = tDDocument.DDocument_ID.
{ includes/bfcrun.i
&procedure = "InitialValues"
¶meters = "input 'DDocumentPostingLine':U,
output oiReturnStatus" }
create t_sDDocumentPostingLine.
raw-transfer tDDocumentPostingLine to t_sDDocumentPostingLine.
assign t_sDDocumentPostingLine.tc_ParentRowid = ic_ParentRowid.