Update GR quantity in Inbound delivery using 'BAPI_INB_DELIVERY_CHANGE'

Hello SDNs,
I have a requirement to update quantity delivered post GR in the Inbound delivery. I'm using 'BAPI_INB_DELIVERY_CHANGE' to do the updation in program. The database is not updated with new quantity.
BAPI returns error message in "Return" table with ID VLBAPI . I'm unable to detect where the problem is.
Below is my code. Please help me resolve it.
  loop at it_final.
    CLEAR g_delivery.
    g_delivery = it_final-text(10).
*   g_delivery = '0180000221'.
    g_del_item = it_final-text+10(6).
*    g_del_item = '10'.
    g_material = it_final-text+16(18).
    g_dlv_qty = it_final-text+34(13).
    select single * from lips into wa_lips
        where vbeln = g_delivery
          and posnr = g_del_item
          and matnr = g_material.
    if sy-subrc eq 0.
      wa_lips-lfimg = g_dlv_qty.
      modify lips from wa_lips.
      check sy-subrc eq 0.
    endif.
    CLEAR gt_header_data.
    REFRESH gt_header_data.
    gt_header_data-deliv_numb = g_delivery.
    gt_header_data-volumeunit = wa_lips-voleh.
    APPEND gt_header_data.
    CLEAR gt_header_ctrl.
    REFRESH gt_header_ctrl.
    gt_header_ctrl-deliv_numb = g_delivery.
*    gt_header_ctrl-no_lock = 'Y'.
    APPEND gt_header_ctrl.
    clear gt_tech_ctrl.
    refresh gt_tech_ctrl.
    gt_tech_ctrl-UPD_IND = 'X'.
    gt_tech_ctrl-DLV_TYPE = 'EL'.
    append gt_tech_ctrl.
    CLEAR gt_data.
    REFRESH gt_data.
    gt_data-deliv_numb = g_delivery.
    gt_data-deliv_item = g_del_item.
    gt_data-material = g_material.
    gt_data-dlv_qty = wa_lips-lfimg.
    gt_data-sales_unit = wa_lips-vrkme.
    gt_data-base_uom = wa_lips-meins.
    gt_data-dlv_qty_imunit = g_dlv_qty.
*   gt_data-base_uom_iso =
*    gt_data-
    APPEND gt_data.
    REFRESH gt_ctrl.
    gt_ctrl-deliv_numb = g_delivery.
    gt_ctrl-deliv_item = g_del_item.
* gt_ctrl-del_item   = ' '.
    gt_ctrl-CHG_DELQTY = 'X'.
    APPEND gt_ctrl.
    CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
      EXPORTING
        HEADER_DATA                = gt_header_data
        HEADER_CONTROL             = gt_header_ctrl
        DELIVERY                   = g_delivery
        TECHN_CONTROL              = gt_tech_ctrl
      TABLES
*   HEADER_PARTNER             =
*   HEADER_PARTNER_ADDR        =
*   HEADER_DEADLINES           =
       ITEM_DATA                  = gt_data
      ITEM_CONTROL               =  gt_ctrl
*   ITEM_SERIAL_NO             =
*   EXTENSION1                 =
*   EXTENSION2                 =
        RETURN                     = return
*   TOKENREFERENCE             =
*   HANDLING_UNIT_HEADER       =
*   HANDLING_UNIT_ITEM         =
*   PARTIAL_GR_OBJECTS         =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT = ' '.
endloop.
Thanks
Shruti

Please check the inbound delivery you are trying to delete is not having goods receipt status as 'completed' OR not having HANDLING UNITS assigned to it.
In any of the above case, please reverse the goods receipt first, then unassign the handling units and then try to delete the inbound delivery. In my opinion, there should be no need to change the qty to 0 and just delete the inbound delivery should work.
In case you still encounter an error, try deleting the delivery using VL32n and you should get a clear error/problem for your case.

