批次拆分BAPI
*->批次拆分
CLEAR:LS_KOMPH,LS_BDCOM,LT_BDBATCH.
LS_KOMPH-MATNR = LS_I_TABLE-MATERIALCODE.
LS_KOMPH-WERKS = '8000'.
LS_KOMPH-LGORT = '3001'.
LS_KOMPH-BWART = '261'.
LS_BDCOM-KAPPL = 'ME'.
LS_BDCOM-KALSM = 'ME0001'.
LS_BDCOM-MENGE = LS_I_TABLE-WEIGHT.
LS_BDCOM-MEINS = LS_I_TABLE-UNIT.
LS_BDCOM-ERFMG = LS_I_TABLE-WEIGHT.
LS_BDCOM-ERFME = LS_I_TABLE-UNIT.
LS_BDCOM-MTVFP = '03'.
LS_BDCOM-LBBSA = '01'.
LS_BDCOM-OBJID = 'MSEG'.
LS_BDCOM-OBJEC = '000001'.
LS_BDCOM-SHKZG_MIGO = '-'.
LS_BDCOM-BWART = '261'.
LS_BDCOM-NODIA = 'X'.
*-->调用BAPI拆分
CALL FUNCTION 'VB_BATCH_DETERMINATION'
EXPORTING
I_KOMPH = LS_KOMPH
X_BDCOM = LS_BDCOM
TABLES
E_BDBATCH = LT_BDBATCH
EXCEPTIONS
NO_MATERIAL = 1
NO_PLANT = 2
NO_APPLICATION = 3
FUNCTION_NOT_POSSIBLE = 4
CONDITION_NOT_FOUND = 5
CLASSTYPE_NOT_FOUND = 6
CLASSTYPE_NOT_ACTIVE = 7
NO_BASE_UNIT = 8
NO_UNIT = 9
CONVERSION_NOT_FOUND = 10
CONVERSION_OVERFLOW = 11
MISSING_ENTRY_T156C = 12
CONVERSION_TYPE_INVALID = 13
DIVISION_BY_ZERO = 14
DATA_MISMATCH = 15
MATERIAL_NOT_FOUND = 16
NO_QUANTITY = 17
INVALID_DUPLICATE_BATCH = 18
OTHERS = 19.
CLEAR:LS_KOMPH,LS_BDCOM,LT_BDBATCH.
LS_KOMPH-MATNR = LS_I_TABLE-MATERIALCODE.
LS_KOMPH-WERKS = '8000'.
LS_KOMPH-LGORT = '3001'.
LS_KOMPH-BWART = '261'.
LS_BDCOM-KAPPL = 'ME'.
LS_BDCOM-KALSM = 'ME0001'.
LS_BDCOM-MENGE = LS_I_TABLE-WEIGHT.
LS_BDCOM-MEINS = LS_I_TABLE-UNIT.
LS_BDCOM-ERFMG = LS_I_TABLE-WEIGHT.
LS_BDCOM-ERFME = LS_I_TABLE-UNIT.
LS_BDCOM-MTVFP = '03'.
LS_BDCOM-LBBSA = '01'.
LS_BDCOM-OBJID = 'MSEG'.
LS_BDCOM-OBJEC = '000001'.
LS_BDCOM-SHKZG_MIGO = '-'.
LS_BDCOM-BWART = '261'.
LS_BDCOM-NODIA = 'X'.
*-->调用BAPI拆分
CALL FUNCTION 'VB_BATCH_DETERMINATION'
EXPORTING
I_KOMPH = LS_KOMPH
X_BDCOM = LS_BDCOM
TABLES
E_BDBATCH = LT_BDBATCH
EXCEPTIONS
NO_MATERIAL = 1
NO_PLANT = 2
NO_APPLICATION = 3
FUNCTION_NOT_POSSIBLE = 4
CONDITION_NOT_FOUND = 5
CLASSTYPE_NOT_FOUND = 6
CLASSTYPE_NOT_ACTIVE = 7
NO_BASE_UNIT = 8
NO_UNIT = 9
CONVERSION_NOT_FOUND = 10
CONVERSION_OVERFLOW = 11
MISSING_ENTRY_T156C = 12
CONVERSION_TYPE_INVALID = 13
DIVISION_BY_ZERO = 14
DATA_MISMATCH = 15
MATERIAL_NOT_FOUND = 16
NO_QUANTITY = 17
INVALID_DUPLICATE_BATCH = 18
OTHERS = 19.