ABAP如何创建和使用sap的号码范围对象

创建号码范围对象:

1.     使用TCODE:SNRO (Simple way to remember is SapNumberRangeObject).

2.      输入号码范围对象的名称 并点击“新建”按钮.

3.       输入描叙和相关字段具体参见下图:

Warning% à Assume that an interval is defined from 1 to 1000. If you want to issue a warning at the number 900, enter 10 (%) here.

4.       点击“SAVE”按纽.系统将弹出下列屏幕:

 

5.     点击“YES”按钮,并制定对象类.

6.      点击“Number Ranges” .

 

7.      点击 “Change Intervals”.

 

8.      点击 “Insert Interval”.

9.      输入相应的数据值,参见下屏:

 

10. 点击 “Insert”,再点击保存.号码范围对象就已经成功建立. 

测试the Number Range Object: 

We can use the function module, NUMBER_GET_NEXT, to get the next number of any number range object. 

Following is a test program to get the next available number of the object created above:  

REPORT zsnro_test.

DATA:
NUMBER TYPE I.

CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
   nr_range_nr = '01'
   object = 'ZDEMO'
IMPORTING  
  NUMBER = 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 :/ 'Next available number is: ', Number. 

<script type="text/javascript"><!-- google_ad_client = "pub-1086451200925480"; google_alternate_color = "0000FF"; google_ad_width = 336; google_ad_height = 280; google_ad_format = "336x280_as"; google_ad_type = "text"; //2007-04-05: 336 x 280 google_ad_channel = "5227776827"; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "000000"; google_color_text = "000000"; google_color_url = "008000"; //--> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>  相关文章:http://blog.csdn.net/CompassButton/archive/2006/10/16/1336751.aspx
Source URL:http://www.saptechnical.com/Tutorials/ABAP/SNRO/SNRO.htm
原文地址:https://www.cnblogs.com/xiaomaohai/p/6157172.html