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_DELIVERYPROCESSING_EXEC creates two inbound deliveries in one call

Former Member
0 Likes
1,162

Hi All,

I'm using BAPI_DELIVERYPROCESSING_EXEC to create an inbound delivery with batch split. The problem is that the program sometimes runs fine and creates only one inbound delivery (as it's supposed to do) and sometimes it creates two deliveries even if it's being called only once (I checked in debug and the program only goes once through the bapi). The input data for the bapi is always the same, only the result it returns sometimes is wrong. No error is returned.

At this point the problem seems random. I can't find a pattern. When the program doesn't run correctly, usually, one delivery contains the parent item with maybe one batch as a child, and the second delivery contains the rest of the batches with no parent. Basically, it splits the data that should have been used for creating only one delivery, into two different deliveries.

The batches are created using BAPI_BATCH_CREATE before the creation of the inbound delivery. While testing, I have noticed that when the program skips the creation of batches, the result seems to always be the right one.

After executing each bapi, I run BAPI_TRANSACTION_COMMIT with commit and wait. These are the only parameters I give to the function:

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
    TABLES
      request        = ut_request
      createditems   = ct_items
      item_serial_no = ct_item_serial_no
      return         = ct_return
    EXCEPTIONS
      error_message  = 99.

Any idea what goes wrong inside BAPI_DELIVERYPROCESSING_EXEC or how I could fix the problem?

Hi All,

I'm using BAPI_DELIVERYPROCESSING_EXEC to create an inbound delivery with batch split. The problem is that the program sometimes runs fine and creates only one inbound delivery (as it's supposed to do) and sometimes it creates two deliveries even if it's being called only once (I checked in debug and the program only goes once through the bapi). The input data for the bapi is always the same, only the result it returns sometimes is wrong. No error is returned.

At this point the problem seems random. I can't find a pattern. When the program doesn't run correctly, usually, one delivery contains the parent item with maybe one batch as a child, and the second delivery contains the rest of the batches with no parent. Basically, it splits the data that should have been used for creating only one delivery, into two different deliveries.

The batches are created using BAPI_BATCH_CREATE before the creation of the inbound delivery. While testing, I have noticed that when the program skips the creation of batches, the result seems to always be the right one.

After executing each bapi, I run BAPI_TRANSACTION_COMMIT with commit and wait. These are the only parameters I give to the function:

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
    TABLES
      request        = ut_request
      createditems   = ct_items
      item_serial_no = ct_item_serial_no
      return         = ct_return
    EXCEPTIONS
      error_message  = 99.

Any idea what goes wrong inside BAPI_DELIVERYPROCESSING_EXEC or how I could fix the problem?

0 REPLIES 0