Number Range.pdf

download Number Range.pdf

of 17

Transcript of Number Range.pdf

  • 7/30/2019 Number Range.pdf

    1/17

    Number Range - SNRO

    by P surjith kumar, Enteg Infotech, Bangalore, India.

    Number Range Object - SNRO

    In an Invoice creation number range is the one which refer to unique invoice. This is vital to identify the specific

    invoice. 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.

    Scenario

    In an Organization for the custom defines applications like invoice generation, reimbursement or Expense

    payment, etc. needs auto generated number for reference, which is done through a Number Range object. 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.

    Creating Number Range Step by Step

    The following steps are necessary to create a Number Range,

    1. Log to Transaction Code SNRO.

    2. Number Range Object Creation.

    3. Assigning Domain and the Sub-object for Number Range Object.

    4. Assigning Sub-object for Number Range Object.

    5. Assigning Number for the Number range Object

    6. Implementation of Number range Object.

    7. Execution and viewing the newly generated Number Range.

    1) Log to Transaction Code SNRO

    Give a name for the Number Range Object.

    2) Number Range Object Creation

    Once the name given for the Number Range Object,

    click the create icon to create the number range Object as shown below.

  • 7/30/2019 Number Range.pdf

    2/17

    3) Assigning Domain and the Sub-object for Number Range Object

    Once the create icon is clicked the below mentioned screen will appear.

    Then the value has to enter in Subobject data element, Number length domainand Warning %as

    mention below.

  • 7/30/2019 Number Range.pdf

    3/17

    Then Same Screen Explained in Detail below,

    a) Short and Long Description

    a short and long description for the Number Range.

  • 7/30/2019 Number Range.pdf

    4/17

    b) Interval Characteristics

    Subobject data element:This determines whether the number range intervals distinguish subobjects.

    Enter the Company code data element "BUKRS" for the subject, like Company code Personnel area and other

    field can be entered as per the requirement.

    To-year flag: If the check box is selected this Flag will set and it determining, whether the number range

    intervals are distinguished according to the financial year.

    Number length domain:Assign the (Domain) Data type and length for the Number range.

    Enter the data type "NUM10" or as per the requirement.

    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.

    c) Customizing Specifications

    Number range transaction: Transaction code to call number range maintenance is assigned. And it

    Dependencies is this transaction code is automatically entered in the transaction code table.

    Warning %: This indicates the Percentage of numbers remaining in a number range, once the percentage is

    reached it will show a warning. For Examples if you have defined an interval from 1 to 100 and you want to

    issue a warning at the number 90, you have to enter 10 (%) here.

    Enter the warning Percentage (%) "10". If the requirement is "15" or "5" assign the given value here.

    Main memory buffering: Selecting the flag determines whether the number intervals are buffered for

    assignments and checks.

    Benefits:

    The number interval buffer is in the Shared Memory of the application server. Each buffer is used to store the

    external number intervals and a certain number (subinterval) of the internal number intervals. If the numbers of

    an internal number interval are used up, numbers are taken from the database via the number range server.

    The status of the number interval in the database is increased by the number of numbers fetched to the buffer.

    Dependencies:

    When buffering number intervals, gaps may result in number assignment. Buffering is therefore not possible for

    applications, which require continuous number assignment.

  • 7/30/2019 Number Range.pdf

    5/17

    No. of numbers in buffer: This number which you assign determines how many numbers are reserved in the

    application server buffer for the intervals.

    d) Group Specification

    Group table: Name of the table for number range groups.

    Benefits: Number range intervals are identified uniquely by a number range number. When numbers are

    assigned or checked, the number range group elements determine the number range interval via the numberrange number. Number range group elements are assigned in the group table.

    Subobject field in group table: It is Number range table subobject field name, the Field name of the group

    table containing the subobject if the group table takes subobjects into account.

    Fld NoRangeElement: It is Name of the number range element field, During assignment and checking of

    number range numbers, the number range group elements determine the number range interval via the number

    range number. For Example For the material master, the material type determines the number range interval.

    Here, the element field is the material type field.

    Fields int./ext. no.range no.:Name of the number range field (in the group table), which contains the

    internal number range number.

    Fld. NoRangeNo:Field name of the group table, which contains the number range number.

    Display element text: Mention the Short text for number range object maximum 20 characters.Once the

    SubObject name, Domain (Length & Data type) and warning % is entered save the changes.

    After saving, a message window will appear as below and Click yes.

    Then the same screen will appear as shown below.

  • 7/30/2019 Number Range.pdf

    6/17

    4) Assigning Sub-object for Number Range Object.

    Then a new screen will appear as shown below.

  • 7/30/2019 Number Range.pdf

    7/17

    Enter the Company "IN01" and Click the Intervals.

    5) Assigning Number for the Number range Object

    Then a new screen will appear as below.

  • 7/30/2019 Number Range.pdf

    8/17

  • 7/30/2019 Number Range.pdf

    9/17

    Once the numbers assigned then Press Enter.

  • 7/30/2019 Number Range.pdf

    10/17

    And the below screen will appear.

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

  • 7/30/2019 Number Range.pdf

    11/17

    Then click the Tick Mark.

  • 7/30/2019 Number Range.pdf

    12/17

    Then the number range object can be used your application. 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.

    6) Implementation of Number range Object.

    Number range with Sub-Object and Year Dependency used in the program is explained below.

    a) Go to Transaction Code - SE38

  • 7/30/2019 Number Range.pdf

    13/17

    Enter the Title of the Program.

  • 7/30/2019 Number Range.pdf

    14/17

    Save and write the below Program to get the Number range

  • 7/30/2019 Number Range.pdf

    15/17

    b) Call the Number Range Object in the Program using the Function Module "NUMBER_GET_NEXT".

    *&---------------------------------------------------------------------*

    *& 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

  • 7/30/2019 Number Range.pdf

    16/17

    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 = 5interval_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.

    *&----&*

    Then Save and Activate the Program, then execute it.

    Return Code (lv_rc)

    1) lv_rc = ' ' , Everything is working fine

    2) lv_rc = '1', The assigned number lies in the critical area.

    3) lv_rc = '2', This was the last number, next time the first number will be assigned

    7) Execution and viewing the newly generated Number

    Then Execute and get the output as below,

  • 7/30/2019 Number Range.pdf

    17/17

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