SAP SWU_NUMBER_RANGE_CREATE Function Module for
SWU_NUMBER_RANGE_CREATE is a standard swu number range create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for swu number range create FM, simply by entering the name SWU_NUMBER_RANGE_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SWU1
Program Name: SAPLSWU1
Main Program: SAPLSWU1
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SWU_NUMBER_RANGE_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SWU_NUMBER_RANGE_CREATE'".
EXPORTING
OBJECT = "Name of number range object
* NR_RANGE_NR1 = '01' "Internal or external number range number
* SUBOBJECT = ' ' "Sub-object value
* USE_MAX_RANGE = 'X' "Maximum number range is being used
* QUANTITY = '0' "Number of numbers
IMPORTING
NUMBER = "Free number
QUANTITY = "Number of numbers
RETURNCODE = "
EXCEPTIONS
RANGE_ALREADY_EXISTS = 1 OBJECT_NOT_FOUND = 2 SYSTEM_ERROR = 3
IMPORTING Parameters details for SWU_NUMBER_RANGE_CREATE
OBJECT - Name of number range object
Data type: NRIV-OBJECTOptional: No
Call by Reference: No ( called with pass by value option)
NR_RANGE_NR1 - Internal or external number range number
Data type: NRIV-NRRANGENRDefault: '01'
Optional: Yes
Call by Reference: No ( called with pass by value option)
SUBOBJECT - Sub-object value
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USE_MAX_RANGE - Maximum number range is being used
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
QUANTITY - Number of numbers
Data type: INRI-QUANTITYDefault: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SWU_NUMBER_RANGE_CREATE
NUMBER - Free number
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
QUANTITY - Number of numbers
Data type: INRI-QUANTITYOptional: No
Call by Reference: No ( called with pass by value option)
RETURNCODE -
Data type: INRI-RETURNCODEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
RANGE_ALREADY_EXISTS - Number range already exists
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OBJECT_NOT_FOUND - Object not defined in TNRO
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SYSTEM_ERROR - System errors occurred
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SWU_NUMBER_RANGE_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_number | TYPE STRING, " | |||
| lv_object | TYPE NRIV-OBJECT, " | |||
| lv_range_already_exists | TYPE NRIV, " | |||
| lv_quantity | TYPE INRI-QUANTITY, " | |||
| lv_nr_range_nr1 | TYPE NRIV-NRRANGENR, " '01' | |||
| lv_object_not_found | TYPE NRIV, " | |||
| lv_subobject | TYPE NRIV, " SPACE | |||
| lv_returncode | TYPE INRI-RETURNCODE, " | |||
| lv_system_error | TYPE INRI, " | |||
| lv_use_max_range | TYPE INRI, " 'X' | |||
| lv_quantity | TYPE INRI-QUANTITY. " '0' |
|   CALL FUNCTION 'SWU_NUMBER_RANGE_CREATE' " |
| EXPORTING | ||
| OBJECT | = lv_object | |
| NR_RANGE_NR1 | = lv_nr_range_nr1 | |
| SUBOBJECT | = lv_subobject | |
| USE_MAX_RANGE | = lv_use_max_range | |
| QUANTITY | = lv_quantity | |
| IMPORTING | ||
| NUMBER | = lv_number | |
| QUANTITY | = lv_quantity | |
| RETURNCODE | = lv_returncode | |
| EXCEPTIONS | ||
| RANGE_ALREADY_EXISTS = 1 | ||
| OBJECT_NOT_FOUND = 2 | ||
| SYSTEM_ERROR = 3 | ||
| . " SWU_NUMBER_RANGE_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM SWU_NUMBER_RANGE_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single OBJECT FROM NRIV INTO @DATA(ld_object). | ||||
| "SELECT single QUANTITY FROM INRI INTO @DATA(ld_quantity). | ||||
| "SELECT single NRRANGENR FROM NRIV INTO @DATA(ld_nr_range_nr1). | ||||
| DATA(ld_nr_range_nr1) | = '01'. | |||
| DATA(ld_subobject) | = ' '. | |||
| "SELECT single RETURNCODE FROM INRI INTO @DATA(ld_returncode). | ||||
| DATA(ld_use_max_range) | = 'X'. | |||
| "SELECT single QUANTITY FROM INRI INTO @DATA(ld_quantity). | ||||
| DATA(ld_quantity) | = '0'. | |||
Search for further information about these or an SAP related objects