project QadFinancials > class BBankNumber > method ValidateComponentParentObject
Description
Validates Parent Object
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bbanknumber.p)
/* error: not a valid object (Creditor, Debtor, Employee, GL) */
case t_sBankNumber.BankNumberParentType:
when {&BANKNUMBERPARENTTYPE-CREDITOR}
then do:
<Q-1 run CreditorPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (CreditorId)
input t_sBankNumber.tcParentObjectCode, (CreditorCode)
output dataset tqCreditorPrim) in BCreditor >
find first tqCreditorPrim no-error.
if not available tqCreditorPrim
then do:
assign vcMessage = trim(substitute(#T-11'The specified supplier (bank account: &1) is not defined.':200(398)t-11#,
trim(t_sBankNumber.BankNumber))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-4 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-305':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* if not avail */
else assign t_sBankNumber.ParentObject_ID = tqCreditorPrim.tiCreditor_ID.
end. /* Creditor */
when {&BANKNUMBERPARENTTYPE-DEBTOR}
then do:
<Q-2 run DebtorPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input t_sBankNumber.tcParentObjectCode, (DebtorCode)
input ?, (Debtor_ID)
output dataset tqDebtorPrim) in BDebtor >
find first tqDebtorPrim no-error.
if not available tqDebtorPrim
then do:
assign vcMessage = trim(substitute(#T-12'The specified customer (bank account: &1) is not defined.':200(399)t-12#,
trim(t_sBankNumber.BankNumber))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-5 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-306':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* if not avail */
else assign t_sBankNumber.ParentObject_ID = tqDebtorPrim.tiDebtor_ID.
end. /* Debtor */
when {&BANKNUMBERPARENTTYPE-EMPLOYEE}
then do:
<Q-9 run EmployeePrim (all) (Read) (NoCache)
(input ?, (EmployeeId)
input t_sBankNumber.tcParentObjectCode, (EmployeeCode)
input viCompanyId, (CompanyId)
output dataset tqEmployeePrim) in BEmployee >
find first tqEmployeePrim no-error.
if not available tqEmployeePrim
then do:
assign vcMessage = trim(substitute(#T-13'The specified employee (bank account: &1) is not defined.':200(400)t-13#,
trim(t_sBankNumber.BankNumber))) + chr(10) +
program-name(1)
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-304':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* if not avail */
else assign t_sBankNumber.ParentObject_ID = tqEmployeePrim.tiEmployee_ID.
end. /* Employee */
when {&BANKNUMBERPARENTTYPE-GL}
then do:
<Q-3 run GLPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input t_sBankNumber.tcParentObjectCode, (GLCode)
input ?, (GLId)
output dataset tqGLPrim) in BGL >
find first tqGLPrim no-error.
if not available tqGLPrim
then do:
assign vcMessage = trim(substitute(#T-14'The specified GL account (bank account: &1) is not defined.':200(401)t-14#,
trim(t_sBankNumber.BankNumber))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-6 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-307':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* if not avail */
else assign t_sBankNumber.ParentObject_ID = tqGLPrim.tiGL_ID.
end. /* GL */
/*error: unknown ParentType - cannot do the check*/
otherwise do:
assign vcMessage = trim(substitute(#T-15'Object type (&1) is not supported (bank account: &2).':200(70757)T-15#,
trim(t_sBankNumber.BankNumberParentType),
trim(t_sBankNumber.BankNumber))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-7 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-308':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end.
end case.