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 change the storage location using BAPI_OUTB_DELIVERY_CHANGE

Firoz_Ashraf
Contributor
0 Kudos

Hi !

I want to do batch split in the delivery using BAPI_OUTB_DELIVERY_CHANGE.

Can anyone tell me how to pass/change the storage location of each batch item.

Is there any other BAPI that can do the batch split and populate the storage location also for the split batches?

Regards,

Firoz.

7 REPLIES 7

Former Member
0 Kudos

Hi,

Try this

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
HEADER_DATA = header_data
HEADER_CONTROL = header_control
DELIVERY = Delivery_Number
TABLES
ITEM_DATA = Item_data
ITEM_CONTROL = Item_control
RETURN = Return.

HEADER_DATA: Populate the header_data with delivery number. (Field DELIV_NUMB)

HEADER_CONTROL: Populate the header_control with delivery number. (Field DELIV_NUMB)

DELIVERY: Input delivery number directly

ITEM_DATA: Input the following parameters
Delivery Number (DELIV_NUMB) with LIPS-VBELN
Delivery Item number (DELIV_ITEM) with LIPS-POSNR
Material Number (MATERIAL) with LIPS-MATNR
Batch Number (BATCH) with batch number you have
Superior Hierarchy (HIERARITEM) with LIPS-POSNR
Hierarchy Item (USEHIERITM) with '1' always for Batch split
Actual quantity (DLV_QTY) with batch quantity
Actual quantity (DLV_QTY_IMUNIT) with batch quantity
Numerator (FACT_UNIT_NOM) with LIPS-UMVKZ
Denominator (FACT_UNIT_DENOM) with LIPS-UMVKN
Sales Unit (SALES_UNIT) with LIPS-VRKME

For Item details if one material has two batches, append the records with only difference in quantity and batch.

ITEM_CONTROL: Delivery Number (DELIV_NUMB) with LIPS-VBELN
Delivery Item (DELIV_ITEM) with LIPS-POSNR
Change del. quantity (CHG_DELQTY) with 'X'

Item control can have one record for one line item of delivery. Say if you have two batches for a single material, even then you can have one item.

Edited by: Raj on Jun 2, 2008 2:32 PM

Firoz_Ashraf
Contributor
0 Kudos

Hi Raj,

Thanks for your reply. This I am already doing and getting the result of batch split. But the main problem is that I want to change the storage location of these batches.

Please help me in changing the storage location. If this BAPI doesn't solves this then do let me know any other BAPI that does the batch split as well as Storage location change

Thanks,

Firoz

0 Kudos

Hi,

I also have the same problem. Updating the Storage location in Batch split delivery.

Could you tell me how you managed to do that?

Thanks in advance.

Hi all,

BAPI_OUTB_DELIVERY_CHANGE can be used to do batch split and updating storage loaction against each item of an outbond delivey.

I have done that in the folllowing way:

1 > Firstly i have updated the storage location for each delivery item using 'BAPI_OUTB_DELIVERY_CHANGE' passing some mininal parameters.

Fetch the item details from LIPS table based on the outbound delivery and pass the corresponding fields to item_data, item_control and item_data_spl parameters and passed into intenal table li_lips.

Loop at li_lips inti lw_lips.

lw_item_data-deliv_numb = lw_lips-vbeln.

lw_item_data-deliv_item = lw_lips-posnr.

lw_item_data-material = lw_lips-matnr.

lw_item_data-fact_unit_nom = lw_lips-umvkz.

lw_item_data-fact_unit_denom = lw_lips-umvkn.

lw_item_data-base_uom = lw_lips-meins.

lw_item_data-sales_unit = lw_lips-vrkme.

lw_item_control-deliv_numb = lw_lips-vbeln.

lw_item_control-deliv_item = lw_lips-posnr.

lw_item_data_spl-deliv_numb = lw_lips-vbeln.

lw_item_data_spl-deliv_item = lw_lips-posnr.

lw_item_data_spl-pick_denial = 'X'.

lw_item_data_spl-stge_loc = v_lgort.

"(This would be your Storage Location which you want to be updated)

  • Appending work areas into internal table to pass as parameter

APPEND lw_item_data_lgort TO li_item_data_lgort .

  • Appending work areas into internal table to pass as parameter

APPEND lw_item_control_lgort TO li_item_control_lgort.

  • Appending work areas into internal table to pass as parameter

APPEND lw_item_data_spl_lgort TO li_item_data_spl_lgort.

endloop.

  • Passing the delivery no in the work area of header data

lw_header_data-deliv_numb = v_delivery_no.

lw_header_control-deliv_numb = v_delivery_no.

