Description
Updates the contents of the class dataset.
When requested, the input data will be validated first, and the class dataset will only be updated when the input data is correct.
When no validation is requested, the input data is written to the class dataset unconditionally, but this data cannot be written to the database (method DataSave will return an error). The data can only be saved as a draft instance.
Parameters
il_Validate | input | logical | validate input data |
BDInvoice | input | dataset | class dataset |
oiReturnStatus | output | integer | error status |
program code (program/bdinvoice.p)
for each t_sDInvoice:
if t_sDInvoice.tc_Status = "D":U
then do:
run gipr_Delete_sDInvoiceBank (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoiceDeduction (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoiceMovement (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoiceOpInfo (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoicePosting (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoiceStage (input t_sDInvoice.tc_Rowid).
run gipr_Delete_sDInvoiceVat (input t_sDInvoice.tc_Rowid).
end.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoice.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoice.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoice where
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoice.tc_Rowid):
create t_sDInvoice.
raw-transfer t_oDInvoice to t_sDInvoice.
end.
for each t_sDInvoiceBank:
if t_sDInvoiceBank.tc_Status = "D":U
then do:
run gipr_Delete_sDInvoiceBankPayCode (input t_sDInvoiceBank.tc_Rowid).
end.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceBank.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceBank.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceBank.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceBank.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceBank where
not can-find (t_sDInvoiceBank where t_sDInvoiceBank.tc_Rowid = t_oDInvoiceBank.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceBank.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceBank.
raw-transfer t_oDInvoiceBank to t_sDInvoiceBank.
end.
for each t_sDInvoiceBankPayCode:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceBankPayCode.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceBankPayCode.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceBankPayCode.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceBankPayCode.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceBankPayCode where
not can-find (t_sDInvoiceBankPayCode where t_sDInvoiceBankPayCode.tc_Rowid = t_oDInvoiceBankPayCode.tc_Rowid) and
not can-find (t_sDInvoiceBank where t_sDInvoiceBank.tc_Rowid = t_oDInvoiceBankPayCode.tc_ParentRowid and t_sDInvoiceBank.tc_Status = "D":U):
create t_sDInvoiceBankPayCode.
raw-transfer t_oDInvoiceBankPayCode to t_sDInvoiceBankPayCode.
end.
for each t_sDInvoiceDeduction:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceDeduction.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceDeduction.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceDeduction.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceDeduction.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceDeduction where
not can-find (t_sDInvoiceDeduction where t_sDInvoiceDeduction.tc_Rowid = t_oDInvoiceDeduction.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceDeduction.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceDeduction.
raw-transfer t_oDInvoiceDeduction to t_sDInvoiceDeduction.
end.
for each t_sDInvoiceMovement:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceMovement.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceMovement.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceMovement.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceMovement.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceMovement where
not can-find (t_sDInvoiceMovement where t_sDInvoiceMovement.tc_Rowid = t_oDInvoiceMovement.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceMovement.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceMovement.
raw-transfer t_oDInvoiceMovement to t_sDInvoiceMovement.
end.
for each t_sDInvoiceOpInfo:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceOpInfo.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceOpInfo.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceOpInfo.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceOpInfo.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceOpInfo where
not can-find (t_sDInvoiceOpInfo where t_sDInvoiceOpInfo.tc_Rowid = t_oDInvoiceOpInfo.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceOpInfo.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceOpInfo.
raw-transfer t_oDInvoiceOpInfo to t_sDInvoiceOpInfo.
end.
for each t_sDInvoicePosting:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoicePosting.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoicePosting.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoicePosting.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoicePosting.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoicePosting where
not can-find (t_sDInvoicePosting where t_sDInvoicePosting.tc_Rowid = t_oDInvoicePosting.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoicePosting.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoicePosting.
raw-transfer t_oDInvoicePosting to t_sDInvoicePosting.
end.
for each t_sDInvoiceStage:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceStage.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceStage.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceStage.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceStage.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceStage where
not can-find (t_sDInvoiceStage where t_sDInvoiceStage.tc_Rowid = t_oDInvoiceStage.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceStage.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceStage.
raw-transfer t_oDInvoiceStage to t_sDInvoiceStage.
end.
for each t_sDInvoiceVat:
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceVat.tc_ParentRowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceVat.tc_ParentRowid = tFcRowidConvert.tcFcNewRowid.
find first tFcRowidConvert where
tFcRowidConvert.tcFcOldRowid = t_sDInvoiceVat.tc_Rowid and
tFcRowidConvert.tlFcOk no-error.
if available tFcRowidConvert
then assign t_sDInvoiceVat.tc_Rowid = tFcRowidConvert.tcFcNewRowid.
end.
for each t_oDInvoiceVat where
not can-find (t_sDInvoiceVat where t_sDInvoiceVat.tc_Rowid = t_oDInvoiceVat.tc_Rowid) and
not can-find (t_sDInvoice where t_sDInvoice.tc_Rowid = t_oDInvoiceVat.tc_ParentRowid and t_sDInvoice.tc_Status = "D":U):
create t_sDInvoiceVat.
raw-transfer t_oDInvoiceVat to t_sDInvoiceVat.
end.
if il_Validate
then do:
{ includes/bfcrun.i
&procedure = "CheckValidationExceptionList"
¶meters = "input true, output vl_validate" }
end.
if vl_Validate
then do:
{ includes/bfcrun.i
&procedure = "gipr_CompleteSTables" }
{ includes/bfcrun.i
&procedure = "ValidateComponent"
¶meters = "output oiReturnStatus" }
end.
if oiReturnStatus >= 0
then do:
{ includes/bfcrun.i
&procedure = "gipr_SetTables"
¶meters = "output viFcReturnSuper" }
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
end.
if il_Validate
and oiReturnStatus >= 0
then do:
{ includes/bfcrun.i
&procedure = "AdditionalUpdates"
¶meters = "output viFcReturnSuper" }
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
end.
if oiReturnStatus >= 0
then assign vlFcDataValidated = il_Validate.