首页 > 代码库 > SAP号码段

SAP号码段

【转http://blog.csdn.net/wengyupeng/article/details/8513527】


1.通用Tcode:SNRO

 

常用维护特定Number range Tcode:

5NZINumber range maintenance: RP_IRCERT
 Number range maintenance: RP_IRCERT
ABNVNumber range maint: FIAA-BELNR
 Number range maint: FIAA-BELNR
AO11Assign number range
 分配编号范围
AS08Number Ranges:Asset Number
 号码范围:资产号码
BDCPNumber range maintenance: ALE_CP
 编号范围维护: ALE_CP
BG00Number Range Maintenance: BGMK_NR
 编码范围维护:BGMK_NR
BMVNNumber Range Maintenance: DI_JOBID
 编号范围维护: DI_JOBID
BUCFBP Cust: Number Ranges
 BP 消费者: 编号范围
CFNAMaintain PRT number range: FHM_CRFH
 维护PRT编号范围: FHM_CRFH
CMTCUS22Maintain number range for CM product
 维护 CM 产品的号码范围
CMTCUS32Maintain number range for CM folder
 维护 CM 文件夹的号码范围
CMTCUS42Maintain number ranges for Baseline
 维护起点的号码范围
FBN1Accounting Document Number Ranges
 科目凭证号码范围
FNS1Collateral number range
 附属编号区间
FOV0Rental agreement number range
 租用协议编号范围
FOW0Real Estate application number range
 不动产应用的数据范围
IN20Object link number ranges
 对象连接号码范围
IP22Maintain number range: OBJK_NR
 维护编号范围:OBJK_NR
KEN2Maint. number ranges: CO-PA planning
 维护号吗范围: CO-PA计划
OGS9Generate ADP number ranges
 生成 ADP 编号范围
OHX3Maintain number ranges for 3PR
 维护 3PR 的编号范围
OIL5Equipment number ranges
 设备编号范围
OIONOrder number ranges
 订单编号范围
OMH6Number Ranges for Purch. Documents
 采购凭证的号码范围
QCCNQM standard number ranges
 质量管理标准码范围
QS29Maintain characteristic number range
 维护特性编号范围
QS39Maintain method number range
 编号范围维护方式
VB(1Rebate number ranges
 回扣号范围
VN07Maintain number range for shipments
 维护装运的编号范围
WC64Catalog code number ranges
 类别代码编号范围
WTNRw/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.不勾的话,编号用完从头开始

 

 

 

 

 

图2

  间隔:维护编号范围

  状态:也就是当前编号

 

图3

 

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

 

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.  

SAP号码段