• 程序中取得流水号


    程序中取得流水号

    REPORT ZLC_NUMBER_RANGE.

    DATA W_MATNR TYPE MATNR.

    START-OF-SELECTION.

    CALLFUNCTION 'NUMBER_RANGE_ENQUEUE'
    EXPORTING
    OBJECT ='ZLC_001' "Ceate with SNUM or SNRO
    EXCEPTIONS
    FOREIGN_LOCK =1
    OBJECT_NOT_FOUND= 2
    SYSTEM_FAILURE =3
    OTHERS =4.

    CALLFUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
    NR_RANGE_NR ='00'
    OBJECT ='ZLC_001'                "该对象可以在T-Code:SNRO创建或者选中系统自带的对象   
    IMPORTING
    NUMBER =W_MATNR
    EXCEPTIONS
    INTERVAL_NOT_FOUND =1
    NUMBER_RANGE_NOT_INTERN = 2
    OBJECT_NOT_FOUND =3
    QUANTITY_IS_0 =4
    QUANTITY_IS_NOT_1 =5
    INTERNAL_OVERFLOW =6
    OTHERS =7.

    CALLFUNCTION 'NUMBER_RANGE_DEQUEUE'
    EXPORTING
    OBJECT= 'ZLC_001'.

    IFSY-SUBRC <> 0.
    MESSAGEID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITHSY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


    Tcode:SNUM定义对象,添加号码范围,使用 NUMBER_GET_NEXT获取号码。有时候会出现跳号现象,2个方法解决。
    1.SNUM定义对象时,把缓存数设置为0.这个也可以用在SNRO里进行设置。一般这样就可以解决问题。如果还存在这种现象:
    2. call function 'NUMBER_GET_NEXT'
    exporting
    nr_range_nr = '01'
    object = 'ZTEST_NUM'
    ignore_buffer = 'X'
    importing
    number = Num
    把FUNCTION里的ignore_buffer = 'X'设置为X即可解决


    if sy-subrc = 0.
    concatenate sy-datum+4(4) Num into Num.
    select single * from t100 into corresponding fields of t100 where sprsl = 'M'
    and arbgb = sy-msgid and msgnr = sy-msgno.
    if sy-subrc = 0.
    move t100-text to text.
    replace '&' with sy-msgv1 into text. condense text.
    replace '&' with sy-msgv2 into text. condense text.
    replace '&' with sy-msgv3 into text. condense text.
    endif.
    endif.
    write:/'Number is:'.write: Num.
    write:/'text is:'.write: text.

    对号码对象间隔的数值状态初始化函数:NUMBER_RANGE_INTERVAL_INIT

      CALL FUNCTION 'NUMBER_RANGE_INTERVAL_INIT'
        EXPORTING
          OBJECT                  =

    *     SUBOBJECT               = ' '
    *   EXCEPTIONS
    *     NO_INTERVAL_FOUND       = 1
    *     OBJECT_NOT_FOUND        = 2
    *     OTHERS                  = 3

  • 相关阅读:
    Ubuntu速配指南之热门设置
    最高境地的Linux桌面
    菜鸟在Linux零碎中安置Oracle 11G
    Ubuntu 7.10疾速设置指南
    excel的单元格怎么实现下拉菜单?
    Delphi 与 DirectX 之 DelphiX(16): DXImageList1.Items.Find();
    Delphi 与 DirectX 之 DelphiX(19): 绘图表面(TDirectDrawSurface)如何加载图片
    Delphi 与 DirectX 之 DelphiX(18): TDXDraw 中描绘图片的命令
    Delphi 与 DirectX 之 DelphiX(17): TPictureCollectionItem.PatternWidth、PatternHeight
    Delphi 与 DirectX 之 DelphiX(23): TDirectDrawSurface.Blur;
  • 原文地址:https://www.cnblogs.com/seven1314pp/p/5993673.html
Copyright © 2020-2023  润新知