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: 

Picking (Split Batches) using WS_DELIVERY_UPDATE_2 / WS_DELIVERY_UPDATE

Former Member
0 Kudos

I want to update picking for a delivery order with splitting batches. The quantity is getting picked but the batches are not getting updated. Following is the code that I have been using. Can anyone please tell what am I missing here?

DATA: wa_vbkok TYPE vbkok,

it_vbpok TYPE STANDARD TABLE OF vbpok,

wa_vbpok TYPE vbpok,

it_prott TYPE STANDARD TABLE OF prott.

wa_vbkok-vbeln_vl = '80000244'. "DO

wa_vbkok-vbeln = '80000244'.

wa_vbkok-komue = 'X'. "To overwrite pick qty automatically into DO Qty

wa_vbpok-vbeln_vl = '80000244'.

wa_vbpok-posnr_vl = '000010'.

wa_vbpok-vbeln = '80000244'.

wa_vbpok-posnn = '000010'.

wa_vbpok-matnr = '11000021'.

wa_vbpok-charg = '0000389'. "1st Batch

wa_vbpok-werks = 'INDO'.

wa_vbpok-lianp = 'X'. "To change delivery QTy same as Pick Qty

wa_vbpok-pikmg = '1.620'. "Quantity in 1st Batch.

APPEND wa_vbpok TO it_vbpok.

wa_vbpok-vbeln_vl = '80000244'.

wa_vbpok-posnr_vl = '000010'.

wa_vbpok-vbeln = '80000244'.

wa_vbpok-posnn = '000010'.

wa_vbpok-matnr = '11000021'.

wa_vbpok-charg = '0000390'. "2nd Batch

wa_vbpok-werks = 'INDO'.

wa_vbpok-lianp = 'X'. "To change delivery QTy same as Pick Qty

wa_vbpok-pikmg = '1.610'. "Quantity in 2nd Batch.

APPEND wa_vbpok TO it_vbpok.

wa_vbpok-vbeln_vl = '80000244'.

wa_vbpok-posnr_vl = '000010'.

wa_vbpok-vbeln = '80000244'.

wa_vbpok-posnn = '000010'.

wa_vbpok-matnr = '11000021'.

wa_vbpok-charg = '0000392'. "3rd Batch

wa_vbpok-werks = 'INDO'.

wa_vbpok-lianp = 'X'. "To change delivery QTy same as Pick Qty

wa_vbpok-pikmg = '1.630'. "Quantity in 3rd Batch.

APPEND wa_vbpok TO it_vbpok.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'

EXPORTING

vbkok_wa = wa_vbkok

synchron = 'X'

  • NO_MESSAGES_UPDATE_1 = ' '

commit = 'X'

delivery = '80000244'

update_picking = 'X'

TABLES

vbpok_tab = it_vbpok

prot = it_prott

.

The DO Qty was 5.000. While picking I want it to change to 4.860, i.e, the sum all the batch quantities. But with this code, the picked qty and the Do qty are changed to the quantity of the last batch in the internal table (in this case the 3rd batch). Also none of the batches are assigned to the DO.

Could anybody point out where am I going wrong?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please change your parameters as follows:

wa_vbpok-vbeln_vl = '80000244'.

wa_vbpok-posnr_vl = '000010'.

wa_vbpok-vbeln = '80000244'.

wa_vbpok-posnn = '900001'. -


> Change

wa_vbpok-matnr = '11000021'.

wa_vbpok-charg = '0000389'. "1st Batch

wa_vbpok-werks = 'INDO'.

wa_vbpok-lianp = 'X'. "To change delivery QTy same as Pick Qty

wa_vbpok-lfimg = '1.620'. "Quantity in 1st Batch. -


> Change

wa_vbpok-orpos = '000010'. -


> Change

wa_vbpok-wms_rfpos = '000010'. -


> Change

If you want your total picked qty = delivered qty then you have to fill "force_orpos_reduction" = "X" (optional)

APPEND wa_vbpok TO it_vbpok.

For second line item use posnn = 900002 and for third use 900003. This number range depends upon your setting. Check a manual batch split in your system, if the number range in 900010, 900020 then use accordingly.

Cheers,

11 REPLIES 11

Former Member
0 Kudos

Hi,

Please change your parameters as follows:

wa_vbpok-vbeln_vl = '80000244'.

wa_vbpok-posnr_vl = '000010'.

wa_vbpok-vbeln = '80000244'.

wa_vbpok-posnn = '900001'. -


> Change

wa_vbpok-matnr = '11000021'.

wa_vbpok-charg = '0000389'. "1st Batch

