实际coding过程当中,需要获取物料批次号对应的类、特性和特性值,通过直接从Table中获取,非常麻烦,通过function获取,function如下:
1.VB_BATCH_2_CLASS_OBJECT
2.BAPI_OBJCL_GETDETAIL
function:VB_BATCH_2_CLASS_OBJECT通过物料号工厂批次获取对应的类等相关信息
function:BAPI_OBJCL_GETDETAIL根据上面的反馈返回值获取特性以及特性值
代码段如下:
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT' EXPORTING i_matnr = "物料 i_charg = "批次 i_werks = "工厂 IMPORTING e_objek = l_objek "对象 e_obtab = l_obtab "表 e_klart = l_klart "类型 e_class = l_class."类 CALL FUNCTION 'BAPI_OBJCL_GETDETAIL' EXPORTING objectkey = l_objek objecttable = l_obtab classnum = l_class classtype = l_klart TABLES allocvaluesnum = lt_num allocvalueschar = lt_char allocvaluescurr = lt_curr return = lt_return.其中table:lt_num lt_char lt_curr即是获取的特性及特性值