Help in BAPI_OUTB_DELIVERY_CHANGE

Hi
i try to change the quantity for a distributed quantity
The code :
*Local data --> Start
  DATA: LWA_HEADER_DATA LIKE  BAPIOBDLVHDRCHG,
        LWA_HEADER_CONTROL LIKE  BAPIOBDLVHDRCTRLCHG,
        LT_ITEM_DATA LIKE TABLE OF BAPIOBDLVITEMCHG,
        LWA_ITEM_DATA LIKE LINE OF LT_ITEM_DATA,
        LV_OLD_DELIV LIKE GWA_SD_DOCUMENT-VBELN,
        LV_NEW_DELIV LIKE GWA_SD_DOCUMENT-VBELN,
        LV_OLD_MATNR LIKE GWA_SD_DOCUMENT-MATNR,
        LV_NEW_MATNR LIKE GWA_SD_DOCUMENT-MATNR,
        LV_OLD_SHIP LIKE GWA_SD_DOCUMENT-TKNUM,
        LWA_TECHN LIKE BAPIDLVCONTROL,
        LT_ITEM_CONTROL LIKE TABLE OF BAPIOBDLVITEMCTRLCHG,
        LWA_ITEM_CONTROL LIKE LINE OF LT_ITEM_CONTROL,
        LV_NEW_SHIP LIKE GWA_SD_DOCUMENT-TKNUM,
        LT_RETURN LIKE TABLE OF BAPIRET2.
*Local data --> End
  LWA_TECHN-UPD_IND = GC_DEFAULT.
  LOOP AT GT_SD_DOCUMENT INTO GWA_SD_DOCUMENT.
      LWA_ITEM_DATA-DELIV_NUMB = GWA_SD_DOCUMENT-VBELN.
      LWA_ITEM_DATA-DELIV_ITEM = GWA_SD_DOCUMENT-POSNR.
      LWA_ITEM_DATA-MATERIAL = GWA_SD_DOCUMENT-MATNR.
      LWA_ITEM_DATA-DLV_QTY = GWA_SD_DOCUMENT-LFIMG_R.
      LWA_ITEM_DATA-DLV_QTY_IMUNIT = GWA_SD_DOCUMENT-LFIMG_R.
      LWA_ITEM_DATA-SALES_UNIT = GWA_SD_DOCUMENT-VRKME.
      LWA_ITEM_DATA-BASE_UOM   = GWA_SD_DOCUMENT-MEINS.
      APPEND LWA_ITEM_DATA TO LT_ITEM_DATA.
      LWA_ITEM_CONTROL-DELIV_NUMB = GWA_SD_DOCUMENT-VBELN.
      LWA_ITEM_CONTROL-DELIV_ITEM = GWA_SD_DOCUMENT-POSNR.
      LWA_ITEM_CONTROL-CHG_DELQTY = GC_DEFAULT.
      APPEND LWA_ITEM_CONTROL TO LT_ITEM_CONTROL.
      CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
        EXPORTING
          HEADER_DATA    = LWA_HEADER_DATA
          HEADER_CONTROL = LWA_HEADER_CONTROL
          DELIVERY       = LV_OLD_DELIV
        TABLES
          ITEM_DATA      = LT_ITEM_DATA
          ITEM_CONTROL   = LT_ITEM_CONTROL
          RETURN         = LT_RETURN.
   ENDLOOP.
I get message "Error in document &1 item &2 (quantity consistency check)"
What is the problem?
Thanks

Hi,
BAPI_OUTB_DELIVERY_CHANGE
Regards
Sudheer

