‎2005 Oct 10 8:01 PM
hi guys
does someone know of a BAPI which i can call and pass the delivery number and it will do a PGI for me?
i tried BAPI_GOODSMVT_CREATE but its not working well for me.
please let me know if there is such a BAPI
thanks
‎2005 Oct 10 8:39 PM
Hi Sanket,
Use the following piece of code.
DATA:
L_VBELN LIKE LIKP-VBELN,
L_VBKOK LIKE VBKOK,
L_PROTT LIKE PROTT OCCURS 0 WITH HEADER LINE.
* carry out goods issue
L_VBKOK-VBELN_VL = L_VBELN.<-- fill this field with your delivery number
L_VBKOK-WABUC = 'X'.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
VBKOK_WA = L_VBKOK
SYNCHRON = 'X'
NO_MESSAGES_UPDATE = ' '
UPDATE_PICKING = 'X'
COMMIT = ' '
DELIVERY = L_VBELN
NICHT_SPERREN = 'X'
TABLES
PROT = L_PROTT
EXCEPTIONS
OTHERS = 0.
COMMIT WORK AND WAIT.
Please reward and close if it works.
Srinivas
‎2005 Oct 10 8:39 PM
Hi Sanket,
Use the following piece of code.
DATA:
L_VBELN LIKE LIKP-VBELN,
L_VBKOK LIKE VBKOK,
L_PROTT LIKE PROTT OCCURS 0 WITH HEADER LINE.
* carry out goods issue
L_VBKOK-VBELN_VL = L_VBELN.<-- fill this field with your delivery number
L_VBKOK-WABUC = 'X'.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
VBKOK_WA = L_VBKOK
SYNCHRON = 'X'
NO_MESSAGES_UPDATE = ' '
UPDATE_PICKING = 'X'
COMMIT = ' '
DELIVERY = L_VBELN
NICHT_SPERREN = 'X'
TABLES
PROT = L_PROTT
EXCEPTIONS
OTHERS = 0.
COMMIT WORK AND WAIT.
Please reward and close if it works.
Srinivas
‎2009 Oct 23 10:49 PM
‎2005 Oct 10 11:49 PM
hi srinivas
thanks for the code.it worked.i will take care of making it RFC enabled.
thanks once again
‎2007 Apr 19 9:19 PM
Hi,
I am creating a Delivery with GN_DELIVERY_CREATE...The delivery is created, but the picking quantity is still blank in the Delivery document. When I am using the 'WS_UPDATE_DELIVERY' with the above mentioned code..it is returning with an error message - 'Picking is not done for the line item'. The BAPI works if I update the pciking quantity manualy using VL02N. Is there a way I can directly do both the picking as well as the PGI with this BAPI. Am I missing any import parameters?
Thanks,
Ravi.
‎2007 Apr 30 8:47 AM
The picking qty can be specified in the vbpok table
please refer to the code given below
Populating the item data
lx_sales_item-ref_doc = l_vbeln.
lx_sales_item-ref_item = c_000010.
lx_sales_item-dlv_qty = fp_l_quantity.
lx_sales_item-sales_unit = fp_afpo-meins.
APPEND lx_sales_item TO li_sales_item.
Function Module to create delivery
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_SLS'
EXPORTING
ship_point = l_vstel
IMPORTING
delivery = fp_l_delivery
TABLES
sales_order_items = li_sales_item
return = li_return1.
IF fp_l_delivery IS INITIAL.
Error message Delivery not created
MESSAGE e049
ENDIF.
lx_vbkok-vbeln_vl = fp_l_delivery.
lx_vbkok-vbtyp_vl = c_vbtype_j .
lx_vbkok-vbeln = fp_l_delivery.
lx_vbkok-wabuc = c_wabuc_x.
lx_vbpok-vbeln_vl = fp_l_delivery.
lx_vbpok-posnr_vl = c_posnr.
lx_vbpok-vbeln = fp_l_delivery.
lx_vbpok-posnn = c_posnr.
lx_vbpok-matnr = fp_afpo-matnr.
lx_vbpok-charg = fp_afpo-charg.
lx_vbpok-werks = fp_afpo-dwerk.
lx_vbpok-taqui = c_wabuc_x.
lx_vbpok-pikmg = fp_l_quantity.
APPEND lx_vbpok TO li_vbpok.
Clearing the implicit lock that mb_create_goods_mvt has. That
prevents it from bieng called more then once within same LUW.
PERFORM clear_xcommit IN PROGRAM saplmbwl.
FM to perform picking,confirmation W-M status and PGI.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = lx_vbkok
synchron = c_xfeld_x
delivery = fp_l_delivery
update_picking = c_xfeld_x
nicht_sperren = c_no_sp_x
if_database_update = c_data_1
if_error_messages_send_0 = c_xfeld_x
TABLES
vbpok_tab = li_vbpok
prot = li_prott.
Checking if any error in PGI
READ TABLE li_prott WITH KEY MSGTY = c_e TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
MESSAGE e046 WITH fp_l_delivery.
ENDIF.
READ TABLE li_prott WITH KEY MSGTY = c_a TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
MESSAGE e046 WITH fp_l_delivery.
ENDIF.
‎2009 Oct 24 7:58 AM
Hi Bansal,
My quiry is suppose there is a batch splitting for a line item than is it works or we have to write some other code or use other Fm.
‎2019 Nov 13 10:24 PM
An other option is to use the FM 'SD_SHIPMENT_POST_GOODS_ISSUE'.
Regards.