创建号码范围对象 snro【转 汇总】

创建号码范围对象:

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

clip_image001

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

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

clip_image002

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”按纽.系统将弹出下列屏幕:

clip_image003

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

6. 点击“Number Ranges” .

clip_image004

7. 点击 “Change Intervals”.

clip_image005

clip_image006

8. 点击 “Insert Interval”.

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

clip_image007

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.

以上来自老吴空间

以下来自小白空间

1.Number Range的通用Tcode:SNRO

2.Number Range的通用读取函数:NUMBER_GET_NEXT

3.如有跳号现象,可以禁用对象的Buffer试试

4.几个关于Number Range的函数组:

SNR0  Online maint. of number ranges & groups
SNR1  Interface for number ranges and groups
SNR2  Maintenance of number range objects
SNR3  Number range checks, assignment & info.
SNR4  Number ranges utility

5.使用自定义的number range objects

1).Create number range object using OYSN (或者SNRO).

2).Then call the following function modules.

FORM get_next_id CHANGING p_discrep.
DATA: last_id LIKE zrecaudit-discrep,
        quant   LIKE inri-quantity,    "dummy
        code    LIKE inri-returncode. "returncode
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
       EXPORTING
            object           = 'ZRECAUDIT'
       EXCEPTIONS
            foreign_lock     = 1
            object_not_found = 2
            system_failure   = 3
            OTHERS           = 4.
IF sy-subrc = 0.
    CALL FUNCTION 'NUMBER_GET_NEXT'
         EXPORTING
              nr_range_nr             = '01'
              object                  = 'ZRECAUDIT'
         IMPORTING
              number                  = last_id
              quantity                = quant
              returncode              = code
         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.
    CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'
         EXPORTING
              object           = 'ZRECAUDIT'
         EXCEPTIONS
              object_not_found = 1
              OTHERS           = 2.
ENDIF.
ENDFORM.                    " get_next_id

6.常用维护特定Number Range的Tcode:

5NZI

Number range maintenance: RP_IRCERT

 

Number range maintenance: RP_IRCERT

ABNV

Number range maint: FIAA-BELNR

 

Number range maint: FIAA-BELNR

AO11

Assign number range

 

分配编号范围

AS08

Number Ranges:Asset Number

 

号码范围:资产号码

BDCP

Number range maintenance: ALE_CP

 

编号范围维护: ALE_CP

BG00

Number Range Maintenance: BGMK_NR

 

编码范围维护:BGMK_NR

BMVN

Number Range Maintenance: DI_JOBID

 

编号范围维护: DI_JOBID

BUCF

BP Cust: Number Ranges

 

BP 消费者: 编号范围

CFNA

Maintain PRT number range: FHM_CRFH

 

维护PRT编号范围: FHM_CRFH

CMTCUS22

Maintain number range for CM product

 

维护 CM 产品的号码范围

CMTCUS32

Maintain number range for CM folder

 

维护 CM 文件夹的号码范围

CMTCUS42

Maintain number ranges for Baseline

 

维护起点的号码范围

FBN1

Accounting Document Number Ranges

 

科目凭证号码范围

FNS1

Collateral number range

 

附属编号区间

FOV0

Rental agreement number range

 

租用协议编号范围

FOW0

Real Estate application number range

 

不动产应用的数据范围

IN20

Object link number ranges

 

对象连接号码范围

IP22

Maintain number range: OBJK_NR

 

维护编号范围:OBJK_NR

KEN2

Maint. number ranges: CO-PA planning

 

维护号吗范围: CO-PA计划

OGS9

Generate ADP number ranges

 

生成 ADP 编号范围

OHX3

Maintain number ranges for 3PR

 

维护 3PR 的编号范围

OIL5

Equipment number ranges

 

设备编号范围

OION

Order number ranges

 

订单编号范围

OMH6

Number Ranges for Purch. Documents

 

采购凭证的号码范围

QCCN

QM standard number ranges

 

质量管理标准码范围

QS29

Maintain characteristic number range

 

维护特性编号范围

QS39

Maintain method number range

 

编号范围维护方式

