| ilValidate | input | logical | Should the input data be validated or not? If this is not the case, then the input-data will just be transfered to the business-side and not Validations or AdditionalUpdates will be executed. |
| tSPTAPMatching | input | temp-table | tSPTAPMatching: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT |
| tSPTAPMatchingLn | input | temp-table | tSPTAPMatchingLn: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT |
| tSPTAPMatchingLnTax | input | temp-table | tSPTAPMatchingLnTax: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT |
| oiReturnStatus | output | integer | Return status of the method. |
/* ================================================================================================ */
/* The purpose of this method is that is just a wrapper around the generated method SetPublicTables */
/* Interface of the generated method SetPublicTables: */
/* - input param ilValidate (logical) */
/* - inst-less input param tables like the class-tables */
/* - output param ReturnStatus */
/* This method will just have the same interface except the dataset; it has in stead of the dataset */
/* three temp-tables that are defined like the class-tables. The data of these 3 temp-tables need */
/* to be copied to the class-tables (creation etc may be involved) and then these 3 class-tables */
/* will be used as input for the BAPMatchingS of the generated method SetPublicTables. */
/* As method SetPublicTables is a generated one and does not exist in the class-db, we need to this */
/* with a manual run-statement. */
/* ================================================================================================ */
/* Part 1: Copy the content of the input to the class-tables */
/* Part 2: Run the generated method SetPublicTables (input dataset = BAPMatchingO that holds the */
/* t-class-tables with its data as provided in step 1 */
/* ================================================================================================ */
/* Note: we do not have a method 'SetPublicTablesDataSaveForTT' because in case of warnings, the */
/* user first has to handle them before the transaction should be committed. */
/* ================================================================================================ */
/* ================== */
/* Exception-handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
MAJORCOPYBLOCKSPTTT: DO :
/* ========================================== */
/* Go through the the main-table of the input */
/* ========================================== */
for each tSPTAPMatching :
/* ================================================================================================ */
/* This record should already exist in the class-tables / copy its content to the class-table */
/* ================================================================================================ */
find tAPMatching where
tAPMatching.tc_Rowid = tSPTAPMatching.tc_Rowid
no-lock no-error.
if not available tAPMatching
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(#T-23'The header record of the specified matching cannot be found. ':255(65683)t-23#) + chr(10) +
trim(substitute(#T-24'Technical information: the row ID (&1) of the input header table does not point to an existing record in the business (&1/&2).':255(69460)t-24#,tSPTAPMatching.tc_Rowid,"SetPublicTablesForTT":U,"1":U)).
<M-1 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7278':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if not available tAPMatching */
buffer-copy tSPTAPMatching
to tAPMatching
no-error.
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-25'Internal error: cannot copy the input tables content into the class-tables (&1).':255(65726)t-25#),"1":U).
if error-status:num-messages > 0
then assign vcMsgAPMatching = vcMsgAPMatching + chr(10) +
trim(substitute(#T-26'Detailed info: &1 (&2)':252(49824)T-26#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-4 run SetMessage (input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7279':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if error-status:error */
/* ======================================== */
/* Go through the APMatchingLn of the input */
/* ======================================== */
for each tSPTAPMatchingLn where
tSPTAPMatchingLn.tc_ParentRowid = tSPTAPMatching.tc_Rowid :
/* ====================================================================== */
/* Try to find the record in the class-table, it not found then create it */
/* ====================================================================== */
find tAPMatchingLn where
tAPMatchingLn.tc_Rowid = tSPTAPMatchingLn.tc_Rowid
no-lock no-error.
if not available tAPMatchingLn
then do :
/* If the input is marked as deleted and it is no longer in our instance: no problem */
if tSPTAPMatchingLn.tc_Status = "D":U or
tSPTAPMatching.tc_Status = "D":U
then next.
/* Else create it */
<M-7 run AddDetailLine
(input 'APMatchingLn':U (icTable),
input tAPMatching.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAJORCOPYBLOCKSPTTT.
end. /* if not available tAPMatchingLn */
/* ================================================================================ */
/* Copy its content to the class-table / except the ID, tc_rowid and tc_parentrowid */
/* ================================================================================ */
buffer-copy tSPTAPMatchingLn
except APMatchingLn_ID tc_Rowid tc_ParentRowid
to tAPMatchingLn
no-error.
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-27'Internal error: cannot copy the input tables content into the class-tables (&1).':255(65726)t-27#),"2":U).
if error-status:num-messages > 0
then assign vcMsgAPMatching = vcMsgAPMatching + chr(10) +
trim(substitute(#T-28'Detailed info: &1 (&2)':252(49824)T-28#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-8 run SetMessage (input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7382':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if error-status:error */
/* =========================================== */
/* Go through the APMatchingLnTax of the input */
/* =========================================== */
for each tSPTAPMatchingLnTax where
tSPTAPMatchingLnTax.tc_ParentRowid = tSPTAPMatchingLn.tc_Rowid :
/* ====================================================================== */
/* Try to find the record in the class-table, it not found then create it */
/* ====================================================================== */
find tAPMatchingLnTax where
tAPMatchingLnTax.tc_Rowid = tSPTAPMatchingLnTax.tc_Rowid
no-lock no-error.
if not available tAPMatchingLnTax
then do :
/* If the input is marked as deleted and it is no longer in our instance: no problem */
if tSPTAPMatchingLnTax.tc_Status = "D":U or
tSPTAPMatchingLn.tc_Status = "D":U or
tSPTAPMatching.tc_Status = "D":U
then next.
/* Else create it */
<M-11 run AddDetailLine
(input 'APMatchingLnTax':U (icTable),
input tAPMatchingLn.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAJORCOPYBLOCKSPTTT.
end. /* if not available tAPMatchingLn */
/* ================================================================================ */
/* Copy its content to the class-table / except the ID, tc_rowid and tc_parentrowid */
/* ================================================================================ */
buffer-copy tSPTAPMatchingLnTax
except APMatchingLnTax_ID tc_Rowid tc_ParentRowid
to tAPMatchingLnTax
no-error.
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-29'Internal error: cannot copy the input tables content into the class-tables (&1).':255(65726)t-29#,"3":U)).
if error-status:num-messages > 0
then assign vcMsgAPMatching = vcMsgAPMatching + chr(10) +
trim(substitute(#T-30'Detailed info: &1 (&2)':252(49824)T-30#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-12 run SetMessage (input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7384':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if error-status:error */
end. /* for each tSPTAPMatchingLnTax */
/* =========================================== */
/* Go through the APMatchingLnWHT of the input */
/* =========================================== */
for each tSPTAPMatchingLnWHT where
tSPTAPMatchingLnWHT.tc_ParentRowid = tSPTAPMatchingLn.tc_Rowid :
/* ====================================================================== */
/* Try to find the record in the class-table, it not found then create it */
/* ====================================================================== */
find tAPMatchingLnWHT where
tAPMatchingLnWHT.tc_Rowid = tSPTAPMatchingLnWHT.tc_Rowid
no-lock no-error.
if not available tAPMatchingLnWHT
then do :
/* If the input is marked as deleted and it is no longer in our instance: no problem */
if tSPTAPMatchingLnWHT.tc_Status = "D":U or
tSPTAPMatchingLn.tc_Status = "D":U or
tSPTAPMatching.tc_Status = "D":U
then next.
/* Else create it */
<M-67 run AddDetailLine
(input 'APMatchingLnWHT':U (icTable),
input tAPMatchingLn.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAJORCOPYBLOCKSPTTT.
end. /* if not available tAPMatchingLn */
/* ================================================================================ */
/* Copy its content to the class-table / except the ID, tc_rowid and tc_parentrowid */
/* ================================================================================ */
buffer-copy tSPTAPMatchingLnWHT
except APMatchingLnWHT_ID tc_Rowid tc_ParentRowid
to tAPMatchingLnWHT
no-error.
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-85'Internal error: cannot copy the input tables content into the class-tables (&1).':255(65726)T-85#,"3":U)).
if error-status:num-messages > 0
then assign vcMsgAPMatching = vcMsgAPMatching + chr(10) +
trim(substitute(#T-75'Detailed info: &1 (&2)':252(49824)T-75#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-45 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-35882':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if error-status:error */
end. /* for each tSPTAPMatchingLnWHT */
end. /* for each tSPTAPMatchingLn */
end. /* for each tSPTAPMatching */
/* ======================================================================================== */
/* Check whether the procedure-hanlde that we will use for running SetPublicTables is valid */
/* We need to do this by a manual run as this method is not callable via CBF */
/* ======================================================================================== */
if not valid-handle ({&TARGETPROCEDURE})
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-33'Internal error: cannot use the general handle to all class-methods (&1).':255(65731)t-33#,"TargetProcedure":U)).
<M-15 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7433':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if not valid-handle ({&TARGETPROCEDURE}) */
if not can-do({&TARGETPROCEDURE}:internal-entries,"SetPublicTables":U)
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-31'Internal error: cannot call method &1 in the general handle to all class-methods (&2).':255(65741)t-31#,"SetPublicTables":U,"TargetProcedure":U)).
<M-32 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7448':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if not can-do({&TARGETPROCEDURE}:internal-entries,"SetPublicTables":U) */
/* ===================================================================================================== */
/* Run method SetPublicTables: we need to do this by a manual run as this method is not callable via CBF */
/* ===================================================================================================== */
run SetPublicTables in {&TARGETPROCEDURE}
(input ilValidate,
input dataset BAPMatchingO, /* Dataset that holds the t-classtables */
output viFcReturnSuper) no-error.
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-34'Internal error: cannot call method (&1) in the instance.':255(65740)t-34#,"SetPublicTables":U)).
if error-status:num-messages > 0
then assign vcMsgAPMatching = vcMsgAPMatching + chr(10) +
trim(substitute(#T-20'Detailed info: &1 (&2)':252(49824)T-20#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-18 run SetMessage (input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7434':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave MAJORCOPYBLOCKSPTTT.
end. /* if error-status:error */
else do :
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAJORCOPYBLOCKSPTTT.
end. /* Not if error-status:error */
END. /* MAJORCOPYBLOCKSPTTT */
/* ================== */
/* Exception-handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.