Description
This method will retrieve an automatic number for the debtorshipto (if an active automatic number record was created for debtor - sharedset combination)
Parameters
icRowid | input | character | Rowid of the debtorshipto you want to automatically fill the debtorshiptocode for. |
ocDebtorShipToCode | output | character | Automatically generated DebtorCode |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bdebtorshipto.p)
/* ===================================================================================== */
/* This method will retrieve an automatic number for the DebtorShipTo */
/* (if an active automatic number record was created for debtor - sharedset combination) */
/* ====================================================================================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
find tDebtorShipTo where
tDebtorShipTo.tc_Rowid = icRowid and
tDebtorShipTo.tc_Status = 'N':U
no-error.
if not available tDebtorShipTo
then do:
assign vcMessage = trim(#T-3'Could not find a DebtorShipTo record with status N for this Row-Id.':100(63931)T-3#) + chr(10) +
trim(substitute(#T-4'Row IDs: &1.':200(20468)T-4#, trim(icRowid)))
oiReturnStatus = -3.
<M-1 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-6625':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtorShipTo>
return.
end. /* if not available tDebtorShipTo */
assign vhFcComponent = ?.
<M-2 run GetAutoNumber
(input 0 (iiDomainID),
input '':U (icDomainCode),
input tDebtorShipTo.SharedSet_ID (iiSharedSetID),
input '':U (icSharedSetCode),
input {&AUTONUMBERTYPE-DEBTOR} (icAutoNumberType),
output ocDebtorShipToCode (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.