‎2010 Jun 29 10:39 AM
Hi All,
Iu2019m using the BAPI: BAPI_GOODSMVT_CREATE for Goods movement .
1. Will this BAPI changes even the storage location?
2. Do I need write explicit u2018commit worku2019 statement in my program to save the changes done through BAPI_GOODSMVT_CREATE?
My requirement is to make the goods movement and also to change the storage location. Could you pls tell how can I proceed further?
Thanks & Regards,
Harsha Ramaiah
‎2010 Jun 29 10:55 AM
Hi,
This BAPI doesn't change storage location. You have to call commit work after calling the bapi.
See the BAPI Documentation regarding transaction control.
Transaction control is not implemented. The calling program therefore has to execute
the Commit Work itself after this method has been successfully called
(in other words, if no errors were reported in the Return parameter).Regards
Vinod
‎2010 Jun 29 10:52 AM
hi ,
look at this
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
and bapi to change storage location is
'BAPI_OUTB_DELIVERY_CHANGE'
‎2010 Jun 29 10:55 AM
Hi,
This BAPI doesn't change storage location. You have to call commit work after calling the bapi.
See the BAPI Documentation regarding transaction control.
Transaction control is not implemented. The calling program therefore has to execute
the Commit Work itself after this method has been successfully called
(in other words, if no errors were reported in the Return parameter).Regards
Vinod
‎2010 Jun 29 10:57 AM
Hi,
The FM BAPI_GOODSMVT_CREATE also handles the Goods Transfer from one storage location to the other.
For this pass the value to the Importing Parameter GM_CODE = 4 (Transfer Posting).
The FM BAPI_COMMIT_WORK is used to commit the BAPI transaction explicitly.
Regards,
Santosh Kumar
‎2010 Jun 29 11:14 AM
Hi Santhosh,
Thanks for your reply.
Iu2019m not able to find u2018Importing Parameter GM_CODEu2019 in the bapi BAPI_GOODSMVT_CREATE
I can only find the following 4 parameters
1. GOODSMVT_HEADER
2. GOODSMVT_CODE
3. TESTRUN
4. GOODSMVT_REF_EWM
Pls guide meu2026.
Thanks in advance
‎2010 Jun 29 12:18 PM
Hi,
The Importing Parameter GOODSMVT_CODE is nothing but your GM_CODE. You can ask your Functional consultant regarding the GM_CODE which you need to pass either 3 or 4.
Transfer posting surely handles the Material movement from one storage location to the another.
Note: Refer to the FM Documentation for more clear information.
GM_CODE=3 can handle "Goods Issue without reference to a reservation" and "Goods Issue with reference to a reservation"
GM_CODE=4 is "Transfer Posting without reference to a reservation"
Regards,
Santosh Kumar Mukka.
Edited by: santosh kumar on Jun 29, 2010 4:49 PM
Edited by: santosh kumar on Jun 29, 2010 4:52 PM
‎2010 Jun 29 11:25 AM
Hi,
Please see below sample code I have used in my earlier developments
Data:l_head type BAPI2017_GM_HEAD_01,
l_code type BAPI2017_GM_CODE,
l_item type BAPI2017_GM_ITEM_CREATE.
*--fill Header information
l_head-PSTNG_DATE = sy-datum.
l_head-DOC_DATE = sy-datum.
l_head-pr_uname = sy-uname.
l_BAPI2017_GM_CODE-gm_code = '03'
*--Extract the data for which item has to be created and put into internal table i_mska
then for each one fill item data as below
loop at pt_mska into l_mska.
l_vbeln = l_mska-vbeln.
l_item-material = l_mska-matnr. "Article Nr
l_item-plant = l_mska-werks. "Site
l_item-stge_loc = l_mska-lgort. "Storage Location
l_item-move_type = c_bwart_231. "Movement type
l_item-stck_type = space. "Unrestricted
l_item-spec_stock = c_sobkz_e. "Special Stock E
l_item-entry_qnt = l_mska-kalab. "Quantity
perform get_article_unit using l_mska-matnr
changing l_item-entry_uom
l_item-entry_uom_iso.
l_item-item_text = sy-repid.
l_item-move_mat = l_mska-matnr.
l_item-move_plant = l_mska-werks.
l_item-move_stloc = l_mska-lgort.
l_item-val_sales_ord = l_mska-vbeln.
l_item-val_s_ord_item = l_mska-posnr.
append l_item to lt_item.
endloop.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = l_head
GOODSMVT_CODE = l_code
IMPORTING
MATERIALDOCUMENT = l_mblnr
MATDOCUMENTYEAR = l_mjahr
TABLES
GOODSMVT_ITEM = lt_item
RETURN = lt_return.
if lt_return[] is initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
else.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
endif.
Cheers,
Pramod
Edited by: PKUPADHYAY on Jun 29, 2010 12:25 PM
‎2010 Jun 29 11:39 AM
Thanks pramodh.
Here what is the value you are passing for GM_CODE, Either 3 or 4 ?
because, here my friend told we have to pass GM_CODE = 4 to update the storage location...
Could you pls confirm me....
‎2010 Jun 29 12:05 PM
Hi,
GM_CODE can be as per your requirement
It is maintained in SAP Table T158G.
In my system it's like as below
01 MB01
02 MB31
03 MB1A
04 MB1B
05 MB1C
06 MB11
07 MB04
03 MB1A => It's for Goods Issue
04 MB1B=>for transfer Posting
It entirely depends on yuor requirement that what GM_code need to be passed.
Cheers,
Pramod