Sunteți pe pagina 1din 7

SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa...

Page 1 of 7

Kodyaz Development Resources


Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Vista, etc.

SAP Resources
SAP Tutorial for ABAP Developers -
SAP Tutorial
Create Number Range Object using SAP Forums
SAP Transaction Code SNRO SAP Tools
Microsoft .NET and SAP
Juergen Daiberl, S...
SAP Transaction Codes Table
ABAP developers and SA professionals require an auto number field especially in the key fields of a
database table during ABAP coding in their SAP applications.
Actually an auto incrementa field is a general requirement for al developers in all development
environments and platforms
Privacy Information In SAP environment the solution is creating to create number range object and use number range
object in ABAP codes for ABAP developers
Actually, database providers like Microsoft SQL Server and Oracle have more advanced solutions for
such requirements that does not require maintanence and so much steps in number range creation
process.

Let's start our task in this SAP tutorial, number range creation using SNRO SAP Transaction code.

SAP MM-Functionality
and Technical C...
Step by step Number Range Creation using SNRO SAP Transaction Martin Murray

In SAP Easy Access screen, call SAP transaction code SNRO

Privacy Information

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

Implementing SAP ERP


Sales & Distrib...
Glynn C. Williams

Privacy Information

Enter Short Text and Long Text descriptive texts for Number Range Object.

Enter a number length domain for the number range object

Effective SAP SD
If you want a warning define an integer smaller than 100 in the Warning % field.
D. Rajen Iyer
You can enter 5 or 10 as common warning percentage values.

Privacy Information

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 2 of 7

Click on the Save button to save the number range definition.

Click on Yes button to continue.


The next screen displayed is Create Object Directory Entry screen.

I select Local Object

Now the Change documents and Number ranges buttons are displayed in the Number Range
Object : Change SAP screen.

Click on "Number ranges" button.

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 3 of 7

Click on Change Intervals buttons.

Click on "Add Interval" button

Enter an integer number like 1 at interval number and a range of numbers with integer values
identifying from number and to number. If you have entered required fields press Enter button.

Click on "Save" button. And the number range interval you have just declared will be listed in the
Number Range object 's number intervals list.

The following "Transport number range intervals" warning screen is displayed.

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 4 of 7

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.

Please note the information that you get when transporting number range intervals.

Here is the display screen of the Number Range object.

60+ Silverlight Samples


with full source code Try the award winning Silverlight 4 control suite
www.componentone.com/freetrial

SAP professionals and ABAP developers have seen how to create Number Range Object till this point
in this SAP tutorial.
Now ABAP developers are readyto go further and learn how to use number range objects in ABAP
code.
Key ABAP function for implementing and using a number range in ABAP codes is
NUMBER_GET_NEXT ABAP function.
In order to use a number range for auto increment column numbers safely in SAP,
NUMBER_GET_NEXT ABAP function is used with NUMBER_RANGE_ENQUEUE and
NUMBER_RANGE_DEQUEUE.

ABAP developers can copy and paste the following ABAP report source code and execute the ABAP
program in their development and test environments.
The sample ABAP report reads the next number in an SAP Number Range Object and displays the
auto number value on the screen.
The ABAP NUMBER_RANGE_ENQUEUE function sets a lock on the number range object.
If the lock is successfully set on the SAP number range, using NUMBER_GET_NEXT function call

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 5 of 7

the next number in the number range interval is read and passed into an ABAP variable.
The last step is calling NUMBER_RANGE_DEQUEUE function and removing the loc on the relate
SAP number range object.

REPORT ztreenodes .

" INRI : Number ranges function module interface structure


CONSTANTS :
" Name of number range object - CHAR 10
c_rangeobj LIKE inri-object VALUE 'Z_TREENODE',
" Number range number - CHAR 2
c_rangeno LIKE inri-nrrangenr VALUE '1'.

DATA : " NodeId from Number Generator Object


gv_nodeid TYPE i.

START-OF-SELECTION.

PERFORM nextnum USING gv_nodeid c_rangeobj c_rangeno.


WRITE gv_nodeid.

END-OF-SELECTION.

FORM nextnum USING

le_nextnum TYPE i
le_rangeobj LIKE inri-object
le_rangeno LIKE inri-nrrangenr.

DATA :
lv_nextnum TYPE i.

CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'


EXPORTING
object = le_rangeobj
EXCEPTIONS
foreign_lock = 1
object_not_found = 2
system_failure = 3
OTHERS = 4.
IF sy-subrc NE 0.
* message e086 with 'Lock error' sy-subrc.
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.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'


EXPORTING
object = le_rangeobj.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

le_nextnum = lv_nextnum.

ENDFORM. " NEXTNUM

I hope ABAP developers will fing this number range and NUMBER_GET_NEXT function call
implementation useful.

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 6 of 7

Variantenkonfiguration www.top-flow.de

Ein einzigartiges Produkt auf Basis der SAP Varianten


Konfiguration

SAP Integration www.JunotSystems.com

Integrate your plant floor to SAP fast, and without


programming.

Related SAP Tutorial and ABAP Tutorials

SAPScript Transaction Codes


Superfluous Statements - You can hide the message using "#EC NOBREAK
DEVELOPER_KEY_CHECK Function Module
How to Keep Table Rows in Same Page using SAP Smartform Page Protection
ABAP Tutorial - ABAP String Split Example Code
SAP Tables TVLKT - Delivery Types Texts Table for ABAP
Zero Padding - How to Add Leading Zeros in ABAP
SAP Smartform Current Page Number using SFSY-PAGE and Page Numbering using Page Counter
ABAP READ_TEXT Function Module Error : Text xxxxx ID ZZZZ language EN not found
How to use Where-Used List in ABAP Editor
How to Display BOM Bill of Material of a SAP Product
SAP Tables TVPRT - Commission Group Texts Table for ABAP
No function module has been generated yet
How to Display SAP Spool Requests using SP02 Transaction Code
How to Get Invoice Currency Text in SAP Smartforms Documents
How to Use Form Routines in SAP Smartforms Documents
How to Delete from Internal Table using ABAP
SAP Selection-Screen Parameters - Add Parameter Text or Label
SAP Notes - How to Read OSS Note
Find Accounting Document Number From Invoice Number in Smartforms
SAP Currency Table for Currency Text in ABAP Development
ABAP Transport Error : Object CUAD ReportName is Inactive
Enable SAP Users Create Own Layout Variants using set_table_for_first_display
ABAP bapi_salesorder_change to Delete Sales Order in SAP
How to Copy SAP Variants of ABAP Reports Using RS_COPY_SELECTION_SETS Function Module
Display SAP Logical Database using SE36 or ABAP Report at Attributes Screen
SAP T682 Conditions: Access Sequences Table
Sales Tables among ABAP Tables (SAP Sales and Distribution SD Tables)
ABAP Function Module rv_invoice_document_read to Read SAP Invoice Data Details
Read SAP Customer Data from KNA1 using kna1_single_reader ABAP Function Module
How to Upload Data to SAP from Excel File using alsm_excel_to_internal_table Function Module
ALV Grid Color - Table Row Background Color in ALV List
Display SAP Documentation using bmenu_show_documentation ABAP Function Module
Multi Color ALV Grid Color Alternate using ALV Layout info_fname Property
How to Debug SmartForms - Debugging SAP SmartForm in ABAP ?
How to Display SAP Transaction in a New Session Or in New Window using ABAP4_Call_Transaction Function Module
How to Open SAP Transaction in New Window Or in New Session using ABAP cc_call_transaction_new_task Function Module
ABAP Tutorial - How to Set Default Date Range in SAP Selection Screen for Date Parameter
ABAP Tutorial - Upload SAP Data to Excel using xxl_simple_api Function Module
How to Download, Upload and Share SAP Favorites Menu
How Find SAP SmartForms Function Module Name
How to Open PopUp_To_Confirm Screen When Delete Function Key is Pressed for Confirmation
SAP Email Send using ABAP efg_gen_send_email Function Call
SAP SmartForms Download as SmartForm PDF Format using WS_DOWNLOAD and cl_gui_frontend_services
SAP Symbols List - Display List of Symbols using ABAP Symbols Report
Display SAP Icons using ABAP Code - SAP Icon List
How to Configure Default ABAP Editor to ABAP WorkBench Front End Editor New
ABAP - Create Hierarchy Tree List using rs_tree_construct, rs_tree_list_display and snodetext
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transaction Code SNRO
Create CL_GUI_ALV_GRID ALV Grid Column Header using ABAP Data Element
How to Create SAP Transaction Code using SAP SE93 Transaction
SAP Tutorial - Create Transaction Code for ABAP Module Pools
How to Upload Bitmap Image to SAP using SAP Transaction SE78
SAP Custom Splitter Container cl_gui_splitter_container ABAP Example Code
Message no. 00264 : Status STATUS of the user interface ZREPORT missing
Request Single Spool Record for SmartForms Call within an ABAP Loop using output_options tdnewid
ABAP Tutorial - SAP Split and ABAP Split String Function
Upload Data from Excel File in ABAP using TEXT_CONVERT_XLS_TO_SAP
Display SAP Product Hierarchy using Table T179T VTEXT Field on cl_gui_alv_tree ABAP ALV Tree Object
SAP Product Hierarchy - Example ABAP Program using rv_produkthierarchie_text_get Function
SAP Sales Division SPART Text Description for Different Languages in TSPAT Table
SAP Sales Distribution Channel VTWEG Text Description for Different Languages in TVTWT Table
SAP Sales Organization VKORG Text Description for Different Languages in TVKOT Table
SAP Tutorial - Convert Spool Request to PDF File using RSTXPDFT4 ABAP Report
ABAP Tutorial - How to Generate Random Number for a Given Range of Numbers using RANDOM_I2 Function Module
ABAP Tutorial - How to Generate Random Number for a Given Range of Numbers using QF05_RANDOM_INTEGER
SAP ABAP Tutorial - ALV Grid Example with cl_gui_alv_grid and Screen Painter
How to Create Favorites and Add SAP Transaction Code in SAP Favorites Menu Folder
How to Display Keys in All Dropdown Lists on SAP Screens
SAP EXAM - ABAP EXAM : Free Online Certification SAP Questions and Answers to Tests

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010
SAP Tutorial for ABAP Developers - Create Number Range Object using SAP Transa... Page 7 of 7

