Skip to Content
0
Former Member
Mar 12, 2009 at 05:28 PM

Trouble using BAPI_INB_DELIVERY_SAVEREPLICA

1183 Views

Hi people,

I'm using BAPI_INB_DELIVERY_SAVEREPLICA to create inbound deliveries and handling units but can not get the bapi to work. I searched the forum but couldn't find any sample code how to use this bapi.

In my program I create a purchase order first using BAPI_PO_CREATE. Then I transfer the po-data to the next bapi and call it. It returns the message: Error in document &1 item 10 (quantity consistency check)

I call the bapi like this:

        ls_header_data-dlv_type = 'EL'.

        CLEAR lv_item_number.
        LOOP AT lt_po_items.
          ADD 10 TO lv_item_number.
          lt_item_data-itm_number = lv_item_number.
          lt_item_data-material = lt_po_items-pur_mat.
          READ TABLE lt_po_item_schedules INDEX sy-tabix.
          lt_item_data-dlv_qty = lt_po_item_schedules-quantity.
          lt_item_data-dlv_qty_stock = lt_po_item_schedules-quantity.
          lt_item_data-cum_btch_qty = 2.

          APPEND lt_item_data.

          lt_item_ref_purchase_order-itm_number = lv_item_number.
          lt_item_ref_purchase_order-doc_number = lv_po_number.
          lt_item_ref_purchase_order-itm_number_ref = lt_po_items-po_item.
          APPEND lt_item_ref_purchase_order.

          lt_handling_unit_header-hdl_unit_exid = '1'.
          APPEND lt_handling_unit_header.

          lt_handling_unit_item-hdl_unit_exid = '2'.
          APPEND lt_handling_unit_item.

        ENDLOOP.


        CLEAR lt_return2.

        CALL FUNCTION 'BAPI_INB_DELIVERY_SAVEREPLICA'
          EXPORTING
            header_data             = ls_header_data
            sender_system           = ls_sender_system
          IMPORTING
            delivery                = lv_delivery
          TABLES
            header_partner          = lt_header_partner
            header_deadlines        = lt_header_deadlines
            item_data               = lt_item_data
            item_org                = lt_item_org
            item_ref_purchase_order = lt_item_ref_purchase_order
            handling_unit_header    = lt_handling_unit_header
            handling_unit_item      = lt_handling_unit_item
            return                  = lt_return2.

Does anyone know which data I need to provide to get the bapi to work?

Thanks in advance!

Regards,

Ivo