这是一个神奇的BAPI,适用于很多很多的TCODE. MIGO MB1C MB1B ,MBST……(很多TCODE其实功能于MIGO重复,卡卡)
实例:http://blog.sina.com.cn/s/blog_4c66402b01012i7f.html
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = p_head "凭证头
goodsmvt_code = '04' "移动类型
testrun = p_test
IMPORTING
materialdocument = p_mblnr "返回 物料凭证号
matdocumentyear = p_mjahr "返回 凭证年度
TABLES
goodsmvt_item = p_item “输入 凭证项
return = p_retu.
goodsmvt_code可取值:There are the following types of transactions/events: 见表 T158G
GM_Code 01: MB01 Goods receipt for purchase order (采购订单收货)
GM_Code 02: Mb31 Goods receipt for production order (生产订单收货)
GM_Code 03: MB1A Goods issue (发货)
GM_Code 04: MB1B Transfer posting (库存转储)
GM_Code 05: MB1C Other goods receipts (其他收货)
GM_Code 06: MB11 Reversal of goods movements (货物移动冲销)
GM_Code 07: MB04 Subsequent adjustment to a subcontract order (啥玩意?)
1. Use the Business Object Builder (Transaction SWO1) to enhance method IDocRange.GoodsReceiptExceptionHandle of BOR object type IDOCPUWB. First, this affects, the interface ('Parameters' pushbutton) to which the following two parameters have to be applied:
a) Parameter 'DelNoteQuantity', set the 'Import' flag, with dictionary reference, reference table IMSEG, reference field LSMNG
b) Parameter 'DeliveryNoteUnit', set the 'Import' flag, with dictionary reference, reference table IMSEG, reference field LSMEH
2. Second, the source code of this method has to be enhanced ('Program' pushbutton).
leecz(38408577) 14:30:40
* Domain: KZBEW - Movement Indicator
* Goods movement w/o reference
* B - Goods movement for purchase order
* F - Goods movement for production order
* L - Goods movement for delivery note
* K - Goods movement for kanban requirement (WM - internal only)
* O - Subsequent adjustment of "material-provided" consumption
* W - Subsequent adjustment of proportion/product unit material