| 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. |
PROCESSBLOCK:
do on error undo, throw:
for each t_sCyGroup:
/* ================================================================= */
/* Lookup object by logical key */
/* When in create mode, skip lookup. */
/* ================================================================= */
if vcActivityCode <> "Create":U
then do:
vcFreeform = "for each CyGroup where CyGroup.CyGroupCode = '":U + t_sCyGroup.CyGroupCode + "'":U.
<M-11 run DataLoad
(input '':U (icRowids),
input '':U (icPkeys),
input '':U (icObjectIds),
input vcFreeform (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BCYGroup>
if viFcReturnSuper >= 0
then do:
find first tCyGroup where
tCyGroup.CyGroupCode = t_sCyGroup.CyGroupCode
no-error.
if available tCyGroup and tCyGroup.tc_Status <> "":U
then do:
assign vcMessage = trim(#T-75'This Entity Group was already processed in this transaction.':255(285079990)T-75#) + chr(10) +
substitute(#T-17'Entity group &1':255(661344568)T-17#, trim(t_sCyGroup.CyGroupCode))
oiReturnStatus = -1.
<M-46 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tCyGroup.CyGroupCode':U (icFieldName),
input t_sCyGroup.CyGroupCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCyGroup.tc_Rowid (icRowid),
input 'qadfin-303974':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCYGroup>
return.
end. /* if available tCyGroup and tCyGroup.tc_Status <> "":U */
end. /* if viFcReturnSuper >= 0 */
end. /* if vcActivityCode <> "Create":U */
/* ================================================================= */
/* 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_sCyGroup.
else do:
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave PROCESSBLOCK.
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sCyGroup.tc_Rowid = tCyGroup.tc_Rowid
t_sCyGroup.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = ""
then ""
else opPrimeKey + chr(4))
+ string(tCyGroup.CyGroup_ID).
end. /* else if viFcReturnSuper = -4 */
next.
end. /* if vcActivityCode = "Delete":U */
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-27'Object with key $1 does not exist.':100(48021)T-27#).
<M-87 run SetMessage
(input vcMessage (icMessage),
input t_sCyGroup.CyGroupCode (icArguments),
input 'tCyGroup.CyGroupCode':U (icFieldName),
input t_sCyGroup.CyGroupCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCyGroup.tc_Rowid (icRowid),
input 'qadfin-195079':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCYGroup>
assign oiReturnStatus = -1.
leave PROCESSBLOCK.
end.
/* ================================================================= */
/* When object not found or in create mode, create it. */
/* ================================================================= */
<M-69 run AddDetailLine
(input 'CyGroup':U (icTable),
input '':U (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BCYGroup>
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sCyGroup.tc_Status = "N":U
tCyGroup.tc_Status = "N":U. /* we need to assign this tomake are test for doubles work */
end.
else do:
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sCyGroup.tc_Status = "C":U
tCyGroup.tc_Status = "C":U. /* we need to assign this tomake are test for doubles work */
end.
if viFcReturnSuper <> 0 then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave PROCESSBLOCK.
assign t_sCyGroup.CyGroup_ID = tCyGroup.CyGroup_ID.
/* Synchronize CyGroupCompany */
<M-34 run DataLoadByInputCyGroupCompany (output viFcReturnSuper (oiReturnStatus)) in BCYGroup>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave PROCESSBLOCK.
<I-8 {UpdateTransString
&TABLE = "CyGroup"}>
/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign t_sCyGroup.CyGroup_ID = tCyGroup.CyGroup_ID
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_sCyGroup.tc_Rowid = tCyGroup.tc_Rowid
t_sCyGroup.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(tCyGroup.CyGroup_ID).
end.
end. /* Process block */