How to Create you own Number Range SNRO




First you have to create a Number Range:

Transaction Code SNRO

Number Range Object Creation

  Give a name for the Number Range Object and click on Create button.
 Assigning Domain and the Sub-object for Number Range Object
 Assigning Sub-object for Number Range Object.
Click on NUMBER RANGES button to assign the Sub-object.
Then a new screen will appear as shown below.
Enter the Company “IN01” and Click the Intervals.                  
Assigning Number for the Number range Object.
Then a new screen will appear as below.
Click on the interval button 

And a new screen will appear.

Entering the starting (Form) Number and Ending (To) Number and press Enter and after press Save.
 a message widow will appear as mentioned below. 
Then click the Tick Mark.  

Implementation of Number range Object.  
 Transaction Code – SE38
Will appear the following screen
Enter the NAME of the Program and click CREATE.
Enter the title of the program and click on SAVE button.
Save and write (copy-paste) the below Program to get the Number range

*&---------------------------------------------------------------------*
*& Report  YSURJITH_NORANGE
*&---------------------------------------------------------------------*
* Created by: P SURJITH KUMAR, Enteg Infotech, Bangalore
* Version   :  1.0
* Purpose   : Number Range for Invoice Generation
*&---------------------------------------------------------------------*
REPORT  YSURJITH_NORANGE.
DATA:
LV_NUMBER_RANGE(10) TYPE N,    "-- Variable to hold Newly generated Number Range
LV_YEAR TYPE INRI-TOYEAR,              "-- Variable to hold Year
LV_SUBOBJECT TYPE  T001-BUKRS,     "-- Variable to hold Company Code
LV_RC TYPE INRI-RETURNCODE.            "-- Variable to hold the Return Code
LV_YEAR = '2008'.         "--- Assign Current Year
LV_SUBOBJECT = 'IN01'.  "--- Assign the Company Code
CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    NR_RANGE_NR             = '01'                "-- This hold the Newly generated Number
    OBJECT                  = 'YINVNUM'       "---- Passing the Number Range Object
    SUBOBJECT               = LV_SUBOBJECT    "-- Pass the Company code
    TOYEAR                  = LV_YEAR            "-- Pass the Year
  IMPORTING
    NUMBER                  = LV_NUMBER_RANGE "-- Newly generated Number
    RETURNCODE              = LV_RC                   "-- The Return Code Number
  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.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE : / 'The New Number is  :'(001), LV_NUMBER_RANGE,
       'The Return Code is :'(002), LV_RC.
Save the program
Click on execute button(direct processing) :
And will appear this screen.
I have no copyright on any text or picture from this document only for Screenshots. This document was made for  learn easier information about HCM, HR, SAP.

Leave a comment