Similar Messages

  • Update Delivery Qty of  Inbound Delivery using BAPI_INB_DELIVERY_CHANGE

    Hi Experts,
    I'm trying to use  BAPI_INB_DELIVERY_CHANGE to update the delivery quantity of a line item in an Inbound Delivery. However, I keep on getting this error:
    Type: E
    ID: VLBAPI
    Number: 004
    Text: Error in document &1 item &2 (quantity consistency check)
    Below is my test program. Any input will be much appreciated.
    REPORT  ztest.
    DATA: deadlines LIKE bapidlvdeadln OCCURS 0.
    DATA: wa_deadlines LIKE bapidlvdeadln.
    DATA: header_data_t LIKE bapiibdlvhdrchg OCCURS 0.
    DATA: wa_header_data LIKE bapiibdlvhdrchg.
    DATA: header_control_t LIKE bapiibdlvhdrctrlchg OCCURS 0.
    DATA: wa_header_control LIKE bapiibdlvhdrctrlchg.
    DATA: item_data LIKE bapiibdlvitemchg OCCURS 0.
    DATA: wa_item_data LIKE bapiibdlvitemchg.
    DATA: item_control LIKE bapiibdlvitemctrlchg OCCURS 0.
    DATA: wa_item_control LIKE bapiibdlvitemctrlchg.
    DATA: header_data_t_con LIKE bapiibdlvhdrcon OCCURS 0.
    DATA: wa_header_data_con LIKE bapiibdlvhdrcon.
    DATA: header_control_t_con LIKE bapiibdlvhdrctrlcon OCCURS 0.
    DATA: wa_header_control_con LIKE bapiibdlvhdrctrlcon.
    DATA: item_data_con LIKE bapiibdlvitemcon OCCURS 0.
    DATA: wa_item_data_con LIKE bapiibdlvitemcon.
    DATA: item_control_con LIKE bapiibdlvitemctrlcon OCCURS 0.
    DATA: wa_item_control_con LIKE bapiibdlvitemctrlcon.
    DATA: return TYPE STANDARD TABLE OF bapiret2.
    CLEAR: wa_header_data, wa_header_control.
    wa_header_data-deliv_numb = '0180000545'.
    wa_header_data-gross_wt = '3001.000'.
    *wa_header_data-NET_WEIGHT = '3001.000'.
    wa_header_data-unit_of_wt = 'KG'.
    wa_header_data-volume = '1500.5'.
    wa_header_data-volumeunit = 'M3'.
    APPEND wa_header_data TO header_data_t.
    wa_header_control-deliv_numb = '0180000545'.
    wa_header_control-NET_WT_FLG = 'X'.
    wa_header_control-volume_flg = 'X'.
    wa_header_control-gross_wt_flg = 'X'.
    *wa_HEADER_CONTROL-DELIV_DATE_FLG = 'X'.
    APPEND wa_header_control TO header_control_t.
    CLEAR: wa_item_data.
    wa_item_data-deliv_numb = '0180000545'.
    wa_item_data-deliv_item = '000020'.
    wa_item_data-dlv_qty = '3000'.
    wa_item_data-dlv_qty_imunit = '3000'.
    wa_item_data-sales_unit = 'KG'.
    wa_item_data-sales_unit_iso = 'KG'.
    wa_item_data-base_uom = 'KG'.
    wa_item_data-base_uom_iso = 'KG'.
    wa_item_data-gross_wt = '3000'.
    wa_item_data-unit_of_wt = 'KG'.
    wa_item_data-volume = '1500'.
    wa_item_data-volumeunit = 'M3'.
    APPEND wa_item_data TO item_data.
    CLEAR: wa_item_control.
    wa_item_control-deliv_numb = '0180000545'.
    wa_item_control-deliv_item = '000020'.
    wa_item_control-chg_delqty = 'X'.
    wa_item_control-VOLUME_FLG = 'X'.
    wa_item_control-NET_WT_FLG = 'X'.
    wa_item_control-GROSS_WT_FLG = 'X'.
    APPEND wa_item_control TO item_control.
    CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
    EXPORTING
    header_data = wa_header_data
    header_control = wa_header_control
    delivery = '0180000545'
    * TECHN_CONTROL =
    TABLES
    * HEADER_PARTNER =
    * HEADER_PARTNER_ADDR =
    * HEADER_DEADLINES = deadlines
    item_data = item_data
    item_control = item_control
    * ITEM_SERIAL_NO =
    * EXTENSION1 =
    * EXTENSION2 =
    return = return
    * TOKENREFERENCE =
    * HANDLING_UNIT_HEADER =
    * HANDLING_UNIT_ITEM =
    * PARTIAL_GR_OBJECTS =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    Hi,
    Pls try to use the other structure
    ORDER_SCHEDULES_INX type BAPISCHDLX bcoz it is used to update the required field.
    Now for the date field add the required days to set it as future date.
    ex:
    l_date = l_date + 12. // it will be set to future or requred date.
    Reward if helpful.
    Regards
    Chandralekha

  • Error in Inbound delivery using 'BAPI_INB_DELIVERY_CHANGE'

    Hi,
    I want to delete Inbound delivery.i got the erro that document cant be deleted(VL-66), how to correct this
    I passed the belwo entry. let me know if i m missing anything.
    I tried with and withou item_data and item_control(as i have commented) but no use.
    i just want to delete the inbound delivery say evry thing be 0 so i was passing 0 as quantity
    wa_inb_head-deliv_numb = '0180036237'.
        wa_inb_ctrl-deliv_numb = '0180036237'.
         wa_inb_ctrl-dlv_del    = 'X'.
          wa_inb_delivery             = '0180036237'.
      wa_item_ctrl-DELIV_NUMB = '0180036237'.
      wa_item_ctrl-CHG_DELQTY = 'X'.
      append wa_item_ctrl to it_ctrl.
    *wa_data-DELIV_NUMB = '0180036237'.
           wa_data-DLV_QTY = '0'.
    *wa_data-DLV_QTY_IMUNIT = '0'.
    *append wa_data to it_data.
         CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
              EXPORTING
                HEADER_DATA                =  wa_inb_head
                HEADER_CONTROL             =  wa_inb_ctrl
                DELIVERY                   =  wa_inb_delivery
              TABLES
               item_data          = it_data
               item_control             = it_ctrl
               RETURN                     = it_bapiret2.

    Please check the inbound delivery you are trying to delete is not having goods receipt status as 'completed' OR not having HANDLING UNITS assigned to it.
    In any of the above case, please reverse the goods receipt first, then unassign the handling units and then try to delete the inbound delivery. In my opinion, there should be no need to change the qty to 0 and just delete the inbound delivery should work.
    In case you still encounter an error, try deleting the delivery using VL32n and you should get a clear error/problem for your case.

  • Total and pending quantity of inbound delivery

    From which table i will find total and pending quantity of inbound delivery number.
    Which table and field name???

    Dear,
    Find out report using T'Code MR11, you will get all required  fields (this is standard report)
    Regards,
    A. Wankhede

  • How can delayed delivery update be configured for Inbound delivery ?

    Hi All,
    How can delayed delivery update be configured for Inbound delivery ?
    There is setting for Outbound delivery delayed delivery update but how the same functionality be used for Inbound delivery?
    Regards
    Jimmi

    Hello Jimmi,
    Unfortunately I must confirm that the Delayed delivery update is only available for outbound deliveries. Please see below note for further details
    664316 Tips for the delayed delivery update for TO
    I hope this information helps!
    Martin

  • Change inbound delivery using /SPE/IDOC_INPUT_DESADV1

    Hello -
    We are creating an inbound delivery using the idoc function module /SPE/IDOC_INPUT_DESADV1.  I have need to be able to change an existing delivery via idoc processing, so we are populating and mapping an E1EDL18 segment with the qualifier 'CHG'.  However, in /SPE/IDOC_INPUT_DESADV1, it does not appear to handle CHG.  I have debugged down into the code and in method PARSE_AND_HANDLE_IDOC_DELVRY03, when the segment is E1EDL18, there is a case statement that looks at the qualifier, and CHG is not dealt with. 
    Any ideas how to handle this?  Or is this a legitimate bug I should report to SAP?
    Thanks for any help!
    Sharon McClure

    Sharon McClure wrote:
    Or is this a legitimate bug I should report to SAP?
    Hard to say. Why not just report it? The worst they can do is say it's a consulting issue.
    Rob

  • While doing inbound delivery using VL31N

    While doing inbound delivery using the T-code VL31N , am getting the error message " Factory calendar  is not recognised "
    Guys Please help me out

    Hello ,
    while doing the PO in the item detail  confirmations tab i have selected the inbound delivery ECC and saved .After that i tried to create the inbound delivery for the PO at that time am getting the message 'factory calender is not recognised " .
    I have checked in the factory calender which is assigned to controlling area is"  K4 "
    Please help me out

  • Bapi for inbound delivery using PO

    Hi experts,
    I want to create a bapi for inbound delivery using PO.
    which bapi or FM should i use and can you send me the code for that.
    Thanks,
    Rajiv

    Hi Rajiv,
    Please check this FM --> BAPI_DELIVERYPROCESSING_EXEC
    Please check these threads
    Bapi to create inbound delivery
    BAPI to create inbound delivery
    Hope this would help you.
    Good luck
    Narin

  • Post Goods Receipt for Inbound Delivery using WHSCON IDoc

    Dear All
    Currently I am working on a big project dealing with EDI connections to our logistics partner for the Export business. The entire message flow between Lindt and our partner should be via EDI. Our SAP release is (still) 4.6c.
    We will create two kinds of despatch advice messages, one for inbound deliveries and one for outbound deliveries for customers.
    I would appreciate your support in the following problem that I am facing with the inbound delivery scenario:
    We create stock transport orders (purchase orders, POs) for the goods intended to be delivered into the plant at our partner
    We create a delivery (type NL = replenishment delivery) for this POs
    As soon as we post the goods issue we send the despatch advice (as EANCOM D96A DESADV message) to our partner.
    At this point the delivery is basically completed, i.e. packing status (PS) and goods movement status (GM / GS) are equal to 'C' (= completed).
    Our logistics partner uses the same EDI message to send us the goods receipts data, e.g.:
    We dispatched 50 units of a product => QTY:50:12
    The partner received indeed 50 units => QVR:50:66
    Please note that we do not use the QVR segment for the quantity difference (between despatched and received quantity) but it contains the received units. This way we avoid negative values in the QVR segment.
    When the logistics partner sends back the DESADV message containing the received quantities (QVR segment) we want to make
    the goods receipts for the products in the original stock transport order and
    upate the message flow in the delivery
    My idea was to transform the incoming DESADV message into a WHSCON.DELVRY03 IDoc based on the documentation in: [Delivery Interface|http://help.sap.com/saphelp_crm40/helpdata/en/e2/654b15a9f411d184ec0000e81ddea0/content.htm]
    In the delivery header control E1EDL18 I used QUALF = 'PGI' (Post goods issue).
    I prepared an inbound WHSCON IDoc according to the documentation mentioned below. I managed to get some feedback from the Idoc processing implying that the system tried to do the goods receipt in the PO but failed.
    To make a long story short here are my questions:
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    Does anybody have an example on how to fill the WHSCON IDoc?
    Or is my approach a cul-de-sac ?
    Kind Regards
       Uwe
    PS: A related question can be found here: Goods Receipt in PO AND Message Flow Update in Inb. Delivery using WMMBXY

    Hi Uwe,
    Can an inbound WHSCON IDoc used for doing both the goods receipt in the PO and the update of the message flow in the delivery?
    The binary answer would be no. You should use WMMBXY or MBGMCR instead.
    But if we are doing goods receipt against Inbound delivery then answer is YES with additionally E1EDL18-QUALF = 'PIC' populated. But please remember no partial receipt is possible against Inbound Delivery.
    We should populate E1EDL20-VBELN with our Inbound delivery number and line item info should go to E1EDL24.
    I have done a similar interface recently where we are doing receipt against Inbound delivery. But our case was a bit complex because we had to support against Inbound delivery. So we had to go for a custom solution on top of IDOC_INPUT_DELVRY.
    Hope this helps. Let me know if you have more questions.
    Regards,
    Rudra

  • Trigger internal serial nos creation for inbound delivery using DELVRY03

    Hi all,
    I am working in ECC 6.0 I need to update serial nos in the inbound delivery. The internal serial nos. that will be generated by the system, I have to trap them for a given delivery and map it to a set of external serial nos.(length is 40 chars) and update in a Z table.
    For changing the delivery, I am using idoc DELVRY03 (message SHPCON). Within the idoc I am not able to find any such field which will trigger the automatic creation of internal serial nos. In case of idoc MBGMCR03 (goods movement), there is a field E1BP2017_GM_ITEM_CREATE-SERIALNO_AUTO_NUMBERASSIGNMENT which when set to 'X', the internal serial nos are automatically generated and can be found in table SER03.
    I want a similar thing for the DELVRY03 idoc. Can anyone help me on this?
    If not possible through Idoc, then whats the other option?
    My aim is to just get the internal serial nos created through delivery change activity.
    Note - The serial no. profile cannot have the option of serial no. usage set to '04 - automatic' in SPRO as per the client's business process.
    Thanks,
    Shoma

    Hi Shoma,
    copy the FM  which is assigned to your processcode and copy to ZFM and write your modifications on that ZFM.
    It will resolves your problem.
    Regards,
    Venkat.

  • BAPI For Inbound Delivery using Purchase Order Number

    Hi All,
    Is there any BAPI for posting Inbound Delivery (VL31N) using Purchase Order as reference.
    thanks
    bobby

    Not sure what it has to do with enhancements and modifications, but there is no such BAPI:
    http://tech.groups.yahoo.com/group/ABAP/message/38307
    http://sap.ittoolbox.com/groups/technical-functional/sap-log-mm/bapi-for-inbound-delivery-creation-and-update-vl31n-1201265
    FYI all BAPIs may be viewed in BAPI transaction.

  • Proposed delivery quantity in inbound delivery vs purchase schedule line

    Hello all
    I have got a doubt when creating inbound delivery for an item of purchase schedule line. I want to know how to get the proposed delivery quantity equal to the quantity of all schedule lines until today.
    For example I have got 4 schedule lines for a material and today is 28.10.2011
    20.10.2011 11ud
    28.10.2011 13ud
    03.11.2011 17ud
    05.11.2011 15ud
    when I execute VL31N with date = 28.10.2011, I want to proposed delivery quantity = 11+13 = 24ud.
    However, what I got is always the total quantity of all pending schedule lines = 111317+15=56ud.
    Do you know how can I achieve my propose?
    thank you in advance

    Hi Alan
    Thank you for your reply.
    In some cases (depending on vendor) we are using vendor ASN by EDI. In other cases (when there is no EDI conection with vendor) we use manually VL31N. So in these cases we need a proposed quantity by system in order to know if the quantity that we receive is coherent. Maybe we will try to implement the inbound delivery user exit.
    Thanks again!

  • Detemine open GR quantity in inbound delivery

    Hi gurus,
    I have an inbound delivery no with me. Suppose delivery quantity is 50. Now I have done GR through MIGO for 10 quantities against that inbound delivery. So at present open GR quantity is 40.
    Now my question is how to calculate the open GR quantity against a inbound delivery because I have to show that in a custom report? Need that a little bit technically...
    Secondly, how to understand that GR has been done completely against a inbound delivery?

    Use tables EKES and EKBE and you need to apply some logic. contact abaper.

  • Problem with HU during creation of Inbound Delivery using IDoc

    Hi,
    When I am creating Delivery manually and perform Packing, Handling Unit information is stored in VEKP and VEPO tables.
    But when I am processing through IDoc, after passing data to Handling Unit Segments E1EDL37 (Handling unit header), E1EDL39 (Control Segment for Handling Units), E1EDL44 (IDoc: Handling Unit Item - Delivery), It is creating delivery successfully but Handling Unit information is not getting stored in VEKP, VEPO tables.
    Tried most of the notes 912470, 678464, 682506 and all of them say "<i>You use the Idoc DESADV to create inbound delivery with packing data. The delivery is created, Idoc gets status 52 but the Handling Units (HUs) are missing. This is due to a program error. In case the IDoc contains segments to create HUs (E1EDL37), the IDoc processing should end in error status (51) as long as no packing data could be created</i>.".
    Need your advice whether we have to maintain any customizing for this or how to proceed with it.
    Thanks in advance,
    Murali.

    IDocs and BAPIs sometimes behave differently than transactions. You might need to add a user exit specifically for IDoc processing. Otherwise send a message to SAP and have them look at it.

  • Goods receipt inbound delivery using old goods movement transactions

    Hi! I have a client who is still using the old goods movement transactions in the new ECC system. I would like to confirm whether it is possible at all to receipt inbound delivery (from shipping notification) using any of the old goods movement transactions? I don't seem to be able to find one that work.
    Cheers!
    SF

    Yes, does anyone have any idea re this?
    Cheers!
    SF

Maybe you are looking for

  • Is it possible to copy and paste a formula without changing the cell references?

    I am trying to paste a formula to a cell adjacent to where it currently is but when I do, the cell references in it change. I am trying to get exactly the same formula in the cell (without re-typing it).

  • Purchase documents

    While creating purchase documents (PO,PR), system says "acc. assignment mandatory for this material.Enter acc.assignment category" Message no. ME062 Diagnosis:There is no provision for value-based inventory management for this material type in this p

  • Branch object wire without creating a copy

    Hello, I try to interact with a device. I abstracted the device into a class with several methods. My application is one big event frame taking care of user input from the front panel and converting it into method calls in order to control said devic

  • Elements 6 for Mac Install Issue on Leopard 10.5.5

    I'm trying to install a trial version of Elements 6 for Mac in Leopard 10.5.5. The installer looking for Adobe Soundbooth CS3 halfway though disk 3. What's up with that? I hadn't wanted Soundbooth. Thanks

  • A quick apple script

    i need to make an apple script that can - take a snapshot of the screen right before screen saver begins. place it into a specific place and replace the last one that was there. anyone know how to do this?