Similar Messages

  • How to Use BAPI_OUTB_DELIVERY_CHANGE for Batch Split

    Hi Experts, I have the follow delivery:
    Item        Material   Deliv.Qty    Un
    10     739911     2     PQT
    And I want to obtain this:
    Item        Material   Deliv.Qty    Un                            Batch
    10     739911     0     PQT
    900001     739911     1     PQT          ZZ00060
    900002     739911     1     PQT          ZZ00061
    But, after using the Bapi I obtained this:
    Item        Material   Deliv.Qty    Un                            Batch
    10     739911     1,372     PQT
    900001     739911     0,314     PQT          ZZ00060
    900002     739911     0,314     PQT          ZZ00061
    So as you can see the problem is with the "Deliv.Qty". I expected:
    Item        Deliv.Qty
    10            0
    900001     1     
    900002     1     
    But I obtained:
    Item        Deliv.Qty
    10     1,372
    900001     0,314
    900002     0,314
    The parameters that I am using in the Bapi are:
    HEADER_DATA                                   
    DELIV_NUMB = 801174646
    HEADER_CONTROL                                
    DELIV_NUMB = 801174646
    DELIVERY = 801174646
    TECHN_CONTROL
    UPD_IND = U
    ITEM_DATA (three records):   
    DELIV_NUMB = 801174646
    DELIV_ITEM = 000010  
    MATERIAL = 739911  
    FACT_UNIT_NOM = 1   
    FACT_UNIT_DENOM = 1   
    DELIV_NUMB = 801174646  
    DELIV_ITEM = 900001     
    MATERIAL = 739911     
    BATCH = ZZ00060    
    HIERARITEM = 000010     
    USEHIERITM = 1          
    DLV_QTY = 1
    DLV_QTY_IMUNIT = 1
    FACT_UNIT_NOM = 1      
    FACT_UNIT_DENOM = 1      
    DELIV_NUMB = 801174646  
    DELIV_ITEM = 900002     
    MATERIAL = 739911     
    BATCH = ZZ00061    
    HIERARITEM = 000010     
    USEHIERITM = 1          
    DLV_QTY = 1
    DLV_QTY_IMUNIT = 1
    FACT_UNIT_NOM = 1      
    FACT_UNIT_DENOM = 1
    ITEM_CONTROL (three records):
    DELIV_NUMB = 801174646
    DELIV_ITEM = 000010  
    CHG_DELQTY = X
    DELIV_NUMB = 801174646
    DELIV_ITEM = 900001  
    CHG_DELQTY = X
    DELIV_NUMB = 801174646
    DELIV_ITEM = 900002  
    CHG_DELQTY = X
    So I am missing something but I don't know what.
    Can any one help me with this please?
    PD: I have looked the following forums in order to use the Bapi:
    How to Use BAPI_OUTB_DELIVERY_CHANGE for Batch Split
    batch split using BAPI_OUTB_DELIVERY_CHANGE
    Re: Help in BAPI_OUTB_DELIVERY_CHANGE(batch-split)
    BAPI_OUTB_DELIVERY_CHANGE - Batch Splits don't work
    Help for BAPI_OUTB_DELIVERY_CHANGE

    Hey,
    My code is for the inbound delivery but it should work the same.
    Give this a try.
    REPORT  z_delivery_batch_split.
    DATA:header_data  LIKE  bapiibdlvhdrchg,
    header_control  LIKE  bapiibdlvhdrctrlchg,
    delivery  LIKE  bapiibdlvhdrchg-deliv_numb,
    ls_return LIKE bapiret2,
    item_data  TYPE TABLE OF  bapiibdlvitemchg,
    item_control  TYPE TABLE OF bapiibdlvitemctrlchg,
    ls_item_data  LIKE  bapiibdlvitemchg,
    ls_item_control LIKE  bapiibdlvitemctrlchg,
    return TYPE TABLE OF bapiret2 WITH NON-UNIQUE KEY type.
    header_data-deliv_numb = '1800005005'.
    header_control-deliv_numb = '1800005005'.
    delivery = '1800005005'.
    ls_item_data-deliv_numb = '1800005005'.
    ls_item_data-deliv_item = '900001'.
    ls_item_data-material = '000000000020067722'.
    PERFORM create_batch CHANGING ls_item_data-batch.
    ls_item_data-hieraritem = '000010'.
    ls_item_data-usehieritm = '1'.
    ls_item_data-dlv_qty = 80.
    ls_item_data-dlv_qty_imunit = 80.
    ls_item_data-fact_unit_nom = '1'.
    ls_item_data-fact_unit_denom = '1'.
    ls_item_data-sales_unit = 'EA'.
    ls_item_data-base_uom = 'EA'.
    APPEND ls_item_data TO item_data.
    ls_item_data-deliv_numb = '1800005005'.
    ls_item_data-deliv_item = '900002'.
    ls_item_data-material = '000000000020067722'.
    PERFORM create_batch CHANGING ls_item_data-batch.
    ls_item_data-hieraritem = '000010'.
    ls_item_data-usehieritm = '1'.
    ls_item_data-dlv_qty = 60.
    ls_item_data-dlv_qty_imunit = 60.
    ls_item_data-fact_unit_nom = '1'.
    ls_item_data-fact_unit_denom = '1'.
    ls_item_data-sales_unit = 'EA'.
    ls_item_data-base_uom = 'EA'.
    APPEND ls_item_data TO item_data.
    ls_item_control-deliv_numb = '1800005005'.
    ls_item_control-deliv_item = '900001'.
    ls_item_control-chg_delqty = 'X'.
    APPEND ls_item_control TO item_control.
    ls_item_control-deliv_numb = '1800005005'.
    ls_item_control-deliv_item = '900002'.
    ls_item_control-chg_delqty = 'X'.
    APPEND ls_item_control TO item_control.
    break cgavin.
    CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
       EXPORTING
         header_data          = header_data
         header_control       = header_control
         delivery             = delivery
    *   TECHN_CONTROL        = TECHN_CONTROL
       TABLES
    *   HEADER_PARTNER       = HEADER_PARTNER
    *   HEADER_PARTNER_ADDR  = HEADER_PARTNER_ADDR
    *   HEADER_DEADLINES     = HEADER_DEADLINES
         item_data            = item_data
         item_control         = item_control
    *   ITEM_SERIAL_NO       = ITEM_SERIAL_NO
    *   EXTENSION1           = EXTENSION1
    *   EXTENSION2           = EXTENSION2
         return               = return
    *   TOKENREFERENCE       = TOKENREFERENCE
    *   HANDLING_UNIT_HEADER = HANDLING_UNIT_HEADER
    *   HANDLING_UNIT_ITEM   = HANDLING_UNIT_ITEM
    *   PARTIAL_GR_OBJECTS   =          PARTIAL_GR_OBJECTS
    READ TABLE return
    INTO ls_return
    WITH TABLE KEY type = 'E'.
    IF sy-subrc = 0.
       MESSAGE ID ls_return-id TYPE ls_return-type NUMBER ls_return-number WITH ls_return-message_v1 ls_return-message_v2
       ls_return-message_v3 ls_return-message_v4.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait          = 'X'.
    break cgavin.
    *&      Form  CREATE_BATCH
    *       text
    *      <--P_LS_ITEM_DATA_BATCH  text
    FORM create_batch  CHANGING p_ls_item_data_batch.
       DATA: ls_bncom TYPE bncom.
       ls_bncom-matnr = ls_item_data-material.
       ls_bncom-werks = 'C333'.
       ls_bncom-lgort = '3000'.
       SELECT SINGLE mtart
         FROM mara
         INTO ls_bncom-mtart
         WHERE matnr = ls_bncom-matnr.
       CALL FUNCTION 'VB_NEXT_BATCH_NUMBER'
         EXPORTING
           matnr                          = ls_bncom-matnr
           werks                          = ls_bncom-werks
           check_batch                    = 'X'
           check_material                 = ''
           message_when_auto              = ' '
           x_bncom                        = ls_bncom
           lock_batch                     = ' '
         IMPORTING
           new_charg                      = p_ls_item_data_batch
         EXCEPTIONS
           no_material                    = 1
           no_plant                       = 2
           material_not_found             = 3
           plant_not_found                = 4
           no_batch_handling              = 5
           batch_exist                    = 6
           no_number                      = 7
           illegal_batch_number           = 8
           interval_not_found             = 9
           object_not_found               = 10
           interval_overflow              = 11
           error_automatic_batch_number   = 12
           cancelled                      = 13
           automatic_batch_num_not_active = 14
           OTHERS                         = 15.
       IF sy-subrc = 0.
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             wait = 'X'.
       ENDIF.
    ENDFORM.                    " CREATE_BATCH

  • Help in bapi bapi_outb_delivery_change

    Hi
    i want to use extension in the bapi bapi_outb_delivery_change
    but i don't unserdatns how to do it.
    Maybe you can send me an example how to do it!!!!
    Thanks
    Have a nice day

    Hi,
    BAPI_OUTB_DELIVERY_CHANGE
    Regards
    Sudheer

  • Not able to delete line items using BAPI_OUTB_DELIVERY_CHANGE

    Hi,
        Not able to delete line items of a delivery using BAPI 'BAPI_OUTB_DELIVERY_CHANGE', with thte below code and even return parameter has zero messages.
    I have even checked existing below posting.
    https://www.sdn.sap.com/irj/scn/logon?redirect=http%3a%2f%2fforums.sdn.sap.com%2fthread.jspa%3fthreadid%3d782509
    Below is the code that i am using.........
    *wa1-deliv_numb = wa_lips-vbeln.
    wa1-deliv_item = wa_lips-posnr.
    APPEND wa1 to item_data.
    wa-deliv_numb = vbeln_so .
    wa-deliv_item = l_item.
    wa-del_item = 'X'.
    APPEND wa TO item_control.
    w_header_data-deliv_numb = vbeln_so .
    w_header_control-deliv_numb = vbeln_so .
    w_delivery = vbeln_so .
    *w_header_control-dlv_del = 'X'. "Delete whole Delivery
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
      EXPORTING
        header_data    = w_header_data
        header_control = w_header_control
        delivery       = w_delivery
      TABLES
       item_data      = item_data
        item_control   = item_control
        return         = return.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    I have even  tried uncommenting item_data parameter but not able to delete line item.....i am able to delete whole delivery but not line items .........can any one of u help me in resolving this issiue plz ???
    Regards,
    M, Manohar

    Kindly use WS_DELIVERY_UPDATE to delete the items
    Sample code:
    L_VBKOK-VBELN_VL = vbeln_so.
    clear l_vbpok.
             refresh l_vbpok.
             l_vbpok-vbeln_vl = vbeln_so
             l_vbpok-posnr_vl = wa_deliv_item.
             l_vbpok-lips_del = c_x.
             append l_vbpok.
             set update task local.
             call function 'WS_DELIVERY_UPDATE'
               exporting
                 vbkok_wa = l_vbkok
                 commit   = ' '
                 delivery = lv_delivery
               tables
                 vbpok_tab = l_vbpok
               exceptions
                 others   = 0.
             commit work and wait.

  • Please help!! update fields of delivery order by using BAPI.

    hi, any one can help me to update the fields of a delivery order.
    the fields in the delevery order are : Batch no. quantity. and Stock location.
    i cannot use any BDC to do that, BAPI is prefered in that report.
    batch number and quantity are easy to find in any BAPI,  but stock loc can not change from BAPI...
    i have tried BAPI_OUTB_DELIVERY_SAVEREPLICA , but it always give me errors. (VL 564 and VL 295. but i definitly gave the delevery type)
    so, is anyone can give me a better bapi?or give me a instance for using BAPI_OUTB_DELIVERY_SAVEREPLICA.
    thanks a lot.
    Chris

    Try:
    BAPI_INB_DELIVERY_CHANGE
    BAPI_OUTB_DELIVERY_CHANGE
    Rob

  • Some quetions about BAPI_OUTB_DELIVERY_CHANGE.

    HI~all.
       I change serial number in a outbound delivery use this bapi,
    but have  a question which it will create a new Object list number when i run this bapi at a time ,you can find them from SER01 TABLE,what's happend?PLZ tell me if you know the problem ,thank you very much ~
    following is my code.
    *& Report  ZDN_MOD
    REPORT  ZDN_MOD.
    DATA:BEGIN OF it_lips OCCURS 1,
               vbeln LIKE lips-vbeln,
               posnr LIKE lips-posnr,
               matnr LIKE lips-matnr,
               werks LIKE lips-werks,
               lfimg LIKE lips-lfimg,
               umvkz LIKE lips-umvkz,
               umvkn LIKE lips-umvkn,
         END OF it_lips.
    DATA:IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE.
    data:l_OBKNR like SER01-OBKNR.
    DATA:  v_delivery  LIKE bapiobdlvhdrchg-deliv_numb,
           wa_header   LIKE bapiobdlvhdrchg,
           wa_header_x LIKE bapiobdlvhdrctrlchg,
           WA_TECHN   LIKE BAPIDLVCONTROL,
           it_return   LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
           it_item     LIKE bapiobdlvitemchg OCCURS 0 WITH HEADER LINE,
           it_item_x   LIKE bapiobdlvitemctrlchg OCCURS 0 WITH HEADER LINE,
           it_spl      LIKE /spe/bapiobdlvitemchg OCCURS 0 WITH HEADER LINE,
           it_SER_NO like BAPIDLVITMSERNO OCCURS 0 WITH HEADER LINE,"&#24207;&#21015;&#21495;&#20869;&#34920;
           d_vbeln like likp-vbeln,
           msgtxt(100) type c .
    data:it_CWM_ITEM_DATA LIKE /CWM/BAPIOBDLVITEM OCCURS 0 WITH HEADER LINE.
    SELECT SINGLE OBKNR INTO L_OBKNR FROM SER01 WHERE LIEF_NR = '0080000040' AND POSNR = '000010'.
    select * from OBJK into table it_OBJK where OBKNR = l_OBKNR.
    D_VBELN = '0080000040'.
    wa_header-deliv_numb = d_vbeln.
    wa_header_x-deliv_numb = d_vbeln.
    *wa_header_x-SIMULATE    = 'X'.
    v_delivery = D_VBELN.
    WA_TECHN-UPD_IND = 'X'.
    SELECT vbeln posnr matnr werks lfimg umvkz umvkn into
           TABLE it_lips FROM lips
         WHERE vbeln = d_vbeln
         AND   POSNR = '000010'.
    LOOP AT it_lips.
      it_item-deliv_numb = it_lips-vbeln.
      it_item-deliv_item = it_lips-posnr.
      it_item-material   = it_lips-matnr.
      it_item-dlv_qty    = it_lips-lfimg.
      it_item-fact_unit_nom = it_lips-umvkz.
      it_item-fact_unit_denom = it_lips-umvkn.
      it_item-CONV_FACT = '1'.
      it_item-SALES_UNIT = 'SET'.
      APPEND it_item. CLEAR it_item.
      loop at it_OBJK.
        it_SER_NO-DELIV_NUMB = it_lips-vbeln.
        it_SER_NO-ITM_NUMBER = it_lips-posnr.
        it_SER_NO-SERIALNO   = it_OBJK-EQUNR.
        APPEND it_SER_NO.
      endloop.
      it_item_x-deliv_numb = it_lips-vbeln.
      it_item_x-deliv_item = it_lips-posnr.
      it_item_x-CHG_DELQTY  = 'X'.
      APPEND    it_item_x .CLEAR    it_item_x.
    ENDLOOP.
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
      EXPORTING
        header_data    = wa_header
        header_control = wa_header_x
        delivery       = v_delivery
        TECHN_CONTROL  = WA_TECHN
      TABLES
        item_data      = it_item
        item_control   = it_item_x
        ITEM_SERIAL_NO = it_SER_NO
        return         = it_return
        item_data_spl  = it_spl.
    READ TABLE it_return WITH KEY type = 'E'.
    BREAK IBM-ZHANGDQ.
    IF sy-subrc NE 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ELSE.
      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          id        = it_return-id
          lang      = '-D'
          no        = it_return-number
          v1        = it_return-message_v1
          v2        = it_return-message_v2
          v3        = it_return-message_v3
          v4        = it_return-message_v4
        IMPORTING
          msg       = msgtxt
        EXCEPTIONS
          not_found = 1
          OTHERS    = 2.
      WRITE:msgtxt.
    ENDIF.
    FREE:it_return,it_spl,it_item,it_item_x.
    CLEAR:it_return,it_spl,it_item,it_item_x,wa_header,
          wa_header_x,v_delivery.

    Hello Srinivas
    I am still on this and felt I must continue updating this message thread so that someone with a similar requirement can get a complete picture of what the possibilities are and benefit from it.
    I am trying out your suggested solution but am unsure of the FM which needs to be attached to the event tcode with the LIKP event CHANGED. That is one area I will need your feedback and help. Might be very helpful if I had your case scenario too and the FM code to see if it can be reused.
    Also I didn't understand the reason for the new field flag?
      xlips-zfield = 'X'.   " new FLAG.
    Did you mean for me to add a new field to LIPS to keep track of pick omit line items? And kind of use it like a flag and reset it once I am done processing or something like that?
    In the TCode SWETYPV
    BOR Object Type     LIKP CHANGED       WS12300004 No errors
    BOR Object Type     LIKP CREATE_IBDLV WS12300004 No errors
    But not sure if that is the right way. I am trying to look up more documentation on this but not finding any.
    Meetings within the department have definitely given a deeper view of the requirements....
    While updating the pick omits delv. qty is the first step the next step is to rej the line item with a reason code. The discussions also revealed more points which were seeming to fit into this jigsaw with a little addition. The additional functionality is to consolidate all like items to one line item, prior to order going to warehouse for picking. This will aid in picking at the warehouse as well as in the customer invoice not reflecting more than one line item for the same material. In the case where the customer has truly ordered more than 1 case and additional 2 EA (eaches) the documents in SAP will still reflect 2 lines.
    Regards

  • Parameter NEW_ITEM_DATA in function module BAPI_OUTB_DELIVERY_CHANGE

    Hi, we have to add a new item to a delivery using ABAP. The function module BAPI_OUTB_DELIVERY_CHANGE has a parameter NEW_ITEM_DATA, but unfortunately no documentation about it. It Does anybody have an example on how to add a new item with this FM?
    Thanks for your help, best regards, Martin

    Hi,
    I have used this way:
    Loop at it_vbrp.
    CLEAR: wa_hdata, wa_hcont, d_delivy, it_bapiret2.
         wa_hdata-deliv_numb = it_vbrp-vgbel.
         wa_hcont-deliv_numb = it_vbrp-vgbel.
         wa_hcont-dlv_del    = c_x.
         d_delivy            = it_vbrp-vgbel.
    *---Deleting delivery doc (VL02)
         CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
           EXPORTING
             header_data    = wa_hdata
             header_control = wa_hcont
             delivery       = d_delivy
           TABLES
             return         = it_bapiret2.
    *---commit
           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
               wait = 'X'.
    Endloop.
    Thanks,
    Krishna

  • How to change the storage location using BAPI_OUTB_DELIVERY_CHANGE

    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.

    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.

  • Function Module BAPI_OUTB_DELIVERY_CHANGE missing SDABW

    Our company has a business requirement to base shipping method on the weight of the shipment.
    In order to achieve this, we group deliveries into a shipment to reach an aggregate weight.
    We were using incoterms to determine if we would charge the customer for freight or not -- but we are getting away from this method and we want to use Special Processing Indicator (SDABW) to do this instead.
    Our plan is when SDABW = Z003 and the weight threshhold is met, function module BAPI_OUTB_DELIVERY_CHANGE should change the delivery.
    Our problem is that the field SDABW is not included in BAPI_OUTB_DELIVERY_CHANGE.
    Does anyone know a way to add this to the FM? Or is there another FM that we could use?

    Check whether any of the includes FV50C002, LV05IFLV, L0VTRF00, L0VVTF00 could help you. Also take a look at OSS  Note 606769 - XSI_GET_SERVICE_CD_SDABW and XSI_GET_SERICE_CD_LPRIO, which talks about couple of function modules.
    Thanks,

  • Regarding using of EXTENSION1 and EXTENSION2 in BAPI_OUTB_DELIVERY_CHANGE

    Hi,
    Can any one please help me how to code for zfields in EXTENSION1 and EXTENSION2 in BAPI_OUTB_DELIVERY_CHANGE
    Thanks,
    Nethaji.

    I had a requirement to change a Z field in LIKP by a BAPI call and found this thread.
    Although the original participant probably have found alternative ways, I hope this can be helpful for others search for a solution to this.
    These are my findings u2013 please correct me if I am wrong. The EXTENSION1 & EXTENSION2 can NOT be used to change LIKP Z-fields. These doesnu2019t do anything in themselves, but can be imported in BADI IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010 (Thereu2019s a corresponding CMOD in older versions).
    However, the data available here are :
    CS_VBKOK
    CT_VBPOK
    CT_VBSUPCON
    EXTENSION1
    EXTENSION2
    So, for changes to delivery header, only fields in structure CS_VBKOK can be changed. As VBKOK does not have any customer appends, this is not possible. Furthermore is the BAPI BAPI_OUTB_DELIVERY_CHANGE only calling WS_DELIVERY_UPDATE anyway, so the BAPI can not do any magic the FM canu2019t. So what is the purpose with  EXTENSION1/ EXTENSION2 ?
    As I see it, itu2019s a handy way to transfer data to the BADI, so you can build logic to manipulate any of the existing CS_VBKOK fields. You could have done the same with a Memory export/import anyway.
    /END-BAD-NEWS
    /BEGIN-GOOD-NEWS
    After some trial and error, I managed to use BAPI_OUTB_DELIVERY_CHANGE to change Z fields in LIKP. Before the call, I export the desired content to a memory ID, which I then import in MV50AFZ1, BAPI_OUTB_DELIVERY_CHANGE
    See this working demonstration code :
    Calling program :
    *& Report  ZTEST_BAPI_DELIVERY_CHANGE
    report  ztest_bapi_delivery_change.
    data : gs_bapiobdlvhdrchg        type bapiobdlvhdrchg.
    data : gs_bapiobdlvhdrctrlchg    type bapiobdlvhdrctrlchg.
    data : gs_bapidlvcontrol         type bapidlvcontrol.
    data : gt_bapireturn type standard table of  bapiret2.
    data : gs_bapireturn type  bapiret2.
    data : gs_likp type likpvb.
    data : ld_zzhuload   type erlkz.
    constants: gc_x(1)     type c value 'X'.
    parameter : p_vbeln like likp-vbeln.
    Get relevant LIKP fields
    select * from likp
    into corresponding fields of gs_likp
    where vbeln = p_vbeln.
    endselect.
      Fill header data - convert to BAPI format
    call function 'MAP2E_LIKPVB_TO_BAPIOBDLVHDRCH'
      exporting
        likpvb          = gs_likp
      changing
        bapiobdlvhdrchg = gs_bapiobdlvhdrchg.
    Field to set as LIKP Z-field
    ld_zzhuload = 'X'.
    Memory-ID imported in MV50AFZ1
    export ld_zzhuload to memory id 'ZZHULOAD'.
    call function 'BAPI_OUTB_DELIVERY_CHANGE'
      exporting
        header_data           = gs_bapiobdlvhdrchg
        header_control        = gs_bapiobdlvhdrctrlchg
        delivery              = gs_bapiobdlvhdrchg-deliv_numb
        techn_control         = gs_bapidlvcontrol
      tables
        return                = gt_bapireturn
      exceptions
        communication_failure = 1
        system_failure        = 2
        others                = 3.
    if gt_bapireturn[] is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
        exporting
          wait = gc_x.
    else.
      loop at gt_bapireturn into gs_bapireturn
        where type = 'E'.
        message id gs_bapireturn-id type 'S'
        number gs_bapireturn-number with
        gs_bapireturn-message_v1
        gs_bapireturn-message_v2
        gs_bapireturn-message_v3
        gs_bapireturn-message_v4.
        exit.
      endloop.
    endif.
    MV50AFZ1, form USEREXIT_SAVE_DOCUMENT_PREPARE
    data : ld_zzhuload   type erlkz.
    if xlikp-vbtyp = 'J' " outbound delivery
    and  t180-trtyp = 'V'. " Change
    Memory-ID exported from program ZZZ...
    import ld_zzhuload from MEMORY ID 'ZZHULOAD'.
      if sy-subrc is initial
      and not ld _zzhuload is initial.
        LOOP AT xlikp.
          xlikp-zzhuload = ld_zzhuload.
          MODIFY xlikp transporting zzhuload.
        ENDLOOP.
        free MEMORY ID 'ZZHULOAD'.
      endif.
    endif.
    I hope someone will find this helpful. Obviously I can not take responsibility for the functionality
    Sorry for the format, I can not get the tags to work.....

  • Error while using BAPI_OUTB_DELIVERY_CHANGE

    Hi Friends,
    I m using BAPI_OUTB_DELIVERY_CHANGE to change the delivery. But I m getting error - Error in document &1 item &2 (quantity consistency check).
    I m changing the delivered qty in batch-split and
    delivered qty in header  level.
    Is there any problem in code
    Some code snaps is:
    loop at itab.
        item_data1-DELIV_NUMB = s_vbeln.
        item_data1-DELIV_ITEM = 10.
        item_data1-DLV_QTY = itab-nt_qty.
           item_data1-UNIT_OF_WT = itab-unit.
        append item_data1.
      endloop.
      ITEM_CONTROL1-DELIV_NUMB = s_vbeln.
      item_control1-DELIV_ITEM = 10.
        item_control1-CHG_DELQTY = 'X'.
      append item_control1.
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
      EXPORTING
        HEADER_DATA               = header_data1
        HEADER_CONTROL            = header_control1
        DELIVERY                  = s_vbeln
      TECHN_CONTROL             =
    TABLES
      HEADER_PARTNER            =
      HEADER_PARTNER_ADDR       =
      HEADER_DEADLINES          =
        ITEM_DATA                 = item_data1
        ITEM_CONTROL              = item_control1
      ITEM_SERIAL_NO            =
      SUPPLIER_CONS_DATA        =
      EXTENSION1                =
      EXTENSION2                =
        RETURN                    = ret .
    Please help me.

    Hi friends, this can be solved setting values for the following additional parameters of structure ITEM_DATA.
    FACT_UNIT_NOM = 1.
    FACT_UNIT_DENOM = 1.
    This works for me, please let me know if this works for you!
    Regards
    Leonardo

  • Usage of BAPI_OUTB_DELIVERY_CHANGE with extension fields populated

    Hi ,
    Does anyone have an example on how to use BAPI_OUTB_DELIVERY_CHANGE with the extension fields populated. A sample code would be very helpful .
    Thanks
    Ankit

    Ankit,
      The BADI - SMOD_V50B0001  will be triggered if the Extension Tables are filled.
      Method EXIT_SAPLV50I_010
      Should do the trick.
    Todd

  • BAPI_OUTB_DELIVERY_CHANGE

    Hi,
    Can any one pls help me with an example code for BAPI_OUTB_DELIVERY_CHANGE  for batch splits?
    Thanks

    Hi Prabha,
        You can use this BAPI to change outbound deliveries in both the
        Enterprise Resource Planning system (ERP system) and the decentralized
        Warehouse Management System (WMS), according to their respective
        distribution to the decentralized WMS. You can make these changes in the
        central ERP system and in the decentralized WMS. The interface ensures
        that outbound delivery data planned for a comparison is identical in
        both systems, even after subsequent changes.
      Changing Header Data:
        o   Weight (gross weight and net weight)
        o   Volume
        o   Door
        o   Delivery date
        o   Delivery priority
        o   Route
        o   Incoterms
        o   Unloading point
        o   Delete delivery
            You can only delete deliveries in the decentralized system and copy
            this deletion to the central SAP ERP system, if the decentralized
            WMS is an external system. For this, set the DLV_DEL indicator in
           the HeaderControl parameter.
    Changing Item Data:
       o   Quantity
       o   Weight (gross weight and net weight)
       o   Volume
       o   Expiration date
       o   Delete item
    Changing Partner Data:
       o   Change or delete partner for a partner function
       o   Change a partner's address
           If you want to change partner data, the system checks the
           Customizing settings of the other system, to see whether this type
           of change is permitted.
       Change Process Flow
       1.  You subsequently change an outbound delivery in the central ERP
           system or the decentralized WMS, after the delivery was distributed
           to the decentralized WMS.
       2.  If the decentralized WMS is an SAP system, the system blocks the
           relevant outbound delivery in the partner system as soon as you call
           the change transaction.
       3.  When you save the changes to the outbound delivery, the system sends
           a synchronous change request to the connected partner system.
       4.  The partner system uses the synchronous change request to simulate
           the change, then either accepts or rejects the change request.
       5.  If the partner system rejects the change request, you cannot make
           the change. The system cancels processing and displays a relevant
           error message.
       6.  If the partner system accepts the change request, the system saves
           the changes to the outbound delivery in the system in which you have
           made the changes. It then sends an asynchronous change request to
           the partner system.
       7.  This asynchrounous change request causes the partner system to
           update the outbound delivery data.
       8.  The system removes the cross-system lock for the changed outbound
           delivery.
    xample
       If you want to change the quantity for a distributed quantity, then
       following entries are required for the transfer to the connected system:
       o   In the header data of outbound delivery parameter (HEADER_DATA)
           -   The delivery number (DELIV_NUMB)
       o   In parameter item data of outbound delivery (ITEM_DATA)
           -   The delivery number (DELIV_NUMB)
           -   The delivery item (DELIV_ITEM)
           -   The delivery quantity in sales unit (DLV_QTY)
           -   The actual delivery quantity in base UoM (DLV_QTY_IMUNIT)
           -   The sales unit (SALES_UNIT)
             -   The ISO code for the sales unit (SALES_UNIT_ISO)
             -   The base unit of measure (BASE_UOM)
             -   The ISO code for the base unit of measure (BASE_UOM_ISO)
         o   In the control of the outbound delivery at item level parameter
             (ITEM_CONTROL)
             -   The delivery number (DELIV_NUMB)
             -   The delivery item (DELIV_ITEM)
             -   The Change Delivery Quantity indicator(CHG_DELQTY)
         If you do not make any further entries, the system copies the material
         number, plant, quantities as floating point numbers, volumes, weights,
         and their units from the original outbound delivery document.
    Notes
         Changes to the packing data are not synchronized in the central ERP
         system.
         For subsequent changes to a distributed inbound delivery, the following
         prerequisites must be fulfilled:
         o   All items in the distribution-relevant inbound delivery have the
             same decentrally-managed warehouse number.
         o   You have generated a distribution model for inbound deliveries. For
             more information, see the implementation guide (IMG) under Logistics
             Execution -> Decentralized WMS Integration -> Central Processing ->
             Distribution -> Generate Distribution Model.
         o   In Customizing for Shipping under Deliveries  -> Define Delivery
             Types ->  Distribution Mode, you have specified whether the system
             should distribute the delivery automatically after document
             creation, or whether distribution should be suppressed so that you
             can trigger distribution yourself using the delivery monitor.
         o   If you use an external system as the decentralized WMS, you must
             ensure that there is a blocking system for the decentralized system,
             which prevents a delivery from being processed in both systems at
             the same time. For more information on the cross-system lock, see
             the SAP Library under Basis -> Client-Server Technology ->
             Cross-System Lock (CSL).
         If you use the asynchronous interface for the actual transfer of the
         outbound delivery changes (IDoc category SHP_OBDLV_CHANGE), you must
         make sure that the structure definition of the IDoc is correct as you
         construct the IDoc. You should take particular care not to switch the
         segment sequence.
         Batch Split in the Decentralized WMS
         o   If you change a batch subitem from a distributed outbound delivery
             in the decentralized WMS, then this batch subitem already exists in
             the central ERP system.
             The fields HIERARITEM and USEHIERITM are empty. The system copies
             the batch subitem in the DELIV_ITEM field.
         o   If you change the quantity of a batch main item from a distributed
             outbound delivery in the decentralized WMS, then this batch main
             item already exists in the central ERP system.
             The fields HIERARITEM and USEHIERITM are empty. The system copies
             the batch subitem into the DELIV_ITEM field.
         o   If you perform a batch split for a distributed outbound delivery in
             the decentralized WMS, only the batch main item exists at that time
             in the central ERP system.
    If, for example, you create two batch subitems, three item segments
    ItemData are generated for transmission to the central ERP system:
    -   The item segment for the batch main item HIERARITEM is empty.
         The delivery quantity and base quantity are empty.
    -   For each subitem, the system generates an item segment with the
         following fields:
         DELIV_ITEM contains the number of the batch subitem.
         HIERARITEM contains the number of the batch main item.
         USEHIERITM with value 1 shows that the subitem is used as a
         batch subitem.
         The quantity fields match the quantities in the batch subitems.
    The central ERP system performs the batch split subsequently for the
    distributed outbound delivery.
    Regards,
    Hemant

  • Adding a new line item using BAPI_OUTB_DELIVERY_CHANGE

    Hi,
    I have a requirement to add a new line item to outbound delivery to the existing line items using the FM BAPI_OUTB_DELIVERY_CHANGE.Pls suggest how to do it.
    Thanks in advance.
    Anand

    Hi,
    Did you Check IN SCN like [THIS|Re: BAPI_OUTB_DELIVERY_CHANGE Help - Add new line item].
    Regards,
    Rahul

  • Error E/VL/280 (Required field in interface to delivery update missing &1 &2 &3 &4) using BAPI_OUTB_DELIVERY_CHANGE

    Hi,
    I am trying to change delivery quantity using BAPI_OUTB_DELIVERY_CHANGE. When I tested the BAPI by giving values in the parameters
    HEADER_DATA, DELIVERY, ITEM_DATA and ITEM_CONTROL it is working fine.
    However when I use the same BAPI in program and when I am trying to test it I am receiving error 'E/VL/280' (
    Required field in interface to delivery update missing &1 &2 &3 &4).
    Request to please help me out on how to resolve.
    Much Appreciated.

    Hi Nagarjuna,
    Can you please check the program in debugging  mode, &1 &2 &3 &4 are the place holders specifies some information. Might be missing some information while changing delivery document.
    Check the place holders in debugging mode.
    Thanks,
    Ashok.

