SAP Tutorial for ABAP Developers Create Number Range Object using SAP Transaction Code SNRO

Step by step Number Range Creation using SNRO SAP Transaction In SAP Easy Access screen, call SAP transaction code SNRO

Enter Number Range name in the Number Range Object input text field.

Enter Short Text and Long Text descriptive texts for Number Range Object. Enter a number length domain for the number range object If you want a warning define an integer smaller than 100 in the Warning % field. You can enter 5 or 10 as common warning percentage values.

Click on the Save button

to save the number range definition.

Click on "Add Interval" button . I select Local Object Now the Change documents and Number ranges buttons are displayed in the Number Range Object : Change SAP screen. Click on Change Intervals buttons. Click on "Number ranges" button.Click on Yes button to continue. The next screen displayed is Create Object Directory Entry screen.

And the number range interval you have just declared will be listed in the Number Range object 's number intervals list. Click on "Save" button. . If you have entered required fields press Enter button.Enter an integer number like 1 at interval number and a range of numbers with integer values identifying from number and to number.

The following "Transport number range intervals" warning screen is displayed. Please note the information that you get when transporting number range intervals. . The number range intervals are not included in automatic recording of customizing changes. Transport of all the changes made within number range interval maintenance must be triggered manually. In the initial screen for number range interval maintenance choose the function Interval -> Transport. Here is the display screen of the Number Range object.

DATA : " NodeId from Number Generator Object gv_nodeid TYPE i. " Number range number . PERFORM nextnum USING gv_nodeid c_rangeobj c_rangeno. FORM nextnum USING le_nextnum TYPE i le_rangeobj LIKE inri-object le_rangeno LIKE inri-nrrangenr. DATA : lv_nextnum TYPE i. START-OF-SELECTION.CHAR 10 c_rangeobj LIKE inri-object VALUE 'Z_TREENODE'.REPORT ztreenodes .CHAR 2 c_rangeno LIKE inri-nrrangenr VALUE '1'. CALL FUNCTION 'NUMBER_RANGE_ENQUEUE' . END-OF-SELECTION. " INRI : Number ranges function module interface structure CONSTANTS : " Name of number range object . WRITE gv_nodeid.

IF sy-subrc <> 0. le_nextnum = lv_nextnum. " NEXTNUM . IF sy-subrc NE 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. IF sy-subrc <> 0. * message e086 with 'Lock error' sy-subrc. CALL FUNCTION 'NUMBER_RANGE_DEQUEUE' EXPORTING object = le_rangeobj.EXPORTING object = le_rangeobj EXCEPTIONS foreign_lock = 1 object_not_found = 2 system_failure = 3 OTHERS = 4. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDFORM. ENDIF. CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING nr_range_nr = le_rangeno object = le_rangeobj * QUANTITY = '1' * SUBOBJECT = ' ' * TOYEAR = '0000' * IGNORE_BUFFER = ' ' IMPORTING number = lv_nextnum " Number generated by Range Generator Object * QUANTITY = * RETURNCODE = lv_returncode 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. ENDIF. ENDIF.

Number Range Object Creation. India. Creating Number Range Step by Step The following steps are necessary to create a Number Range.How to Create you own Number Range ? (SNRO) Number Range . needs auto generated number for reference. Assigning Number for the Number range Object Implementation of Number range Object. The custom define Number Range Object can be create in the Transaction Code SNRO and the object has to be called in program with the help of a Function Module NUMBER_GET_NEXT.SNRO In an Invoice creation number range is the one which refer to unique invoice. Enteg Infotech. Assigning Sub-object for Number Range Object. Bangalore. Scenario In an Organization for the custom defines applications like invoice generation. 1. 7. Log to Transaction Code SNRO. 2) Number Range Object Creation . 2. 4. Assigning Domain and the Sub-object for Number Range Object.SNRO by P surjith kumar. reimbursement or Expense payment. 1) Log to Transaction Code SNRO Give a name for the Number Range Object. Execution and viewing the newly generated Number Range. 3. The creation and the implementation of Number Range Object based on the Employee's Company code and the current Year is explained in this article. 6. This is vital to identify the specific invoice. Number Range Object . etc. which is done through a Number Range object. 5.

Once the name given for the Number Range Object. 3) Assigning Domain and the Sub-object for Number Range Object Once the create icon is clicked the below mentioned screen will appear. click the create icon to create the number range Object as shown below. Number length domain and Warning % as mention below. Then the value has to enter in Subobject data element. .

Then Same Screen Explained in Detail below. b) Interval Characteristics . a) Short and Long Description a short and long description for the Number Range.

