SAP Function NUMBER_GET_NEXT - NUmber range: Assigns next free number

Parameter Reference Type Length Default Optional Text
IGNORE_BUFFER 0 SPACE X Ignore object buffering
NR_RANGE_NR INRI-NRRANGENR C 2 Number range number
OBJECT INRI-OBJECT C 10 Name of number range object
QUANTITY INRI-QUANTITY N 20 '1' X Number of numbers
SUBOBJECT 0 SPACE X Value of sub-object
TOYEAR INRI-TOYEAR N 4 '0000' X Value of To-fiscal year

Parameter Reference Type Length Text
NUMBER 0 free number
QUANTITY INRI-QUANTITY N 20 Number of numbers
RETURNCODE INRI-RETURNCODE C 1 Return code

Exception Text
BUFFER_OVERFLOW Puffer Is Full
INTERVAL_NOT_FOUND Interval not found
INTERVAL_OVERFLOW Interval used up. Change not possible.
NUMBER_RANGE_NOT_INTERN Number range is not internal
OBJECT_NOT_FOUND Object not defined in TNRO
QUANTITY_IS_0 Number of numbers requested must be > 0
QUANTITY_IS_NOT_1 Number of numbers requested must be 1


INCLUDE 'DOCU_HAS_TO_BE_ELABORATED' OBJECT DOKU ID TX
The function module assigns the next free numbers of a number range. Anumber is assigned as a default if no larger number is demanded in theparameter QUANTITY. If more than one number is demanded and not enoughnumbers are available up to the interval limit, the numbers are onlyassigned up to the interval limit. If the last number was assigned, thefirst interval number is provided again during the next call.
The length of the number depends on the definition of the number rangeobject. However, the length is not determined from the definition whenallocating, but is calculated from the length of th from-number of thenumber range.
INCLUDE BZN_RAIS ID TX
Example:
Object HUGO, not year-dependent, next free number searched for
DATA: RC LIKE 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 o.k.
WHEN '1'.
* the assigned number lies in the critical area.
WHEN '2'.
* this was the last number, next time the first number
* will be assigned
ENDCASE.
Object EGON, year-dependent, next 5 free numbers for 1992 in companycode 0001 searched for.
DATA: RC LIKE INRI-RETURNCODE,
NUMBER(10) TYPE C,
YEAR LIKE INRI-TOYEAR,
QUAN LIKE 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 number of the assigned numbers is in QUANTITY
* the first free number is calculated from:
* NUMBER - QUANTITY + 1.
CASE RC.
WHEN ' '.
* everything o.k.
WHEN '1'.
* the assigned number lies in the critical area.
WHEN '2'.
* this was the last number, next time the first number will beassigned
*
WHEN '3'.
* more numbers are demanded than are available,
* the number of the assigned numbers is in QUAN.
ENDCASE.
The free numbers are in this parameter. When more than one number isrequested, the last nummer issued is passed. The freenumbers then lie in the following interval:
NUMBER - QUANTITY + 1 to NUMBER
This parameter specified the number of number which should be assigned.If less than this number of numbers are available,this parameter contains the number of numbers assigned.
The return code provides information about the number status andcan have the following values:
  • " " (Space)

  • all o.k.
    • 1

    • the number issued lies in the critical range (see proc. in TNRO)
      • 2

      • the last number has been issued
        • 3

        • more numbers were requested than were available, the lastnumber was issued

          Description
          The parameter IGNORE_BUFFER causes numbers to be taken directly fromthe database. Number range object buffering is ignored. Theapplication programs must prevent that numbers for a number rangeobject are procured both from the buffer and from the database during aLUW because this may cause a deadlock situation.

          Default
          The default value is SPACE.
          INCLUDE BZN_NR_RANGE_NR ID TX
          INCLUDE BZN_OBJECT ID TX
          This parameter specified the number of number which should be assigned.If less than this number of numbers are available,this parameter contains the number of numbers assigned.
          Ony enter for types 4 to 8:
          INCLUDE BZN_SUBOBJECT ID TX
          INCLUDE BZN_TOYEAR ID TX

633980Error messages from the number range buffer
1176705BTC processes stop with the action "Direct Read NRIV"
639754When is a number finally assigned?
363901Country-specific buffering RV_BELEG/number assignment in SD
1398444Buffering the document number assignment for RF_BELEG
1493725Performance of Installed Base creation/change
1457522PI documents: Number range buffering and performance
449030 FB01: Deactivating number range buffering at interval level
1171039City/district info incorrect after transfer to route plannng
1091025DATA_OFFSET_TOO_LARGE in SAPLSNR3
91212Number ranges overwritten by a transport
840901Parallel buffering and pseudo ascending number assignment
834257FI document number assignment: Buffering using BTE 1170
130295ASSIGN_LENGTH_0 in LSNR3F01 LOCAL_ENTRY_EXISTS
617275SEM-BCS: Activity number for consolidation of investments
521625Apparent inconsistencies during the creation of projects
520275OIL SSR Clearing House transmission number buffered in error
499925SSR Collective Note beginning 27.02.02
23835Buffering RV_BELEG / Number assignment in SD