| 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.
<I-22 {UpdateTransStringForParentID
&TABLE = "Journal"}>
/* ====================================== */
/* Fill SharedSetID */
/* ====================================== */
assign viSharedSetID = 0.
if vcActivityCode <> "Create":U
then do:
assign vcSharedSetTypeJournal = {&SHAREDSETTYPECODE-JOURNAL}.
<Q-7 run LookupSharedSetForCompany (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input vcSharedSetTypeJournal, (SharedSetType)
output dataset tqSharedSetForCompany) in BCompany >
find first tqSharedSetForCompany no-error.
if available tqSharedSetForCompany
then assign viSharedSetID = tqSharedSetForCompany.tiSharedSet_ID.
end.
PROCESSBLOCK:
for each t_sjournal:
assign t_sJournal.SharedSet_ID = viSharedSetID.
/* ================================================================= */
/* Lookup object by logical key */
/* When in create mode, skip lookup. */
/* ================================================================= */
if vcActivityCode <> "Create":U
then do:
vcFreeform = "for each journal where journal.JournalCode = '":U + t_sjournal.JournalCode + "'":U
+ " and journal.SharedSet_ID = ":U + string(t_sjournal.SharedSet_ID).
<M-2 run DataLoad (input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeform (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
if viFcReturnSuper >= 0
then do:
find first tjournal where
tjournal.JournalCode = t_sjournal.JournalCode and
tjournal.SharedSet_ID = t_sjournal.SharedSet_ID
no-error.
if available tJournal and tJournal.tc_Status <> "":U
then do:
assign vcMessage = trim(#T-30'This daybook was already processed in this transaction.':255(574927976)T-30#) + chr(10) +
substitute(#T-46'Daybook Code: &1':255(240466872)T-46#, trim(t_sJournal.JournalCode)) + chr(10) +
substitute(#T-5'Shared Set ID: &1':255(95411682)T-5#, trim(string(t_sJournal.SharedSet_ID)))
oiReturnStatus = -1.
<M-98 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tJournal.JournalCode':U (icFieldName),
input t_sJournal.JournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sJournal.tc_Rowid (icRowid),
input 'QadFin-975570':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
return.
end. /* if available tJournal and tJournal.tc_Status <> "":U */
end. /* if viFcReturnSuper >= 0 */
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_sjournal.
else do:
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-49 run SetRowidConvert
(input t_sjournal.tc_Rowid (icOldRowid),
input tjournal.tc_Rowid (icNewRowid),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sjournal.tc_Rowid = tjournal.tc_Rowid
t_sjournal.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(tjournal.Journal_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_sjournal.JournalCode (icArguments),
input 'tjournal.JournalCode':U (icFieldName),
input t_sjournal.JournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sjournal.tc_Rowid (icRowid),
input 'QadFin-5185':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
assign oiReturnStatus = -1.
return.
end.
/* ================================================================= */
/* When object not found or in create mode, create it. */
/* ================================================================= */
<M-4 run AddDetailLine (input 'journal':U (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
assign t_sjournal.tc_Status = "N":U
tJournal.tc_Status = "N":U. /* we need to assign this tomake are test for doubles work */
end.
else do:
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
if available tJournal then
assign t_sjournal.tc_Status = "C":U
tJournal.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 return.
/* insert code for subtables here */
<I-8 {UpdateTransString
&TABLE = "Journal"}>
<M-43 run SetRowidConvert
(input t_sjournal.tc_Rowid (icOldRowid),
input tjournal.tc_Rowid (icNewRowid),
output viFcReturnSuper (oiReturnStatus)) in BJournal>
/* ================================================================= */
/* override value for identity fields in input */
/* ================================================================= */
assign
t_sJournal.Journal_ID = tJournal.Journal_ID
t_sJournal.SharedSet_ID = tJournal.SharedSet_ID
t_sJournal.JournalTypeCode = if t_sJournal.JournalTypeCode = "":U
then {&JOURNALTYPE-JOURNALENTRY}
else t_sJournal.JournalTypeCode
/* ================================================================= */
/* Update input to allow correct matching */
/* ================================================================= */
t_sjournal.tc_Rowid = tjournal.tc_Rowid
t_sjournal.tc_ParentRowid = ""
opPrimeKey = (if opPrimeKey = "" then "" else opPrimeKey + chr(4))
+ string(tjournal.Journal_ID).
end.
if oiReturnStatus = -98
then oiReturnStatus = 0.