Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an item ( batch ) to delivery with 'WS_DELIVERY_UPDATE_2' ?

BergOff
Explorer
0 Kudos
170

Hi, experts.
How to add an item to delivery using  'WS_DELIVERY_UPDATE_2' ?
I found only how to delete, but don't understand how to add a new one.

 

 

     vbpok_ls-vbeln_vl = ls_delivery_item-vbeln.
     vbpok_ls-posnr_vl = ls_delivery_item-posnr.
     vbpok_ls-lips_del = 'X'.
     APPEND vbpok_ls TO vbpok_lt.


   vbpok_ls-vbeln_vl = ls_delivery_item-vbeln.
   vbpok_ls-posnr_vl = '000040'..
   vbpok_ls-matnr = '4101-80020-00299'.
   vbpok_ls-charg = '0017475744'.
   vbpok_ls-lfimg = 8.
   APPEND vbpok_ls TO vbpok_lt.

call function 'WS_DELIVERY_UPDATE_2'
  exporting
    VBKOK_WA                           = vbkok_ls
    COMMIT                             = 'X'
    DELIVERY                           = ps_expand-vbeln
    UPDATE_PICKING                     = 'X'
    NICHT_SPERREN_1                    = 'X'
    IF_DATABASE_UPDATE_1               = '1'
 IMPORTING
    EF_ERROR_ANY                       = ef_error_any
    EF_ERROR_IN_ITEM_DELETION          = ef_error_in_item_deletion
    EF_ERROR_IN_POD_UPDATE             = ef_error_in_pod_update
    EF_ERROR_IN_INTERFACE              = ef_error_in_interface
    EF_ERROR_IN_GOODS_ISSUE            = ef_error_in_goods_issue
    EF_ERROR_IN_FINAL_CHECK            = ef_error_in_final_check
    EF_ERROR_PARTNER_UPDATE            = ef_error_partner_update
    EF_ERROR_SERNR_UPDATE              = ef_error_sernr_update
 TABLES
    VBPOK_TAB                          = vbpok_lt
    PROT                               = prot_lt
 EXCEPTIONS
    error_message             = 1
    OTHERS                    = 2.

 

 

 

1 REPLY 1

DominikTylczyn
SAP Champion
SAP Champion
0 Kudos
120

Hello @BergOff 

I can't answer you question directly as WS_DELIVERY_UPDATE_2 is not documented. As it is really by trial and error you can figure out the correct way to call the function. 

But there is a indirect approach via Delivery Interface i.e. WHSCON IDoc. As per SAP Help the IDoc can report batch split items:

DominikTylczyn_0-1741897916191.png

You can build a test WHSCON IDoc in WE19 and verify that it updates a delivery the way you want. The IDocs are posted with the WS_DELIVERY_UPDATE_2 function. So you can put a breakpoint in the function and check how the IDoc data are communicated to the function. This will show you have to call the function to add a deliver split item.

Best regards

Dominik Tylczynski