对于一些用过的函数开始记录一下,留作参考。
批次拆分:
DATA: lw_objek_l TYPE cuobn,
* lw_objek_s TYPE bapi1003_key-object,
lw_obtab TYPE tabelle,
lw_klart TYPE klassenart,
lw_class TYPE klasse_d,
lv_posnr TYPE lips-posnr.
DATA: lt_allocvaluesnum TYPE TABLE OF bapi1003_alloc_values_num,
* lt_num TYPE TABLE OF bapi1003_alloc_values_num,
lt_allocvalueschar TYPE TABLE OF bapi1003_alloc_values_char,
lw_allocvalueschar TYPE bapi1003_alloc_values_char,
* lt_class_seah TYPE TABLE OF bapi1003_alloc_values_char,
* lt_char TYPE TABLE OF bapi1003_alloc_values_char,
lt_allocvaluescurr TYPE TABLE OF bapi1003_alloc_values_curr,
* lt_curr TYPE TABLE OF bapi1003_alloc_values_curr,
lt_return TYPE TABLE OF bapiret2.
IF gw_lips-charg IS NOT INITIAL. "判断批次是否为空
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
EXPORTING
i_matnr = gw_lips-matnr "物料
i_charg = gw_lips-charg "批次
i_werks = gw_lips-werks "工厂
IMPORTING
e_objek = lw_objek_l "对象
e_obtab = lw_obtab "表
e_klart = lw_klart "类型
e_class = lw_class. "类
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = lw_objek_l
objecttable = lw_obtab
classnum = lw_class
classtype = lw_klart
TABLES
allocvaluesnum = lt_allocvaluesnum
allocvalueschar = lt_allocvalueschar
allocvaluescurr = lt_allocvaluescurr
return = lt_return.
READ TABLE lt_allocvalueschar INTO lw_allocvalueschar WITH KEY charact = 'ZYM_0001'.
IF sy-subrc = 0.
gw_data_mx-zyear = lw_allocvalueschar-value_neutral.
ENDIF.
READ TABLE lt_allocvalueschar INTO lw_allocvalueschar WITH KEY charact = 'ZTY_0001'.
IF sy-subrc = 0.
gw_data_mx-tkonn = lw_allocvalueschar-value_neutral.
ENDIF.
ENDIF.