本文主要是介绍SAP 获取批次信息函数(MSC3N),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在SAP系统中一般通过tcode-MSC3N来查看批次信息
而要在ABAP程序中获取批次信息则需要调用两个函数:
VB_BATCH_2_CLASS_OBJECT
BAPI_OBJCL_GETDETAIL
将这两个函数串联使用即可
VB_BATCH_2_CLASS_OBJECT:
BAPI_OBJCL_GETDETAIL:
CHARACT_DESCR 为批次信息的描述 VALVE_FROM为F类型的值
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
EXPORTING
I_MATNR = BESTAND-MATNR
I_CHARG = BESTAND-CHARG
I_WERKS = BESTAND-WERKS
IMPORTING
E_OBJEK = E_OBJEK
E_OBTAB = E_OBTAB
E_KLART = E_KLART
E_CLASS = E_CLASS.
* CLEAR LS_MCH1_KEY .
* LS_MCH1_KEY-MATNR = BESTAND-MATNR .
* LS_MCH1_KEY-CHARG = BESTAND-CHARG .
* CLEAR E_OBJEK .
* E_OBJEK = LS_MCH1_KEY .
* CLEAR OBJECTKEY .
* OBJECTKEY = E_OBJEK .
CLEAR: ALLOCVALUESNUM , ALLOCVALUESNUM[] .
CLEAR: ALLOCVALUESCHAR , ALLOCVALUESCHAR[] .
CLEAR: ALLOCVALUESCURR , ALLOCVALUESCURR[] .
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
* OBJECTKEY = OBJECTKEY
OBJECTKEY_LONG = E_OBJEK
OBJECTTABLE = E_OBTAB
CLASSNUM = E_CLASS
CLASSTYPE = E_KLART
* KEYDATE = SY-DATUM
* LANGUAGE = SY-LANGU
TABLES
ALLOCVALUESNUM = ALLOCVALUESNUM[]
ALLOCVALUESCHAR = ALLOCVALUESCHAR[]
ALLOCVALUESCURR = ALLOCVALUESCURR[]
RETURN = RETURN[].
值得注意的是如果SAP的物料号配置为18为则BAPI_OBJCL_GETDETAIL的调用中要使用
OBJECTKEY参数二入股物料号配置为40位则需要使用OBJECTKEY_LONG参数
这篇关于SAP 获取批次信息函数(MSC3N)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!