Description
PreValidateComponent
Parameters
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bsafstructure.p)
for each t_sSafStructure where t_sSafStructure.tc_Status <> "D":U:
if not can-find(first t_sSafStructureLine where t_sSafStructureLine.SafStructure_ID = t_sSafStructure.SafStructure_ID and
t_sSafStructureLine.tc_Status <> "D":U)
then do:
<M-4 run SetMessage
(input #T-5'At least one SAF structure line must exist.':100(3669)t-5# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QADFIN-148':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
assign oiReturnStatus = -1.
end.
end.
<Q-8 run SafByCode (Start) in BSaf >
for each t_sSafStructureLine where
t_sSafStructureLine.tc_Status = "N":U or
t_sSafStructureLine.tc_Status = "C":U:
/* SafConceptCode is mandatory */
if t_sSafStructureLine.tcSafConceptCode = "":U or
t_sSafStructureLine.tcSafConceptCode = ?
then do:
<M-1 run SetMessage
(input #T-6'You must enter the SAF concept code for line $1.':100(3670)t-6# (icMessage),
input string(t_sSafStructureLine.SafStructureLineNumber) (icArguments),
input 'tSafStructureLine.tcSafConceptCode':U (icFieldName),
input t_sSafStructureLine.tcSafConceptCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sSafStructureLine.tc_Rowid (icRowid),
input 'QADFIN-25':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
assign oiReturnStatus = -1.
end.
else do:
<Q-2 run SafConceptByCode (all) (Read) (NoCache)
(input t_sSafStructureLine.tcSafConceptCode, (SafConceptCode)
output dataset tqSafConceptByCode) in BSafConcept >
find first tqSafConceptByCode no-error.
if available tqSafConceptByCode
then assign t_sSafStructureLine.SafConcept_ID = tqSafConceptByCode.tiSafConcept_ID.
else do:
<M-3 run SetMessage (input #T-7'Invalid SAF concept code for line $1.':100(3671)t-7# (icMessage),
input string(t_sSafStructureLine.SafStructureLineNumber) (icArguments),
input 'tSafStructureLine.tcSafConceptCode':U (icFieldName),
input t_sSafStructureLine.tcSafConceptCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sSafStructureLine.tc_Rowid (icRowid),
input 'QADFIN-26':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
assign oiReturnStatus = -1.
end.
end.
/* SafCode is mandatory */
if t_sSafStructureLine.tcSafCode = "":U or
t_sSafStructureLine.tcSafCode = ?
then do:
assign vcMessage = trim(#T-9'A default SAF code value is mandatory for SAF structures.':100(55853)t-9#)
oiReturnStatus = -1.
<M-10 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4976':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
end.
else do:
/* Synchronize SAF structure line with specified saf code & concept code */
<Q-16 run GetSaf (all) (Read) (NoCache) (input t_sSafStructureLine.tcSafCode, (SafCode)
input t_sSafStructureLine.tcSafConceptCode, (SafConceptCode)
input ?, (SafDescription)
input true, (SafIsActive)
output dataset tqGetSaf) in BSaf >
find first tqGetSaf no-error.
if(available(tqGetSaf)) then do:
assign
t_sSafStructureLine.Saf_ID=tqGetSaf.tiSaf_ID
t_sSafStructureLine.SafConcept_ID=tqGetSaf.tiSafConcept_ID.
end.
/* Validate that code exists for the specified concept code */
<Q-11 run SafByCode (all) (Read) (NoCache) (input t_sSafStructureLine.tcSafCode, (SafCode)
output dataset tqSafByCode) in BSaf >
find first tqSafByCode where tqSafByCode.tiSafConcept_ID=t_sSafStructureLine.SafConcept_ID no-error.
if available tqSafByCode and tqSafByCode.tlSafIsActive
then do:
if tqSafByCode.tiSafConcept_ID = t_sSafStructureLine.SafConcept_ID
then assign t_sSafStructureLine.Saf_ID = tqSafByCode.tiSaf_ID.
else do:
assign vcMessage = trim(substitute(#T-12'The SAF concept for line &1 is not the same as the SAF concept for SAF code &2.':150(55852)t-12#,
string(t_sSafStructureLine.SafStructureLineNumber),
t_sSafStructureLine.tcSafCode))
oiReturnStatus = -1.
<M-13 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4979':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
end.
end.
else do:
assign vcMessage = trim(substitute(#T-14'Invalid SAF code for line &1.':100(55851)t-14#, string(t_sSafStructureLine.SafStructureLineNumber)))
oiReturnStatus = -1.
<M-15 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4980':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSafStructure>
end.
end.
end. /* for each t_sSafStructureLine */
<Q-17 run SafByCode
(Stop) in BSaf >