2011 Aug 06 6:02 PM
Hi Experts,
I have coded the following successfully.
1. Create a delivery from a production order
2. Create TO from delivery created
3. Pick/Pack and Confirm TO
Now, I need to create a PGI based from the delivery i created. I used FM BAPI_GOODSMVT_CREATE, however it only creates another delivery. Code is below:
LOOP AT i_itemhu INTO wa_itemhu.
wa_goodsmvt_item-plant = wa_itemhu-plant.
wa_goodsmvt_item-stge_loc = wa_itemhu-stge_loc.
wa_goodsmvt_item-batch = wa_itemhu-batch.
wa_goodsmvt_item-move_type = '261'.
wa_goodsmvt_item-entry_qnt = wa_itemhu-entry_qnt.
wa_goodsmvt_item-entry_uom = wa_itemhu-entry_uom.
wa_goodsmvt_item-orderid = wa_itemhu-orderid.
wa_goodsmvt_item-deliv_numb = wa_itemhu-deliv_numb.
wa_goodsmvt_item-deliv_item = wa_itemhu-deliv_item.
APPEND wa_goodsmvt_item TO i_goodsmvt_item.
CLEAR wa_goodsmvt_item.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_header
goodsmvt_code = '03'
IMPORTING
materialdocument = ws_doc_gihu
TABLES
goodsmvt_item = i_goodsmvt_item.
Is it really possible to do PGI using this FM? If yes, please help in coding.. Many many thanks!!!
Hi Experts,
I have coded the following successfully.
1. Create a delivery from a production order
2. Create TO from delivery created
3. Pick/Pack and Confirm TO
Now, I need to create a PGI based from the delivery i created. I used FM BAPI_GOODSMVT_CREATE, however it only creates another delivery. Code is below:
LOOP AT i_itemhu INTO wa_itemhu.
wa_goodsmvt_item-plant = wa_itemhu-plant.
wa_goodsmvt_item-stge_loc = wa_itemhu-stge_loc.
wa_goodsmvt_item-batch = wa_itemhu-batch.
wa_goodsmvt_item-move_type = '261'.
wa_goodsmvt_item-entry_qnt = wa_itemhu-entry_qnt.
wa_goodsmvt_item-entry_uom = wa_itemhu-entry_uom.
wa_goodsmvt_item-orderid = wa_itemhu-orderid.
wa_goodsmvt_item-deliv_numb = wa_itemhu-deliv_numb.
wa_goodsmvt_item-deliv_item = wa_itemhu-deliv_item.
APPEND wa_goodsmvt_item TO i_goodsmvt_item.
CLEAR wa_goodsmvt_item.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_header
goodsmvt_code = '03'
IMPORTING
materialdocument = ws_doc_gihu
TABLES
goodsmvt_item = i_goodsmvt_item.
Is it really possible to do PGI using this FM? If yes, please help in coding.. Many many thanks!!!
2011 Aug 07 11:38 AM
2011 Aug 08 11:38 AM
Hello,
For doing PGI, BAPI_GOODSMVT_CREATE will not be appropriate. Instead, use either of the FMs WS_DELIVERY_UPDATE or WS_DELIVERY_UPDATE_2. This will help you do the PGI for the given delivery.
Regards,
Venkata Phani Prasad K
2011 Aug 08 5:03 PM
Hi,
I am using WS_DELIVERY_UPDATE to perform PGI of delivery. I am testing first the FM by in SE37 and PGI is correctly done for a delivery, however, when I had coded it (same way as the testing) I am getting error Delivery XXXXXXXXXX created. On which the delivery XXXXXXXXXX is the delivery I want to perform PGI. I am also trying do some changes in my code like passing the items to vbpok_tab; enabling synchon FM parameter; enabling nicht_sperren; etc., but still same error is being produced. My code is as below:
wa_vbkok-vbeln_vl = ws_delivery_doc.
wa_vbkok-vbtyp_vl = 'J'.
wa_vbkok-wabuc = 'X'.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = wa_vbkok
commit = 'X'
delivery = ws_delivery_doc
IMPORTING
ef_error_any_0 = ws_xfeld
TABLES
prot = wa_prot.
Please help.
2011 Aug 08 5:11 PM
Hello,
Did you try WS_DELIVERY_UPDATE_2? Does it give the same error?
Regards,
Venkata Phani Prasad K
2011 Aug 08 5:28 PM
Same goes with that FM since WS_DELIVERY_UPDATE_2 is being used inside FM WS_DELIVERY_UPDATE. Both of them successfully perform PGI when testing them in SE37, but when it is in code, error message is being retrieved.
2011 Aug 09 2:23 PM
I am now getting error No status object is available for HU &. I already called FMs below that would refresh standard data before executing FM 'WS_DELIVERY_UPDATE', however the still error is getting retrieved.
CALL FUNCTION 'QAAT_HUMO_REFRESH'.
CALL FUNCTION 'MB_MOVEMENTS_REFRESH'.
CALL FUNCTION 'STATUS_BUFFER_REFRESH'.
CALL FUNCTION 'HU_STATUS_REFRESH'.
CALL FUNCTION 'MB_MOVEMENTS_REFRESH'.
I am planning to talk with the Functional team and Basis team implement SAP Note 614179. I hope this would solve this.
2011 Aug 08 12:04 PM
Hi
Do a coding as this:
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = l_goodsmvt_header
goodsmvt_code = l_goodsmvt_code
testrun = ' '
importing
goodsmvt_headret = l_goodsmvt_headret
materialdocument = l_mblnr
matdocumentyear = l_mjahr
tables
goodsmvt_item = i_goodsmvt_item
return = i_return.
call function 'BAPI_TRANSACTION_COMMIT'.
Read the data in I_RETURN to know the origin of troubles.
See also SAP Note 520813 - FAQ: BAPIs for goods movements, it will help you
Regards
Eduardo
2011 Aug 09 4:07 PM
I used FM BAPI_GOODSMVT_CREATE, however it only creates another delivery.
The function you mentioned does not create a delivery. I have used the same fm for create PGI and it worked fine. Unfortunately i donot have the code with me now.Please check it once again. When doing it through standard transaction is there any new delivery created ?
Kesav
2011 Aug 10 7:52 PM