lw_header_tech_control-upd_ind = 'U'.

  • Calling BAPI to change the Storage location

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

EXPORTING

header_data = lw_header_data

header_control = lw_header_control

delivery = v_delivery_no

techn_control = lw_header_tech_control

TABLES

item_data = li_item_data

item_control = li_item_control

return = li_return_change

item_data_spl = li_item_data_spl.

  • Calling BAPI to committ the task

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

2> Then i have used the same BAPI again 'BAPI_OUTB_DELIVERY_CHANGE' to do the batch split/update batch only(if required) and change the Actual Delivered Quantity.

Here you have to pass the same thing along with actual delivery qauntity and different batches to do batch split.

Here it is assumed that Batch numbers, actual delivered quantity are coming from an internal table i_lqua.

  • Looping through Internal table to get Bin details

LOOP AT i_lqua INTO w_lqua .

  • Clearing work area before use

CLEAR : lw_item_data, lw_lips, lw_item_control, lw_item_data_spl.

  • Reading table comparing metrial number

READ TABLE li_lips INTO lw_lips

WITH KEY matnr = w_lqua-matnr BINARY SEARCH.

  • If read is successful, passing values from table

IF sy-subrc EQ 0.

  • Passing the delivery details into Item level table

lw_item_data-deliv_numb = lw_lips-vbeln.

lw_item_data-deliv_item = lw_lips-posnr.

lw_item_data-material = lw_lips-matnr.

lw_item_data-batch = w_lqua-charg.

lw_item_data-dlv_qty = w_lqua-verme.

lw_item_data-dlv_qty_imunit = w_lqua-verme.

lw_item_data-base_uom = w_lqua-meins.

lw_item_data-hieraritem = lw_lips-posnr.

lw_item_data-usehieritm = 1.

lw_item_data-fact_unit_nom = lw_lips-umvkz.

lw_item_data-fact_unit_denom = lw_lips-umvkn.

lw_item_data-sales_unit = lw_lips-vrkme.

lw_item_control-deliv_numb = lw_lips-vbeln.

lw_item_control-deliv_item = lw_lips-posnr.

lw_item_control-chg_delqty = 'X'.

lw_item_data_spl-deliv_numb = lw_lips-vbeln.

lw_item_data_spl-deliv_item = lw_lips-posnr.

lw_item_data_spl-stge_loc = w_lqua-lgort.

lw_item_data_spl-pick_denial = 'X'

  • Appending work area into internal table to pass as parameter

APPEND lw_item_data TO li_item_data.

  • Appending work area into internal table to pass as parameter

APPEND lw_item_control TO li_item_control.

  • Appending work area into internal table to pass as parameter

APPEND lw_item_data_spl TO li_item_data_spl.

  • Clearing work areas after use

CLEAR : lw_item_data, w_lqua,lw_item_data_spl,lw_item_control,

lw_vbpok, lw_lips.

ENDIF.

ENDLOOP.

  • Passing the delivery no in the work area of header data

lw_header_data-deliv_numb = v_delivery_no.

lw_header_control-deliv_numb = v_delivery_no.

lw_header_tech_control-upd_ind = 'U'.

  • Calling BAPI to change the Batch/Batch-Split/Delivery Quantity

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

EXPORTING

header_data = lw_header_data

header_control = lw_header_control

delivery = v_delivery_no

techn_control = lw_header_tech_control

TABLES

item_data = li_item_data

item_control = li_item_control

return = li_return_change

item_data_spl = li_item_data_spl.

  • Calling BAPI to committ the task

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

This is the only way which i found as better way to do the Batch split and updating storage location togetherly.

I hope this code will help you.

Former Member
0 Kudos

HI.

This seems to be a very old thread. you must have already found the solution. In case u haven't, try using BAPI_GOODSMVT_CREATE to change the storage location of the batches.

Any idea about how to change the storage location of the DO.

My prob is once I have done the picking and changing the storage location of the batches, I need to change the storage location of the DO. Otherwise I am not able to do PGI.

Please share if any solution to this.

Thanks

Mou.

0 Kudos

Mou - were you able to solve the problem with the DO and PGI? and if so how?

Thanks

Dennis

0 Kudos

Hi Mou,

How did u change the storage locationn using BAPI_GOODSMVT_CREAT can u please share ?

Also I need to update the storage location of a outbound delivery and it may or may not have the batch split item record.

I have tried to update the Storage location using CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

but unable to update it.

I am on ECC 5.0 and i cant see the table  item_data_spl  in the 'BAPI_OUTB_DELIVERY_CHANGE'.

Please let me know do we need this table to change the Storage location ?

Do we have any other FM or BAPI to update it ?

Thanks
RItesh Solanki