SAP Function Modules

SWU_NUMBER_RANGE_CREATE SAP Function module







SWU_NUMBER_RANGE_CREATE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name SWU_NUMBER_RANGE_CREATE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SWU1
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM SWU_NUMBER_RANGE_CREATE - SWU NUMBER RANGE CREATE





CALL FUNCTION 'SWU_NUMBER_RANGE_CREATE' "
  EXPORTING
    object =                    " nriv-object   Name of number range object
*   nr_range_nr1 = '01'         " nriv-nrrangenr  Internal or external number range number
*   subobject = SPACE           "               Sub-object value
*   use_max_range = 'X'         "               Maximum number range is being used
*   quantity = '0'              " inri-quantity  Number of numbers
  IMPORTING
    number =                    "               Free number
    quantity =                  " inri-quantity  Number of numbers
    returncode =                " inri-returncode
  EXCEPTIONS
    RANGE_ALREADY_EXISTS = 1    "               Number range already exists
    OBJECT_NOT_FOUND = 2        "               Object not defined in TNRO
    SYSTEM_ERROR = 3            "               System errors occurred
    .  "  SWU_NUMBER_RANGE_CREATE

ABAP code example for Function Module SWU_NUMBER_RANGE_CREATE





The ABAP code below is a full code listing to execute function module SWU_NUMBER_RANGE_CREATE including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_number  TYPE STRING ,
ld_quantity  TYPE INRI-QUANTITY ,
ld_returncode  TYPE INRI-RETURNCODE .


SELECT single OBJECT
FROM NRIV
INTO @DATA(ld_object).


SELECT single NRRANGENR
FROM NRIV
INTO @DATA(ld_nr_range_nr1).

DATA(ld_subobject) = 'some text here'.
DATA(ld_use_max_range) = 'some text here'.

DATA(ld_quantity) = Check type of data required . CALL FUNCTION 'SWU_NUMBER_RANGE_CREATE' EXPORTING object = ld_object * nr_range_nr1 = ld_nr_range_nr1 * subobject = ld_subobject * use_max_range = ld_use_max_range * quantity = ld_quantity IMPORTING number = ld_number quantity = ld_quantity returncode = ld_returncode EXCEPTIONS RANGE_ALREADY_EXISTS = 1 OBJECT_NOT_FOUND = 2 SYSTEM_ERROR = 3 . " SWU_NUMBER_RANGE_CREATE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_number  TYPE STRING ,
ld_object  TYPE NRIV-OBJECT ,
ld_quantity  TYPE INRI-QUANTITY ,
ld_nr_range_nr1  TYPE NRIV-NRRANGENR ,
ld_returncode  TYPE INRI-RETURNCODE ,
ld_subobject  TYPE STRING ,
ld_use_max_range  TYPE STRING ,
ld_quantity  TYPE INRI-QUANTITY .


SELECT single OBJECT
FROM NRIV
INTO ld_object.


SELECT single NRRANGENR
FROM NRIV
INTO ld_nr_range_nr1.

ld_subobject = 'some text here'.
ld_use_max_range = 'some text here'.

ld_quantity = Check type of data required

SAP Documentation for FM SWU_NUMBER_RANGE_CREATE

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name SWU_NUMBER_RANGE_CREATE or its description.