Buffering is therefore not possible for applications. . Benefits: The number interval buffer is in the Shared Memory of the application server. The status of the number interval in the database is increased by the number of numbers fetched to the buffer. Enter the data type "NUM10" or as per the requirement. And it Dependencies is this transaction code is automatically entered in the transaction code table. If the numbers of an internal number interval are used up. Dependencies: When buffering number intervals.Subobject data element: This determines whether the number range intervals distinguish subobjects. whether the number range intervals are distinguished according to the financial year. Main memory buffering: Selecting the flag determines whether the number intervals are buffered for assignments and checks. gaps may result in number assignment. numbers are taken from the database via the number range server. once the percentage is reached it will show a warning. like Company code Personnel area and other field can be entered as per the requirement. c) Customizing Specifications Number range transaction: Transaction code to call number range maintenance is assigned. which require continuous number assignment. Enter the warning Percentage (%) "10". No interval rolling: If the check box is select the flag will set and it prevents the number range object intervals from automatically starting from the beginning at the upper limit. To-year flag: If the check box is selected this Flag will set and it determining. Warning %: This indicates the Percentage of numbers remaining in a number range. If the requirement is "15" or "5" assign the given value here. For Examples if you have defined an interval from 1 to 100 and you want to issue a warning at the number 90. Each buffer is used to store the external number intervals and a certain number (subinterval) of the internal number intervals. Number length domain: Assign the (Domain) Data type and length for the Number range. Enter the Company code data element "BUKRS" for the subject. you have to enter 10 (%) here.

no. Here. Subobject field in group table: It is Number range table subobject field name. .range no. For Example For the material master. During assignment and checking of number range numbers. the number range group elements determine the number range interval via the number range number.No. the element field is the material type field./ext. Number range group elements are assigned in the group table. Benefits: Number range intervals are identified uniquely by a number range number. which contains the internal number range number. When numbers are assigned or checked. After saving. Display element text: Mention the Short text for number range object maximum 20 characters. Fld. Domain (Length & Data type) and warning % is entered save the changes. NoRangeNo: Field name of the group table. the number range group elements determine the number range interval via the number range number. d) Group Specification Group table: Name of the table for number range groups. the material type determines the number range interval. Then the same screen will appear as shown below. Fld NoRangeElement: It is Name of the number range element field. a message window will appear as below and Click yes. the Field name of the group table containing the subobject if the group table takes subobjects into account.: Name of the number range field (in the group table). which contains the number range number. of numbers in buffer: This number which you assign determines how many numbers are reserved in the application server buffer for the intervals. Fields int.Once the SubObject name.

. Then a new screen will appear as shown below.4) Assigning Sub-object for Number Range Object.

5) Assigning Number for the Number range Object Then a new screen will appear as below. .Enter the Company "IN01" and Click the Intervals.



.Once the numbers assigned then Press Enter. And the below screen will appear.

.Then save it a message widow will appear as mentioned below.

Then click the Tick Mark. .

6) Implementation of Number range Object.SE38 . If any changes need to made Then the Number range Object is called inside the Program or function module or Inside the method of Webdynpro Component. etc. a) Go to Transaction Code .Then the number range object can be used your application. Number range with Sub-Object and Year Dependency used in the program is explained below.

.Enter the Title of the Program.

Save and write the below Program to get the Number range .

Bangalore * Version : 1.0 * Purpose : Number Range for Invoice Generation *&---------------------------------------------------------------------* REPORT YSURJITH_NORANGE.b) Call the Number Range Object in the Program using the Function Module "NUMBER_GET_NEXT". *&---------------------------------------------------------------------* *& Report YSURJITH_NORANGE *&---------------------------------------------------------------------* * Created by: P SURJITH KUMAR. DATA: . Enteg Infotech.

Variable to hold the Return Code "--. lv_year TYPE inri-toyear. lv_number_range.Assign Current Year lv_subobject = 'IN01'. then execute it. Everything is working fine 2) lv_rc = '1'. Return Code (lv_rc) 1) lv_rc = ' ' . This was the last number.This hold the Newly generated Number "---.Assign the Company Code CALL FUNCTION 'NUMBER_GET_NEXT' EXPORTING nr_range_nr object subobject toyear IMPORTING number returncode EXCEPTIONS interval_not_found object_not_found quantity_is_0 quantity_is_not_1 interval_overflow buffer_overflow OTHERS IF sy-subrc <> 0. 3) lv_rc = '2'.lv_number_range(10) TYPE n. lv_rc. "--. *&--. next time the first number will be assigned =1 =3 =4 =5 =6 =7 = 8. "-. The assigned number lies in the critical area. ENDIF. .Variable to hold Newly generated Number Range "-. number_range_not_intern = 2 = lv_number_range "-.Variable to hold Year "-. / 'The Return Code is :'(002).End of Report YSURJITH_NORANGE -----&* Then Save and Activate the Program.Variable to hold Company Code "-.Newly generated Number = lv_rc "-.Pass the Year 7) Execution and viewing the newly generated Number Then Execute and get the output as below. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.Pass the Company code "-. lv_rc TYPE inri-returncode.The Return Code Number = '01' = 'YINVNUM' = lv_subobject = lv_year "-.Passing the Number Range Object "-. lv_subobject TYPE t001-bukrs. lv_year = '2008'. WRITE : / 'The New Number is :'(001).

.The same Program you can assign in your application as per your Requirement.

Sign up to vote on this title
UsefulNot useful