Ansicht
Dokumentation

NUMBER_GET_NEXT - NUmber range: Assigns next free number

NUMBER_GET_NEXT - NUmber range: Assigns next free number

Vendor Master (General Section)   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book
Preliminary comment

This function module has been released.

The documentation is being revised so that it conforms to the requirements for released function modules.

The function module assigns the next free numbers of an interval.

A number is assigned as a default if no greater quantity is requested in the parameter QUANTITY. Multiple numbers can only be requested in main memory buffering. If more than one number is requested and not enough numbers are available up to the interval limit, the numbers are only assigned up to the interval limit. If the last number was assigned, the first interval number is provided again in the next call.

The length of the number depends on the definition of the number range object. However, the length is not determined from the definition when the number is assigned. Instead, it is calculated from the length of the from number of the interval.

All exceptions are created with MESSAGE ... RAISING ... .

Example:

  1. Object HUGO, not year-dependent, next free number wanted

    DATA: RC         TYPE INRI-RETURNCODE,
          NUMBER(10) TYPE C.

       CALL FUNCTION 'NUMBER_GET_NEXT'
            EXPORTING
              OBJECT      = 'HUGO'
              NR_RANGE_NR = '01'
            IMPORTING
              RETURNCODE  = RC
             NUMBER      = NUMBER.

       CASE RC.
         WHEN ' '.
    *      everything OK
         WHEN '1'.
    *      the assigned number is in the critical range.
         WHEN '2'.
    *      this was the last number, next time the first number
    *      is assigned
       ENDCASE.
  2. Object EGON, year-dependent, next five free numbers wanted for 1992 in company code 0001.

    DATA: RC TYPE INRI-RETURNCODE,
    NUMBER(10) TYPE C,
    YEAR TYPE INRI-TOYEAR,
    QUAN TYPE INRI-QUANTITY.

    YEAR = '1992'.
    QUAN = 5.
    T001-BUKRS = '0001'.

    CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING OBJECT = 'EGON'
    NR_RANGE_NR = '01'
    SUBOBJECT = T001-BUKRS
    TOYEAR = YEAR
    IMPORTING RETURNCODE = RC
    QUANTITY = QUAN
    NUMBER = NUMBER.

    * the last assigned number is in NUMBER
    * the quantity of the assigned numbers is in QUANTITY
    * the first free number is calculated from:
    * NUMBER - QUANTITY + 1.

    CASE RC.
    WHEN ' '.
    * everything OK
    WHEN '1'.
    * the assigned number is in the critical range.
    WHEN '2'.
    * this was the last number, next time the first number
    * is assigned
    WHEN '3'.
    * more numbers are requested than are available,
    * the quantity of the assigned numbers is in QUAN.
    ENDCASE.




Parameters

IGNORE_BUFFER
NR_RANGE_NR
NUMBER
OBJECT
QUANTITY
QUANTITY
RETURNCODE
SUBOBJECT
TOYEAR

Exceptions

BUFFER_OVERFLOW
INTERVAL_NOT_FOUND
INTERVAL_OVERFLOW
NUMBER_RANGE_NOT_INTERN
OBJECT_NOT_FOUND
QUANTITY_IS_0
QUANTITY_IS_NOT_1

Function Group

SNR3

CL_GUI_FRONTEND_SERVICES - Frontend Services   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 5476 Date: 20240523 Time: 121756     sap01-206 ( 57 ms )