2005 Sep 08 3:25 PM
Hello i really need help on this. I'm trying to perform a 309 movement (from one good or material to another) and i have no idea on how to do this with BAPI_GOODSMVT_CREATE since it only receives as parameters a header, the movement, and that table of items on wich the movement will be performed, but in 309 i need the goods or materials to be moved to another specific good or material and i don't know how to tell that to the bapi.
thanks in advance.
2005 Sep 08 3:31 PM
Here is a sample.
* Structures for BAPI
data: goodsmvt_header like bapi2017_gm_head_01.
data: goodsmvt_code like bapi2017_gm_code.
data: goodsmvt_headret like bapi2017_gm_head_ret.
data: goodsmvt_item like bapi2017_gm_item_create
occurs 1 with header line.
data: return like bapiret2 occurs 0.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_code-gm_code = '06'. " MB11
* Add "309" movement to table.
clear goodsmvt_item.
move '309' to goodsmvt_item-move_type .
move from_material to goodsmvt_item-material.
move to_material to goodsmvt_item-move_mat.
move menge to goodsmvt_item-entry_qnt.
move meins to goodsmvt_item-entry_uom.
move from_plant to goodsmvt_item-plant.
move to_plant to goodsmvt_item-move_plant.
move from_location to goodsmvt_item-stge_loc.
move to_location to goodsmvt_item-move_stloc.
append goodsmvt_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
importing
goodsmvt_headret = goodsmvt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = goodsmvt_item
return = return.Regards,
Rich Heilman
Message was edited by: Rich Heilman
Here is a sample.
* Structures for BAPI
data: goodsmvt_header like bapi2017_gm_head_01.
data: goodsmvt_code like bapi2017_gm_code.
data: goodsmvt_headret like bapi2017_gm_head_ret.
data: goodsmvt_item like bapi2017_gm_item_create
occurs 1 with header line.
data: return like bapiret2 occurs 0.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_code-gm_code = '06'. " MB11
* Add "309" movement to table.
clear goodsmvt_item.
move '309' to goodsmvt_item-move_type .
move from_material to goodsmvt_item-material.
move to_material to goodsmvt_item-move_mat.
move menge to goodsmvt_item-entry_qnt.
move meins to goodsmvt_item-entry_uom.
move from_plant to goodsmvt_item-plant.
move to_plant to goodsmvt_item-move_plant.
move from_location to goodsmvt_item-stge_loc.
move to_location to goodsmvt_item-move_stloc.
append goodsmvt_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
importing
goodsmvt_headret = goodsmvt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = goodsmvt_item
return = return.Regards,
Rich Heilman
Message was edited by: Rich Heilman
2005 Sep 08 3:31 PM
Here is a sample.
* Structures for BAPI
data: goodsmvt_header like bapi2017_gm_head_01.
data: goodsmvt_code like bapi2017_gm_code.
data: goodsmvt_headret like bapi2017_gm_head_ret.
data: goodsmvt_item like bapi2017_gm_item_create
occurs 1 with header line.
data: return like bapiret2 occurs 0.
goodsmvt_header-pstng_date = sy-datum.
goodsmvt_code-gm_code = '06'. " MB11
* Add "309" movement to table.
clear goodsmvt_item.
move '309' to goodsmvt_item-move_type .
move from_material to goodsmvt_item-material.
move to_material to goodsmvt_item-move_mat.
move menge to goodsmvt_item-entry_qnt.
move meins to goodsmvt_item-entry_uom.
move from_plant to goodsmvt_item-plant.
move to_plant to goodsmvt_item-move_plant.
move from_location to goodsmvt_item-stge_loc.
move to_location to goodsmvt_item-move_stloc.
append goodsmvt_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
importing
goodsmvt_headret = goodsmvt_headret
materialdocument = retmatdoc
tables
goodsmvt_item = goodsmvt_item
return = return.Regards,
Rich Heilman
Message was edited by: Rich Heilman
2005 Sep 08 3:32 PM
Hi,
I'm not sure about movement type 309, I can explain how the BAPI behaves.
fill the header details
gt_header-pstng_date = g_date.
gt_header-header_txt = gt_upload-bktxt.
*item details
gt_item-material = gt_upload-matnr.
gt_item-plant = gt_upload-werks.
gt_item-stge_loc = gt_upload-lgort.
gt_item-move_type = '201'.
gt_item-costcenter = gt_upload-kostl.
gt_item-gr_rcpt = gt_upload-kostl.
Movement code
gt_code-gm_code ='03'.
1. GM_Code 01: Goods receipt for purchase order
2. GM_Code 02: Goods receipt for production order
3. GM_Code 03: Goods issue
4. GM_Code 04: Transfer posting
5. GM_Code 05: Other goods receipts
6. GM_Code 06: Reversal of goods movements
7. GM_Code 07: Subsequent adjustment to a subcontract order
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gt_header
goodsmvt_code = gt_code
tables
goodsmvt_item = gt_item
goodsmvt_serialnumber = gt_sno
return = gt_return.
Cheers,
Sasi
2005 Sep 08 5:17 PM
2005 Sep 08 10:04 PM
Hello Rich, your reply solved my problem although i used code 04 instead of 06, thank you very much.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |