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

Trouble using BAPI_INB_DELIVERY_SAVEREPLICA

Former Member
0 Likes
2,666

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

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

1 REPLY 1
Read only

Former Member
0 Likes
1,479

It seems this BAPI can only be used for replication and not in our situation.

Solved this problem by using bdc call transaction for creating the delivery, BAPI_HU_CREATE for creation of the handling unit and bdc call transaction for packing the items on the handling unit.


PERFORM dynpro USING:
        'X'   'RM06EANL'        '1000',
        ' '   'BDC_CURSOR'      'P_TEST',
        ' '   'BDC_OKCODE'      '=ONLI',                     "OK code
        ' '   'S_EBELN-LOW'     p_po_number,
        ' '   'P_DATE'          lv_deliv_date,
        ' '   'P_TEST'          space.

  CALL TRANSACTION 'VL34' USING gt_bdc_tab MODE 'N' UPDATE 'S'
         MESSAGES INTO gt_messtab.