2007 May 30 1:06 AM
Hi,
When i do a manual MB1A 'Goods issue' with reference to Work Order it is posting the goods issue and updating the RESB ,but when i do the same through the bapi code 03 Table i was not able to post the goods issue at all. am i missing a input field in the bapi .Plz help me out.
My code.
gf_goodsmvt_code-gm_code = '03'. "GI
gf_goodsmvt_header-pstng_date = sy-datum.
gf_goodsmvt_header-doc_date = sy-datum.
LOOP AT it_details INTO gf_details .
MOVE :gf_details-matnr TO gf_goods-material,
gf_details-werks TO gf_goods-plant,
rm07m-lgort TO gf_goods-stge_loc,
gf_details-charg TO gf_goods-batch,
rm07m-bwart TO gf_goods-move_type.
MOVE gf_details-issue_qty TO gf_goods-entry_qnt .
MOVE gf_details-meins TO gf_goods-entry_uom.
gf_goods-mvt_ind = 'F'.
gf_goods-reserv_no = gf_details-rsnum.
gf_goods-res_item = gf_details-posnr.
gf_goods-res_type = gf_details-rsart.
gf_goods-withdrawn = 'X'.
gf_goods-orderid = rm07m-aufnr.
gf_goods-order_itno = 1.
APPEND gf_goods TO it_goodsmvt_item.
CLEAR gf_goods.
ENDLOOP.
IF NOT it_goodsmvt_item[] IS INITIAL.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gf_goodsmvt_header
goodsmvt_code = gf_goodsmvt_code
TESTRUN = ' '
IMPORTING
GOODSMVT_HEADRET =
materialdocument = g_mat_doc
MATDOCUMENTYEAR =
TABLES
goodsmvt_item = it_goodsmvt_item
GOODSMVT_SERIALNUMBER = 'X'
return = it_return.
2007 May 30 1:27 AM
check below Threads :
and see the sample program :
Structures for BAPI
data: gdsmt_header like bapi2017_gm_head_01.
data: gdsmt_code like bapi2017_gm_code.
data: gdsmt_headret like bapi2017_gm_head_ret.
data: gdsmt_item like bapi2017_gm_item_create occurs 1 with header line.
data: return like bapiret2 occurs 0.
data: retmatdoc like bapi2017_gm_head_ret-mat_doc.
Setup BAPI header data.
gdsmt_header-pstng_date = sy-datum.
gdsmt_header-doc_date = sy-datum.
gdsmt_code-gm_code = '06'. " MB11
Write 262 movement to table.
clear gdsmt_item.
move '262' to gdsmt_item-move_type.
move i_resb-matnr to gdsmt_item-material.
move p_bdmng to gdsmt_item-entry_qnt.
move i_resb-meins to gdsmt_item-entry_uom.
move i_resb-werks to gdsmt_item-plant.
move i_resb-lgort to gdsmt_item-stge_loc.
move i_afko-aufnr to gdsmt_item-orderid.
append gdsmt_item.
Determine cost center
move '0000041430' to gdsmt_item-costcenter.
append gdsmt_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gdsmt_header
goodsmvt_code = gdsmt_code
importing
goodsmvt_headret = gdsmt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = gdsmt_item
return = return.
Reward Points if it is helpful
Thanks
Seshu
Hi,
When i do a manual MB1A 'Goods issue' with reference to Work Order it is posting the goods issue and updating the RESB ,but when i do the same through the bapi code 03 Table i was not able to post the goods issue at all. am i missing a input field in the bapi .Plz help me out.
My code.
gf_goodsmvt_code-gm_code = '03'. "GI
gf_goodsmvt_header-pstng_date = sy-datum.
gf_goodsmvt_header-doc_date = sy-datum.
LOOP AT it_details INTO gf_details .
MOVE :gf_details-matnr TO gf_goods-material,
gf_details-werks TO gf_goods-plant,
rm07m-lgort TO gf_goods-stge_loc,
gf_details-charg TO gf_goods-batch,
rm07m-bwart TO gf_goods-move_type.
MOVE gf_details-issue_qty TO gf_goods-entry_qnt .
MOVE gf_details-meins TO gf_goods-entry_uom.
gf_goods-mvt_ind = 'F'.
gf_goods-reserv_no = gf_details-rsnum.
gf_goods-res_item = gf_details-posnr.
gf_goods-res_type = gf_details-rsart.
gf_goods-withdrawn = 'X'.
gf_goods-orderid = rm07m-aufnr.
gf_goods-order_itno = 1.
APPEND gf_goods TO it_goodsmvt_item.
CLEAR gf_goods.
ENDLOOP.
IF NOT it_goodsmvt_item[] IS INITIAL.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gf_goodsmvt_header
goodsmvt_code = gf_goodsmvt_code
TESTRUN = ' '
IMPORTING
GOODSMVT_HEADRET =
materialdocument = g_mat_doc
MATDOCUMENTYEAR =
TABLES
goodsmvt_item = it_goodsmvt_item
GOODSMVT_SERIALNUMBER = 'X'
return = it_return.
2007 May 30 1:27 AM
check below Threads :
and see the sample program :
Structures for BAPI
data: gdsmt_header like bapi2017_gm_head_01.
data: gdsmt_code like bapi2017_gm_code.
data: gdsmt_headret like bapi2017_gm_head_ret.
data: gdsmt_item like bapi2017_gm_item_create occurs 1 with header line.
data: return like bapiret2 occurs 0.
data: retmatdoc like bapi2017_gm_head_ret-mat_doc.
Setup BAPI header data.
gdsmt_header-pstng_date = sy-datum.
gdsmt_header-doc_date = sy-datum.
gdsmt_code-gm_code = '06'. " MB11
Write 262 movement to table.
clear gdsmt_item.
move '262' to gdsmt_item-move_type.
move i_resb-matnr to gdsmt_item-material.
move p_bdmng to gdsmt_item-entry_qnt.
move i_resb-meins to gdsmt_item-entry_uom.
move i_resb-werks to gdsmt_item-plant.
move i_resb-lgort to gdsmt_item-stge_loc.
move i_afko-aufnr to gdsmt_item-orderid.
append gdsmt_item.
Determine cost center
move '0000041430' to gdsmt_item-costcenter.
append gdsmt_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gdsmt_header
goodsmvt_code = gdsmt_code
importing
goodsmvt_headret = gdsmt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = gdsmt_item
return = return.
Reward Points if it is helpful
Thanks
Seshu
2007 May 30 1:41 AM
2007 May 30 2:09 AM
did you use update flag ? please use update flag and see the results..
2007 May 30 8:01 PM
When i pass the work order no only it is posting the document , but when i pass the reservation no it is throwing error
For reservation 0019779218 0070, no movements can be posted.
My requirement is It has to update the RESB.