Maybe you are looking for

  • "Not enough disk space" when there seems to be

    I'm a newbie to iDVD and iMovie (my last Mac was a Performa 6360--still using it for the family budget) and got my daughter a MacBook as a graduation gift. She is using it to combine movie inputs from a wedding/reception that come from digital camrea

  • HP OfficeJet Pro 8000 does not print black

    Hi We bought an HP office pro 8000 printer which we have had in the box in a cupboard for the last 14 months (never been opened), I have finally got around to getting it out of the box ans setting it up, however it does not seem to print black only t

  • Printing Multiple Templates' output in a single PDF

    Hi All, I have a requirement wherein I have to print the data from several or a few templates into a single pdf. Requirement: All the Service Contracts created on a particular day will need to be printed in a single report For eg: If there are 5 diff

  • Could not call batch from command line processing

    I am experiencing a strange scenario where I am able to run the FR report by scheduling a batch in HFM and that creates RecRecon successfully. I am trying to do this as a batch script by using the command line script ScheduleBatch.cmd <xml file> <ser

  • In incoming calls phone freezes and reboots

    Hi I got my Jelly Bean 4.1 update and whenever there is an incoming call, my Galaxy Nexus phone freezes and reboots when the caller ends the call. Is this a known issue? What can I do to have this issue fixed. Thank you