How to Delete All Breakpoints within ABAP Code using SAP ABAP Editor (SE80)
SAP Tutorial - How to Translate Text Module in Smartforms (Translation for Smartforms)
SAP Transaction - Create Transaction Code for ABAP Program or Selection Screen
SAP Smartforms Tutorial - Create Smartforms Example
SAP Smartforms - How to Call Smartform within ABAP Program
Smartforms Program Lines Error - Field "TITLE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
Smartforms System Field &SFSY-JOBPAGES& - Total Number of Pages on a SmartForm document
What is OSS - Online SAP Support Notes ?
Sales Tables among SAP ABAP Tables (Sales and Distribution SD Tables)
ABAP ACE_SOP_CLIENT_READ Function Call to Read System Clients Table t000
Free MaxDB Training on MaxDB Database and Administration from SAP
SAP Download MaxDB Database Software
SAP - ABAP Checkbox in Selection Screen Example
SAP - ABAP Radio Button Selection Screen Example
SAP - ABAP ALV Grid Sample Code using REUSE_ALV_GRID_DISPLAY
ABAP Code to Display SAP Table Contents
How to Remove Preceeding Zeros in ABAP Development
Valid ABAP TRTYP SAP Transaction Type List
How to Find the SAP Transaction Code of the Current Screen Displayed ?
How to Find the Menu Path of a SAP Tansaction Code using SEARCH_SAP_MENU
SAP Smart Forms Tutorial and Smart Forms Resources
SAP Training Cource BC470 Form Printing with SAP Smart Forms
SAP MiniWAS Web Application Server 6.20 and SAP DB Installation for Windows and Troubleshooting
Download SAP GUI for Windows 7.10 and 6.20 from SMP
Introduction to SAP ABAP Programming
Complete List of SAP Modules
SAP Module Abbreviations
Complete List of SAP Sales and Distribution Module (SD) Sub-Modules
List of SAP Standard Material Types
Message Types in Method Return Parameters for SAP Modules
Built-in ABAP Type List or Predefined ABAP Types for SAP Systems

Copyright © 2004 - 2010 Eralper Yilmaz. All rights reserved.

http://www.kodyaz.com/articles/create-number-range-in-abap-using-sap-snro-transact... 09.12.2010

S-ar putea să vă placă și