Application Development 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 update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE_2

former_member486356
Participant
0 Kudos

Hi All.

I wanted to change the Batch manually from FM WS_DELIVERY_UPDATE_2 but the FM is not updating the batch in delivery. Could anyone has any idea what need to done for updating CHARG field in Delivery.

16 REPLIES 16

Nitish2027
Participant

You can update the batch by using the BADI : LE_SHP_DELIVERY_PROC. And then use the method SAVE_DOCUMENT_PREPARE.

Why would you need to use BAdI to update a batch during delivery creation when there is standard functionality of batch determination?

0 Kudos

The idea is to let the batch be determined automatically as per the customer logic instead of the standard SAP logic.

0 Kudos

Hi Nitesh.

I can't use BADI as I have to call an BAPi and FM to update BATCh and Pick quantity in my odata service . I wanted to know how we can update Batch from FM WS_DELIVERY_UPDATE_2

0 Kudos

I found a question that might help you: Update Batch Number and Picking Quantity

I also have used the FM WS_DELIVERY_UPDATE_2 to update picking quantity details in the past but have never used it for updating the batch number. With the information I see from the above link, yes, you should be able to update the batch number as well by using the FM WS_DELIVERY_UPDATE_2.

0 Kudos

Hi Nitish,

Let me try with the step mentioned in the link.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Alkma,

Odd requirement to say the least, but you can use this BADI which allows you to pass extra data using the EXTENSION1 & EXTENSION2 tables - 'SMOD_V50B0001'. Oh, and this is related to BAPI_OUTB_DELIVERY_CHANGE, which I would opt for over using the other FMs mentioned.

Regards,

Ryan Crosby

0 Kudos

The specific method is exit_saplv50i_010

venkateswaran_k
Active Contributor
0 Kudos

Hi alkma.khan

Is this batch not updated for some materials only and not updating for all materials.? If you can provide the code, it will help us

former_member486356
Participant
0 Kudos

Hi Venkateswarn ,

I am first trying with Standlone Fm WS_DELIVERY_UPDATE_2 to update batch in delivery and pick quantity. BAPI_OUT_DELIVERY_CHANGE will update batch but it don't have pick quantity field so I can't use this BAPI and thought to use FM WS_DELIVERY_UPDATE_2 which has both the field.

former_member486356
Participant
0 Kudos

Hi Ryan,

I am not sure will this will work for fm used in ODATA service . Is this can be used if I wanted to use FM in Odata crud method?

Ryan-Crosby
Active Contributor
0 Kudos

Hi Alkma,

I cannot say because I'm not sure what you are using for an OData service.

venkateswaran_k
Active Contributor
0 Kudos

Hi alkma.khan

Try this FM WS_DELIVERY_UPDATE.. ( not WS_DELIVERY_UPDATE_2 ).. For me it was working.

former_member486356
Participant
0 Kudos

Hi Venkateswaran,

Could you please share what all the filled you have set in FM to change batch. I have to change pick quanity and batch both and do PGI.

venkateswaran_k
Active Contributor
0 Kudos

Try this example

          LOOP AT it_lips_del INTO wa_lips_del.
            CLEAR: wa_item.
            wa_item-deliv_numb     = l_vbeln.
            wa_item-deliv_item     = wa_lips_del-posnr.
            wa_item-material       = wa_lips_del-matnr.
            wa_item-batch           = wa_lips_del-charg.
            wa_item-fact_unit_nom   = 1.
            wa_item-fact_unit_denom = 1.
            APPEND wa_item TO it_item.

            CLEAR: wa_item_ctr.
            wa_item_ctr-deliv_numb   = l_vbeln.
            wa_item_ctr-deliv_item   = wa_lips_del-posnr.
            wa_item_ctr-del_item     = 'X'.
            APPEND wa_item_ctr TO it_item_ctr.
          ENDLOOP.

          REFRESH: it_ret2.
          CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
            EXPORTING
              header_data    = wa_header
              header_control = wa_header_ctr
              delivery       = l_vbeln
            TABLES
              item_data      = it_item
              item_control   = it_item_ctr
              return         = it_ret2.

          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.

Regards,

Venkat

former_member486356
Participant
0 Kudos

Hi Venkat,

I have to update Pick quanity and batch both that is why I am trying with WS_DELIVERY_UPDATE_2. This Bapi will only change batch there is no field for pick quantity.