后来经头儿指点,特殊行业经常会有一些特殊的bapi


调用 BAPI_GOODSMVT_CREATE创建凭证时,一直报错。

后来经头儿指点,特殊行业经常会有一些特殊的bapi

比如石油业,天然气,航空等等,这个时候就可能用到特定的了


这里是使用了BAPI_GOODSMVT_CREATE_OIL

从名称上也能看出是哪个行业


这种物料,mara中有个字段不一样:CMETH

BAPI_GOODSMVT_CREATE_OIL <wbr>:特殊行业创建物料货物移动BAPI

​​
具体哪儿配置的,我没研究,只是稍微看了下前台



mm03查看



BAPI_GOODSMVT_CREATE_OIL <wbr>:特殊行业创建物料货物移动BAPI

​​



写了个简单例子:

DATA : LS_HEADER  TYPE BAPIOIL2017_GM_HEAD_CREATE , 
LV_CODE TYPE BAPI2017_GM_CODE VALUE '03' ,
LT_ITEM TYPE TABLE OF BAPIOIL2017_GM_ITM_CRTE_01 WITH HEADER LINE ,
LT_PARAM TYPE TABLE OF BAPIOIL2017_GM_ITM_CRTE_PARAM WITH HEADER LINE ,
LT_QUAN TYPE TABLE OF BAPIOIL2017_GM_ITM_CRTE_QUAN WITH HEADER LINE ,
LT_RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE .

DATA : LS_R_HEADER TYPE BAPI2017_GM_HEAD_RET .
DATA : LT_QCI_PARM TYPE TABLE OF OIB_A10 WITH HEADER LINE .
DATA : LV_MATNR TYPE MARA -MATNR VALUE '0501990060158916' ,
LV_LINEID TYPE MB_LINE_ID .

LS_HEADER -PSTNG_DATE = SY -DATUM .
LS_HEADER -DOC_DATE = SY -DATUM .

**item
PERFORM FRM_CONVER_MATN1_INPUT USING LV_MATNR
CHANGING LT_ITEM -MATERIAL .
LV_LINEID = LV_LINEID + 1 .
LT_ITEM -LINE_ID = LV_LINEID .
LT_ITEM -PLANT = '9DL1' .
LT_ITEM -STGE_LOC = 'BULK' .
LT_ITEM -BATCH = 'WBCG' .
LT_ITEM -MOVE_TYPE = '261' .
LT_ITEM -ENTRY_QNT = 3 .
LT_ITEM -ENTRY_UOM = 'TO' .
LT_ITEM -ORDERID = '001100000150' .
*lt_item-ORDER_ITNO = ''.
APPEND LT_ITEM .
*********************************
*parm
CALL FUNCTION 'OIB_QCI_DEFAULTS'
EXPORTING
I_MATNR = LT_ITEM -MATERIAL
I_WERKS = LT_ITEM -PLANT
TABLES
ET_PARAM = LT_QCI_PARM
EXCEPTIONS
PDTYP_NOT_FOUND = 1
RDGGRP_NOT_FOUND = 2
MOVE_FIELD_TO_ITAB_FAILED = 3
MARC_SINGLE_READ_FAILED = 4
PARAM_ERROR = 5
OTHERS = 6 .

IF SY -SUBRC <> 0 .
* Implement suitable error handling here
ENDIF .

LT_PARAM -LINE_ID = LV_LINEID .

LT_PARAM -CALCULATEMISSING = 'X' .

LOOP AT LT_QCI_PARM .

CASE LT_QCI_PARM -FIELDNAME .
WHEN 'MTTMP' .
LT_PARAM -MATERIALTEMPERATURE = LT_QCI_PARM -PAR_FLTP . "物料温度
WHEN 'MTTEH' .
LT_PARAM -MATERIALTEMPERATURE_UOM = LT_QCI_PARM -PAR_CHAR . "物料温度单位
WHEN 'TDICH' .
LT_PARAM -TESTDENSITY = LT_QCI_PARM -PAR_FLTP . "测试密度
WHEN 'TDICHEH' .
LT_PARAM -TESTDENSITY_UOM = LT_QCI_PARM -PAR_CHAR . "测试密度单位
WHEN 'TSTMP' .
LT_PARAM -TESTTEMPERATURE_DENSITY = LT_QCI_PARM -PAR_FLTP . "测试温度
WHEN 'TSTEH' .
LT_PARAM -TESTTEMP_DENSITY_UOM = LT_QCI_PARM -PAR_CHAR . "测试温度单位
WHEN 'BSWCN' .
LT_PARAM -BASESEDIMENTWATERCONTENT = LT_QCI_PARM -PAR_FLTP . "含水率
WHEN 'HYDRO' .
LT_PARAM -AIRBUOYANCYINDICATOR = LT_QCI_PARM -PAR_CHAR . "空气浮力指数
WHEN 'ABFAC' .
LT_PARAM -AIRBUOYANCYCONSTANT = LT_QCI_PARM -PAR_FLTP . "空气XX指数
WHEN OTHERS .
ENDCASE .
ENDLOOP .
APPEND LT_PARAM .

LT_QUAN -LINE_ID = LV_LINEID .
LT_QUAN -QUANTITYPACKED = 3 .
LT_QUAN -QUANTITYFLOAT = 3.
LT_QUAN -QUANTITYUOM = 'TO' .
LT_QUAN -QUANTITYCHECK = '' .
APPEND LT_QUAN .

CALL FUNCTION 'BAPI_GOODSMVT_CREATE_OIL'
EXPORTING
GOODSMVT_HEADER = LS_HEADER
GOODSMVT_CODE = LV_CODE
* TESTRUN = ' '
IMPORTING
GOODSMVT_HEADRET = LS_R_HEADER
TABLES
GOODSMVT_ITEM_01 = LT_ITEM
* GOODSMVT_ITEM_02 =
GOODSMVT_ITEM_PARAM = LT_PARAM
GOODSMVT_ITEM_QUAN = LT_QUAN
* GOODSMVT_SERIALNUMBER =
* EXTENSIONIN =
RETURN = LT_RETURN .
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .




欢迎关注订阅号:SAP学习记录 (SAPlearning )

PO <wbr><wbr>text <wbr><wbr>copy <wbr><wbr>rules <wbr><wbr>:copy <wbr><wbr>PR <wbr><wbr>item <wbr><wbr>text <wbr><wbr>to <wbr><wbr>PO