2. SE37执行BAPI_OBJCL_GETDETAIL
查看物料批次特性值
难点要找到特性值的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