‎2011 Jan 05 1:10 PM
Hi Experts;
I want to use BAPI_GOODSMVT_CREATE bapi for MFBF Tcode process.
But I dont know assing to GOODSMVT_CODE which number for MFBF.
Which code assign to GOODSMVT_CODE?
GOODSMVT_CODE
01 - MB01 - Goods Receipts for Purchase Order
02 - MB31 - Goods Receipts for Prod Order
03 - MB1A - Goods Issue
04 - MB1B - Transfer Posting
05 - MB1C - Enter Other Goods Receipt
06 - MB11
Thanks.
‎2011 Jan 05 3:53 PM
Hi,
I had used the following code 2 years ago. I don't remember why I have switched from '01' to '06'. It may help you:
tables lips.
Structures for GOODS MVT BAPI
data: gm_header type bapi2017_gm_head_01,
gm_code type bapi2017_gm_code,
gm_headret type bapi2017_gm_head_ret,
gm_item type table of bapi2017_gm_item_create with header line,
gm_return type bapiret2 occurs 0 with header line,
gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd.
clear gm_item. refresh gm_item.
refresh gm_return.
gm_code-gm_code = '01'.
gm_code-gm_code = '06'.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
select single bosurunkodu
from zsdbt011
into bosurunkodu
where werks = bayikodu.
if sy-subrc = 0.
select single *
from lips
where vbeln = p_teslimat_no.
gm_item-move_type = '511'.
gm_item-material = bosurunkodu.
gm_item-entry_qnt = lips-lfimg.
gm_item-entry_uom = lips-meins.
gm_item-plant = bayikodu.
gm_item-stge_loc = '0001'.
append gm_item.
endif.
data material_doc_message(255).
clear gm_retmtd.
clear gm_return.
refresh gm_return.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
if gm_retmtd is not initial.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
‎2011 Jan 05 3:53 PM
Hi,
I had used the following code 2 years ago. I don't remember why I have switched from '01' to '06'. It may help you:
tables lips.
Structures for GOODS MVT BAPI
data: gm_header type bapi2017_gm_head_01,
gm_code type bapi2017_gm_code,
gm_headret type bapi2017_gm_head_ret,
gm_item type table of bapi2017_gm_item_create with header line,
gm_return type bapiret2 occurs 0 with header line,
gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd.
clear gm_item. refresh gm_item.
refresh gm_return.
gm_code-gm_code = '01'.
gm_code-gm_code = '06'.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
select single bosurunkodu
from zsdbt011
into bosurunkodu
where werks = bayikodu.
if sy-subrc = 0.
select single *
from lips
where vbeln = p_teslimat_no.
gm_item-move_type = '511'.
gm_item-material = bosurunkodu.
gm_item-entry_qnt = lips-lfimg.
gm_item-entry_uom = lips-meins.
gm_item-plant = bayikodu.
gm_item-stge_loc = '0001'.
append gm_item.
endif.
data material_doc_message(255).
clear gm_retmtd.
clear gm_return.
refresh gm_return.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
if gm_retmtd is not initial.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
‎2011 Jan 05 4:00 PM
You cant use that bapi for MFBF( production posting ). This transaction is for repititive manufacturing backflushing.
In se37 search for bapirepman. You will get the excat one.