| opPrimeKey | output | longchar | Primary Key field value of loaded record(s). Keys are chr(4) separated. Key fields are chr(2) separated. |
| oiReturnStatus | output | integer | Return status of the method. |
if oiReturnStatus = 0
then oiReturnStatus = -98.
PROCESSBLOCK:
for each t_sPaymentCondition:
/* ================================================================= */
/* Lookup object by logical key */
/* When in create mode, skip lookup. */
/* ================================================================= */
if vcActivityCode <> "Create":U
then do:
vcFreeform = "for each PaymentCondition where PaymentCondition.PaymentConditionCode = '":U + t_sPaymentCondition.PaymentConditionCode + "'":U.
<M-2 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeForm (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
if viFcReturnSuper >= 0
then find first tPaymentCondition where
tPaymentCondition.PaymentConditionCode = t_sPaymentCondition.PaymentConditionCode
no-error.
end.
/* ================================================================= */
/* When in delete mode, ignore input data. */
/* When object not found, do not return an error. */
/* ================================================================= */
if vcActivityCode = "Delete":U
then do:
if viFcReturnSuper = -4
then delete t_sPaymentCondition.
else do:
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave PROCESSBLOCK.
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sPaymentCondition.tc_Rowid = tPaymentCondition.tc_Rowid
t_sPaymentCondition.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(tPaymentCondition.PaymentCondition_ID).
end.
next.
end.
if vcActivityCode = "Create":U
or viFcReturnSuper = -4
then do:
/* ================================================================= */
/* When object not found and in modify only mode, return an error. */
/* ================================================================= */
if vcActivityCode = "Modify":U
then do:
assign vcMessage = trim(#T-1'Object with key $1 does not exist.':100(48021)T-1#).
<M-3 run SetMessage
(input vcMessage (icMessage),
input t_sPaymentCondition.PaymentConditionCode (icArguments),
input 'tPaymentCondition.PaymentConditionCode':U (icFieldName),
input t_sPaymentCondition.PaymentConditionCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPaymentCondition.tc_Rowid (icRowid),
input 'QadFin-5222':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
assign oiReturnStatus = -1.
leave PROCESSBLOCK.
end.
/* ================================================================= */
/* When object not found or in create mode, create it. */
/* ================================================================= */
<M-4 run AddDetailLine (input 'PaymentCondition':U (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sPaymentCondition.tc_Status = "N":U.
end.
else do:
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sPaymentCondition.tc_Status = "C":U.
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave PROCESSBLOCK.
assign t_sPaymentCondition.PaymentCondition_ID = tPaymentCondition.PaymentCondition_ID.
/* insert code for subtables here */
/* ================================================================= */
/* Delete existing detail */
/* ================================================================= */
for each tPaymentConditionStaged where
tPaymentConditionStaged.tc_ParentRowid = tPaymentCondition.tc_Rowid:
assign tPaymentConditionStaged.tc_Status = "D":U.
end.
/* ================================================================= */
/* Update / add detail */
/* ================================================================= */
for each t_sPaymentConditionStaged where
t_sPaymentConditionStaged.tc_ParentRowid = t_sPaymentCondition.tc_Rowid and
t_sPaymentConditionStaged.tc_Status <> "D":U:
find first tPaymentConditionStaged where
tPaymentConditionStaged.tc_ParentRowid = tPaymentCondition.tc_Rowid and
tPaymentConditionStaged.tcStagedPaymentConditionCode = t_sPaymentConditionStaged.tcStagedPaymentConditionCode
no-error.
if available tPaymentConditionStaged
then assign t_sPaymentConditionStaged.tc_Status = "C":U.
else do:
<M-5 run AddDetailLine
(input 'PaymentConditionStaged':U (icTable),
input tPaymentCondition.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave PROCESSBLOCK.
assign t_sPaymentConditionStaged.tc_Status = "N":U.
end.
/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign
t_sPaymentConditionStaged.PaymentConditionStaged_ID = tPaymentConditionStaged.PaymentConditionStaged_ID
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_sPaymentConditionStaged.PaymentCondition_ID = tPaymentConditionStaged.PaymentCondition_ID
t_sPaymentConditionStaged.tc_Rowid = tPaymentConditionStaged.tc_Rowid
t_sPaymentConditionStaged.tc_ParentRowid = tPaymentCondition.tc_Rowid.
end.
<I-90 {UpdateTransString
&TABLE = "PaymentCondition"}>
/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign t_sPaymentCondition.PaymentCondition_ID = tPaymentCondition.PaymentCondition_ID
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_sPaymentCondition.tc_Rowid = tPaymentCondition.tc_Rowid
t_sPaymentCondition.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(tPaymentCondition.PaymentCondition_ID).
end. /* PROCESSBLOCK */
if oiReturnStatus = -98
then oiReturnStatus = 0.