通过物料+批次号码+工厂 查询批次特性值

TCODE:MSC1/2/3N ,CT04 涉及到的表:mcha  cabn  ausp等 注:1.每一种批次的特性都对应一个特性代码,在CT04可查看     2. 主要用到了BAPI_OBJCL_GETDETAIL这个BAPI,调用很简单,有个注意点:物料是数字的要补全0。   1. 用MM03查看物料分类特性


2. SE37执行BAPI_OBJCL_GETDETAIL

3.取表ALLOCVALUESCHAR,得到我们要的分类



查看物料批次特性值 难点要找到特性值的OBJECT:通过调用FUNCTION'VB_BATCH_2_CLASS_OBJECT 得到 查看具体的特性值 FUNCTION 'BAPI_OBJCL_GETDETAIL

例子:     data p_charg type charg_d.   data p_charact type char30.   data e_objek type objnum.   data e_obtab type tabelle.   data e_klart type klassenart.   data e_class type klasse_d.   data begin of it_num occurs 0.           include structure bapi1003_alloc_values_num.   data end of it_num.   data begin of it_char occurs 0.           include structure  bapi1003_alloc_values_char.   data end of it_char.   data begin of it_curr occurs 0.           include structure  bapi1003_alloc_values_curr.   data end of it_curr.   data begin of bapi_return occurs 0.           include structure bapiret2.   data end of bapi_return.

  data value_char type char30.   data:lv_chand(50) type c.   data:lv_dengj(50) type c. ************  批次end   *********************  取批次特性值     CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'       EXPORTING         i_matnr = lw_billdata-matnr         i_charg = lw_billdata-charg         i_werks = lw_billdata-werks       IMPORTING         e_objek = e_objek         e_obtab = e_obtab         e_klart = e_klart         e_class = e_class.     IF sy-subrc = 0.       CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'         EXPORTING           objectkey       = e_objek           objecttable     = e_obtab           classnum        = e_class           classtype       = e_klart         TABLES           allocvaluesnum  = it_num           allocvalueschar = it_char   “字符类           allocvaluescurr = it_curr           return          = bapi_return.       IF sy-subrc = 0.         READ TABLE bapi_return WITH KEY type = 'S'.         IF sy-subrc = 0.           LOOP AT it_char.             CASE it_char-charact.               WHEN 'HF000501'.  "产地                 lv_chand =  it_char-value_neutral .               WHEN 'PJDJ0000'.  "品检等级                 lv_dengj =  it_char-value_neutral .             ENDCASE.             CLEAR:lv_chand,lv_dengj.           ENDLOOP.         ENDIF.       ENDIF.

    ENDIF. *********************  取批次特性值END




欢迎关注订阅号:SAP学习记录 (SAPlearning )

PO <wbr><wbr>text <wbr><wbr>copy <wbr><wbr>rules <wbr><wbr>:copy <wbr><wbr>PR <wbr><wbr>item <wbr><wbr>text <wbr><wbr>to <wbr><wbr>PO