SAP Help Get next number in number range using NUMBER_GET_NEXT function module
NUMBER_GET_NEXT to get next number in number range sap function module
The below code shows how function module NUMBER_GET_NEXT is used to retrieve next number from number range. Number ranges are used to
ensure the same number is not used twice when creating entries in a table. Once a number has been requested from the number range
the next person to request a number will not get the same number.
Retreive next number from Number Range.
CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING NR_RANGE_NR = '1' "Number range interval OBJECT = 'ZNRANGE' "Number range object (SNRO) * QUANTITY = '1' "No. of numbers * SUBOBJECT = ' ' * TOYEAR = '0000' * IGNORE_BUFFER = ' ' IMPORTING NUMBER = ld_number * QUANTITY = RETURNCODE = ld_error EXCEPTIONS INTERVAL_NOT_FOUND = 1 NUMBER_RANGE_NOT_INTERN = 2 OBJECT_NOT_FOUND = 3 QUANTITY_IS_0 = 4 QUANTITY_IS_NOT_1 = 5 INTERVAL_OVERFLOW = 6 BUFFER_OVERFLOW = 7 OTHERS = 8.
SAP number range objects are created within transaction SNRO