SAP技术干货SAP收藏文章

后台获取-MSC3N物料批次属性

2018-11-13  本文已影响1人  Mmm_余安

1.找到要获取的物料类型 Tcode:MM03


分类 物料会有一个分类

常规值带出来的特征描述就是根据分类带出来的

2.查看分类获取特征描述的特性 Tcode:CL03

例图

我们模拟取色母号,附加字段特性值分别为:Z_GC_GRASS_CMB,Z_GC_GRASS_RESB1

3.后台获取

  DATA:
    LV_CUOBN      TYPE  CUOBN,
    LV_TABELLE    TYPE  TABELLE,
    LV_KLASSENART TYPE  KLASSENART,
    LV_KLASSE_D   TYPE  KLASSE_D,
    LT_NUM        TYPE TABLE OF BAPI1003_ALLOC_VALUES_NUM,
    LT_CHAR       TYPE TABLE OF BAPI1003_ALLOC_VALUES_CHAR,
    LW_CHAR       LIKE LINE OF LT_CHAR,
    LT_CURR       TYPE TABLE OF BAPI1003_ALLOC_VALUES_CURR,
    LT_RETURN4    TYPE TABLE OF BAPIRET2,
    LW_RETURN4    TYPE  BAPIRET2.

 CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
      EXPORTING
        I_MATNR       = GS_TAB-MATNR              " Material Number
        I_CHARG       = GS_TAB-CHARG              " Batch Number
        I_WERKS       = GS_TAB-MAWERK             " Plant
      IMPORTING
        E_OBJEK       = LV_CUOBN              " Key of Object to Be Classified
        E_OBTAB       = LV_TABELLE          " Name of Database Table for Object
        E_KLART       = LV_KLASSENART              " Class Type
        E_CLASS       = LV_KLASSE_D             " Class number
      EXCEPTIONS
        ERROR_MESSAGE = 1.

    IF LV_KLASSE_D IS NOT INITIAL.

      REFRESH:LT_NUM[],LT_CHAR[], LT_CURR[],  LT_RETURN4[].

      CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
        EXPORTING
*         objectkey       =
          OBJECTTABLE     = LV_TABELLE
          CLASSNUM        = LV_KLASSE_D
          CLASSTYPE       = LV_KLASSENART
*         keydate         = SY-DATUM
*         unvaluated_chars = space
*         language        = SY-LANGU
          OBJECTKEY_LONG  = LV_CUOBN
*  IMPORTING
*         status          =
*         standardclass   =
        TABLES
          ALLOCVALUESNUM  = LT_NUM
          ALLOCVALUESCHAR = LT_CHAR
          ALLOCVALUESCURR = LT_CURR
          RETURN          = LT_RETURN4
        EXCEPTIONS
          ERROR_MESSAGE   = 1.
  READ TABLE LT_CHAR INTO LW_CHAR WITH KEY CHARACT = 'Z_GC_GRASS_CMB'.
      IF SY-SUBRC = 0.
        GS_TAB-RESB1 = LW_CHAR-VALUE_CHAR.
      ENDIF.

      READ TABLE LT_CHAR INTO LW_CHAR WITH KEY CHARACT = 'Z_GC_GRASS_RESB1'.
      IF SY-SUBRC = 0.
       CONCATENATE GS_TAB-RESB1  LW_CHAR-VALUE_CHAR INTO GS_TAB-RESB1.
      ENDIF.
 ENDIF.

4.显示批次属性 Tcode:MSC3N

例图 色母号+附加字段

验证已完成

将批次属性给到物料,前台通过MIGO过账将批次特性给进去

上一篇下一篇

猜你喜欢

热点阅读