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: 
Read only

BAPI_OUTB_DELIVERY_CHANGE conversion change problem

0 Likes
6,856

Hi experts,

I am using BAPI_OUTB_DELIVERY_CHANGE to batch split. every thing is working fine. but BAPI is also changing the conversion at picking tab

at line item of a delivery that I do not want to change.

for example : if we double click on line item of a delivery then it shows many tabs one of them is 'Picking'

at this tab there is a label conversion . in front of this label there are four fields with valve 1 BOX <-> 20 ST.

after execution of BAPI the new value looks like 1 BOX <--> 1 ST.

I wants that BAPI do not change these values. please suggest how to use it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,947

Hi Ravinder,

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.

6 REPLIES 6
Read only

FabioPagoti
Active Contributor
0 Likes
4,947

Could you please provide the code you are using and tell where you are using it (report, enhancement)?
It's very important to know which parameters you are passing to a BAPI to understand its behavior.

Thanks,

Read only

0 Likes
4,947

Thanks Fabio for your reply,

Below is my code.

Read only

0 Likes
4,947

Hi

Hide below Two Line from your Code , then Check Once ..

Regard's

Smruti

Read only

0 Likes
4,947

Hi Smruti,

I tried your suggestion. but it showing error at BAPI execution.

ERROR: Error in document 'DN No.' item 000000 (quantity consistency check)

Read only

Former Member
0 Likes
4,948

Hi Ravinder,

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.

Read only

0 Likes
4,947

Hi Ali,

Thanks for you support.

I found the solution changing  the code as below.

selected the delivery item from lips table

then did the below alteration to the code.

Thanks