VB(1

Rebate number ranges

 

回扣号范围

VN07

Maintain number range for shipments

 

维护装运的编号范围

WC64

Catalog code number ranges

 

类别代码编号范围

WTNR

w/tax certificate number range

 

w/tax certificate number range

以下来自 :http://www.sapclub.org/blog/arron99/archive/2006/11/22/4463.html

在SAP系统中,号码范围用于给数据记录提供惟一标识.
1 号码范围对象分类

· 无子对象的号码范围对象

无分组
(1) one, two or several number ranges
有分组
(2) one number range, external or internal, per group
(3) two number ranges, external and internal, per group

· 有子对象的号码范围对象

无分组
(4) one, two or several number ranges

有不依赖子对象的分组
(5) one number range, external or internal, per group
(6) two number ranges, external and internal, per group

有依赖子对象的分组
(7) one number range, external or internal, per group
(8) two number ranges, external and internal, per group

二、如何使用号码范围
2.1 确定号码范围的类型并创建新的号码范围对象(SNRO)

· 需要多少个号码范围: 1, 2 或者更多?

· 号码范围是否需要子范围对象 (如:company code, plant, controlling area等等)?

· 号码范围是否需要分组 (如:物料类型)?

· 如果需要分组,那分组的是否需要子范围对象?

· 号码范围是否需要区分财务年度?

2.2 维护号码范围对象的间隔;
3.3 在程序中使用号码范围的函数进行记录编号或检查可用号码;

三、号码范围的函数简要说明
3.1 函数组(SNR0)

· NUMBER_RANGE_SHOW
This function module displays the groups which exist for a particular number range object, with their number range intervals.
After return, the return code chosen by the user (Back or Cancel) is available.

· NUMBER_RANGE_ELEMENTS_SHOW *
This function module displays all elements, which are assigned to a number range interval.
After return, the return code chosen by the user (Back or Cancel) is available. (only object types 4-8)
This function module enables you to copy number range objects from groups and intervals of an existing sub-object of a given number range object to another of its existing sub-objects.
After return, the return code chosen by the user (Back or Cancel) is available. (only object types 4-8)
This function module provides a dialog box in which the user can enter a sub-object for a given number range object. If the specified sub-object already exists for the number range object, it is returned in the export parameter. If it does not exist, either an exception is raised or the return code "A" for user abort is returned.

· NUMBER_RANGE_INTERVAL_MAINTAIN
With this function module the maintenance dialog for number range intervals for a given number range object is offered. A parameter specifies the processing type. Possible processing types are:

o Maintain intervals

o Change number status

o Display intervals

o Create new groups (only for object types 2 and 3 and 5-8)

The dialog path is determined by the object type.
After return, the return code chosen by the user (Back or Cancel) is available.

· NUMBER_RANGE_GROUP_MAINTAIN *
This function module is the maintenance dialog (Create, Change, Display) for number range groups for a given number range object. A processing flag determines whether the object is to be displayed only or whether it can be maintained. Groups are deleted by deleting their intervals.
After return, the return code chosen by the user (Back or Cancel) is available.

· NUMBER_RANGE_SUBOBJECT_COPY

· NUMBER_RANGE_SUBOBJECT_GET

3.2 函数组(SNR1)

· NUMBER_RANGE_ENQUEUE
With this function module, you lock the number range object which is to be maintained, and its groups and intervals, for access by other users. Lock errors are returned as exceptions.

· NUMBER_RANGE_DEQUEUE
With this function module, you unlock the number range object which has been maintained.

· NUMBER_RANGE_ELEMENT_LIST *
This function module gets the elements which are assigned to a particular number range interval for a number range object. The elements found are passed in a table. Errors are returned as exceptions.

· NUMBER_RANGE_ELEMENT_TEXT_LIST *
With this function module you can find element texts in the specified language for a given number range object. The texts are returned in a table. Execution errors are returned as exceptions.

· NUMBER_RANGE_GROUP_LIST *
This function module gets information about groups and the associated group and element texts for a specified number range object. The information is put in a table. The table can be used to change the element assignment or the group text. The change request is to be passed to the function module NUMBER_RANGE_GROUP_UPDATE.
Errors are returned as exceptions.

· NUMBER_RANGE_GROUP_UPDATE *
With this function module, already assigned elements can be assigned to other intervals, or the assignment can be withdrawn. Group texts can also be maintained. All change requests are checked. Request errors are returned in an error table.

The changes are passed in an internal table and are copied into the local memory of the function group.
Before you call this function module, you must lock the number range object in question with NUMBER_RANGE_ENQUEUE, and unlock it again with NUMBER_RANGE_DEQUEUE after writing the changes to the database.
To copy the contents of local memory to the database, call the function module NUMBER_RANGE_UPDATE_CLOSE.

· NUMBER_RANGE_INTERVAL_LIST
This function module gets the existing intervals to a given number range object, and puts them in a table. The table can be passed to the function module NUMBER_RANGE_INTERVAL_UPDATE to change intervals.

· NUMBER_RANGE_INTERVAL_UPDATE
With this function module you maintain intervals for a given number range object.
The changes are passed in an internal table, and are copied into local memory.
Before you call this function module, you must lock the number range object in question with NUMBER_RANGE_ENQUEUE, and unlock it again with NUMBER_RANGE_DEQUEUE, after the changes have been written to the database.
To copy the contents of local memory to the database, call the function module NUMBER_RANGE_UPDATE_CLOSE.

· NUMBER_RANGE_OBJECT_GET_INFO
This function module gets information for a given number range object. This information is put in a table structure, which must be declared like the table structure INROI.

· NUMBER_RANGE_SUBOBJECT_LIST (only object types 4-8)
This function module gets the existing sub-objects of a given number range object, and puts them in the table passed.

· NUMBER_RANGE_SUBOBJ_GET_INFO
This function module gets information about the existing sub-objects of a given number range object. This information is put in a table structure, which must be declared like the table structure INROI.

· NUMBER_RANGE_UPDATE_CLOSE
With this function module you write changes which have been made to local memory to the database, with NUMBER_RANGE_GROUP_UPDATE and NUMBER_RANGE_INTERVAL_UPDATE. After calling this function module, you should unlock the changed number range object.

· NUMBER_RANGE_UPDATE_INIT
With this function module, you can initialize local memory if you want to discard the changes which have not yet been copied to the database.

3.3 函数组(SNR2)

· NUMBER_RANGE_OBJECT_MAINTAIN
This function module provides all the screens needed to maintain a given number range object, with the possibility of branching to interval maintenance and change document display.
An export parameter states which action the user has performed with the number range object.

· NUMBER_RANGE_OBJECT_CLOSE
With this function module, you write all changes to a given number range object, which were put in local memory with NUMBER_RANGE_OBJECT_UPDATE, to the database. If intervals are affected by the changes, they are updated. Change documents are created for all changes. A flag states whether intervals have been updated.

· NUMBER_RANGE_OBJECT_DELETE
With this function module, you can delete either the whole definition of a given number range object, including texts, or only the texts. The deletion is performed directly in the database.
The function module provides no connection to the correction and transport system.

· NUMBER_RANGE_OBJECT_INIT
With this function module, you initialize local memory for a given number range object.
You only need this call when you offer number range object maintenance in a user transaction, in which you want to provide the possibility of canceling changes which have not been saved.

· NUMBER_RANGE_OBJECT_LIST
This function module gets a list of all number range objects with their texts and attributes. The information is put in a table.
The contents of local memory are not taken into account.

· NUMBER_RANGE_OBJECT_READ
This function module gets the texts and attributes of a given number range object. The records returned can be used for changes with the function modules NUMBER_RANGE_OBJECT_UPDATE and NUMBER_RANGE_OBJECT_DELETE.

· NUMBER_RANGE_OBJECT_UPDATE
This function module copies new number range objects or changes to existing number range objects into local memory, after error checks.
The function module does not provide a connection to the correction and transport system.

3.4 函数组(SNR3)

· NUMBER_CHECK
检查号码是否在号码区间内,一般是外部给号需要检查号码时,你的程序调用该函数.

· NUMBER_GET_INFO
读取一个号码范围数据的相关信息.

· NUMBER_GET_NEXT
分配下一个可用的空号

2.5 函数组(SNR4)

· NUMBER_RANGE_INTERVAL_INIT
对号码对象间隔的数值状态的初始化.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值