project QadFinancials > class BDebtorEndUser > method GetAutoNumber


Parameters


icRowIdinputcharacter
ocDebtorEndUserCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtorEndUser.ApiGenerateEndUserCode
method BDebtorEndUser.ValidateComponent


program code (program6/bdebtorenduser.p)

/* ===================================================================================== */
/* This method will retrieve an automatic number for the end user                           */
/* (if an active automatic number record was created for end user - sharedset combination) */
/* ===================================================================================== */
assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

find tDebtorEndUser where
     tDebtorEndUser.tc_Rowid  = icRowid and
     tDebtorEndUser.tc_Status = 'N':U
     no-error.
if not available tDebtorEndUser
then do:
    assign vcMessage      = trim(#T-3'The system cannot find a customer end user record with status N for this row ID.':100(65043)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-6894':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BDebtorEndUser>
    return.
end. /* if not available tDebtorEndUser */



assign vhFcComponent = ?.
<M-2 run GetAutoNumber
   (input  0 (iiDomainID), 
    input  '':U (icDomainCode), 
    input  tDebtorEndUser.SharedSet_ID (iiSharedSetID), 
    input  '':U (icSharedSetCode), 
    input  {&AUTONUMBERTYPE-ENDUSER} (icAutoNumberType), 
    output ocDebtorEndUserCode (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.