Update Pick Quantity in the Outbound Delivery
Many already know, the FM to be used for this purpose is WS_DELIVERY_UPDATE_2. It comes with its own share of mysteries.
First, there is no picking quantity in the LIPS table, so we know picking quantity can not be just directly modified using BAPI_OUTB_DELIVERY_CHANGE. Here is a very simple code sample explaining how to use WS_DELIVERY_UPDATE_2.
ls_header-vbeln_vl = <deliverynumber>. ls_vbpok-vbeln_vl = <deliverynumber>. ls_vbpok-posnr_vl = <deliveryitem>. ls_vbpok-vbeln = <mostlydeliverynumber>. "Can be other reference document as well ls_vbpok-posnn = <relatedlineitem>. "If using delivery number, then use the same delivery item as before ls_vbpok-taqui = abap_true. ls_vbpok-lfimg = <quantity>. "It is good idea to provide the unit as well but not mandatory APPEND ls_vbpok TO lt_vbpok. REFRESH lt_return. CALL FUNCTION 'WS_DELIVERY_UPDATE_2' EXPORTING vbkok_wa = ls_header synchron = abap_true commit = abap_true delivery = <deliverynumber> update_picking = abap_true if_error_messages_send = '' TABLES vbpok_tab = lt_vbpok prot = lt_return.
Some pointers to note here:
- Picking quantity is not added to the previous picked quantity. So you need to do the calculation in your program logic.
- If you getting the error – “Picking request not yet confirmed” VL618 during PGI, then you may need to check the flag – TAQUI in VBPOK (item data). Please note, you may want to do this only when full picking for that line item is done.
- While using in the program, you may want to set the if_error_messages_send flag as “blank”. Otherwise, the program will stop if some error is encountered by the FM.
- No need of separate commit.
This function module can also be used for picking WM material (picking and packing). More about them later.
If you happen to like our content, spread the word. Follow us on LinkedIn and bookmark the blog!