wa_vbpok-werks = 'INDO'.

wa_vbpok-lianp = 'X'. "To change delivery QTy same as Pick Qty

wa_vbpok-lfimg = '1.620'. "Quantity in 1st Batch. -


> Change

wa_vbpok-orpos = '000010'. -


> Change

wa_vbpok-wms_rfpos = '000010'. -


> Change

If you want your total picked qty = delivered qty then you have to fill "force_orpos_reduction" = "X" (optional)

APPEND wa_vbpok TO it_vbpok.

For second line item use posnn = 900002 and for third use 900003. This number range depends upon your setting. Check a manual batch split in your system, if the number range in 900010, 900020 then use accordingly.

Cheers,

0 Kudos

I passed every thing but still no post issue.... Please help...

Thanks,

Satya

0 Kudos

I also passed every thing Still i got error... "picked quantity is larger than delivery quantity in case of batch split... "

because in case of batch split we passed pikmg in 900001 line item and so on but when we execute this bapi i got this error and put picked qty on 000010 line item... it doesn't expand line item 900001, 900002 and so on..

Hi all,

My problem has been solved..

Only you need to do for picking qty in case of batch split is.

this is the line item pick from lips... in batch split case.

SELECT * FROM lips INTO TABLE @data(it_lips) WHERE vbeln = @lv_delivery.
* SORT IT_LIPS BY posnr.
LOOP at it_lips INTO data(wa_lips).

wa_vbpok-vbeln_vl = wa_lips-vbeln.
wa_vbpok-posnr_vl = wa_lips-posnr.
wa_vbpok-vbeln = wa_lips-vbeln.
wa_vbpok-posnn = wa_lips-posnr.
wa_vbpok-mdiff_auto_split = 'X'.
wa_vbpok-matnr = wa_lips-matnr.
WA_VBPOK-charg = wa_lips-charg.


IF WA_LIPS-lfimg IS NOT INITIAL.
wa_vbpok-lfimg = 1. "*// delivered qty you can use lfimg of lips
wa_vbpok-pikmg = 1. "*// this is picking qty you can put here (in my case both are same)
wa_vbpok-lianp = 'X'.
ENDIF.

APPEND wa_vbpok TO it_vbpok_pick.
CLEAR: wa_vbpok.

CLEAR : wa_lips.
ENDLOOP.

ls_vbkok-vbeln_vl = lv_delivery.
ls_vbkok-vbtyp_vl = 'J'.
ls_vbkok-wabuc = 'X'.
ls_vbkok-vbeln = lv_delivery.
ls_vbkok-kodat = sy-datum.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
EXPORTING
vbkok_wa = ls_vbkok
synchron = 'X'
delivery = lv_delivery // delivery no.
update_picking = 'X'
nicht_sperren_1 = 'X'
if_error_messages_send = ' '
TABLES
VBPOK_TAB = it_vbpok_pick[]
prot = lt_prott .

IF WM is not active you can use this code nothing will change...Other wise in case of WM you have to create Transfer order first after that use this FM with more parameters in vbpok table..


Former Member
0 Kudos

Hi Himanshu,

Thanks.

Now the picked qty and the DO qty are updating properly i.e, the sum of all the quantities in the batches, but the batches are not assigned to the DO line item.

When I check in VL02N, I still do not see any batches.

Please help.

0 Kudos

Hi,

Select the line item and click on batch split in the bottom. You should be able to see the batch data.

Cheers,

0 Kudos

HI Himanshu,

I checked already. Batches are not being assigned. I checked in table LIPS. Nothing there as well.

Do you think I should pass IT_VBPOK_SPLIT to the FM?

I tried but it didnt seem to work. Maybe I am passing wrong values to it.

Thanks,

Mou

0 Kudos

Hi,

Can you please try populating VFDAT as well with the shelf life expiry dates of your batches. Thats the only difference now between your example and my test case.

I dont think there is any need to use "split' table.

Thanks,

Former Member
0 Kudos

Hi Himanshu,

This FM alone did not work for me... I finally had to use BAPI_OUTB_DELIVERY_CHANGE for batch split and then WS_DELIVERY_UPDATE_2 for picking.

Thanks

Hi Former Member,

I have the same requirement. When I am using bapi 'BAPI_OUTB_DELIVERY_CHANGE', it is overwriting the delivery quantity. which should not happen. Could you share the inputs how you did you handled this.

Thank you,

Rajesh

0 Kudos

Hi himanshu Please share your code for this bapi WS_DELIVERY_UPDATE_2. Still i got an error.