1.通用Tcode:SNRO

 

常用维护特定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
 

2.配置

 
 

图1.

   位置1.这里对应第二张图(图2)上的 Company code 。 不写的话,图2就没有Company code

   位置2.编号范围的长度

   位置3.编号剩余10% 警告

   位置4.勾上的话,图2 会自动出现一个year列。 每一个新年,从新开始编号

   位置5.不勾的话,编号用完从头开始

SAP号码段_数据

 

 

 

 

 

图2

  间隔:维护编号范围

  状态:也就是当前编号

SAP号码段_质量管理_02

 

图3

 

编号范围状态:就是当前编号

SAP号码段_数据_03

 

3.代码

 

REPORT ZTEST_WENG1.
data lv_id  type num10.

start-OF-SELECTION.
  perform get_next_id.




FORM get_next_id .
  DATA:  last_id  type BUKRS,
         quant   LIKE inri-quantity,   "dummy
         code    LIKE inri-returncode. "returncode

“NOCO  是对象名
  CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
    EXPORTING
      object           = 'NOCO'
    EXCEPTIONS
      foreign_lock     = 1
      object_not_found = 2
      system_failure   = 3
      OTHERS           = 4.
  IF sy-subrc = 0.
    do 100 times.
      CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          nr_range_nr             = '01'
          object                  = 'NOCO'
          SUBOBJECT               = '0000000001'
        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.
      LV_ID  =  last_id.
      write  LV_ID.
    enddo.
    CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'
      EXPORTING
        object           = 'NOCO'
      EXCEPTIONS
        object_not_found = 1
        OTHERS           = 2.
  ENDIF.
ENDFORM.  

 

 

 

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