Description
This method will retrieve an automatic number for the debtor (if an active automatic number record was created for debtor - sharedset combination)
Parameters
icRowid | input | character | Rowid of the debtor you want to automatically fill the debtorcode for. |
ocDebtorCode | output | character | Automatically generated DebtorCode |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bdebtor.p)
/* ===================================================================================== */
/* This method will retrieve an automatic number for the debtor */
/* (if an active automatic number record was created for debtor - sharedset combination) */
/* ===================================================================================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
find tDebtor where
tDebtor.tc_Rowid = icRowid and
tDebtor.tc_Status = 'N':U
no-error.
if not available tDebtor
then do:
assign vcMessage = trim(#T-1'Could not find a Debtor record with status N for this Row-Id.':100(63927)T-1#) + chr(10) +
trim(substitute(#T-2'Row IDs: &1.':200(20468)T-2#, trim(icRowid)))
oiReturnStatus = -3.
<M-3 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QadFin-6623':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
return.
end. /* if not available tDebtor */
assign vhFcComponent = ?.
<M-4 run GetAutoNumber
(input 0 (iiDomainID),
input '':U (icDomainCode),
input tDebtor.SharedSet_ID (iiSharedSetID),
input '':U (icSharedSetCode),
input {&AUTONUMBERTYPE-DEBTOR} (icAutoNumberType),
output ocDebtorCode (ocAutoNumberNextNumber),
output viFcReturnSuper (oiReturnStatus)) in BAutoNumber>
if viFcReturnSuper <> 0
then do:
assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then do:
assign oiReturnStatus = viLocalReturnStatus.
return.
end. /* if viFcReturnSuper < 0 */
end. /* if viFcReturnSuper <> 0 */
assign oiReturnStatus = viLocalReturnStatus.