Application Development 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: 

BAPI COMMIT ISSUE - Delivery is created before Inventory is posted

Former Member
0 Kudos

Hi Experts,

I have a program in which I've to post Inventory and create Delivery. I'm following the below sequence :

Confirm Production Order :

1. FM 'CO_RU_CONFIRMATION_PREPARE' is called.

2. FM 'CO_RU_CONFIRMATION_CHECK' is called.

    WAIT FOR 1 SECOND.

3. FM  'BAPI_PRODORDCONF_CREATE_HDR' is called.

4. 'BAPI_TRANSACTION_COMMIT' is called with WAIT parameter = 'X'.

6. Code written to check if material has been posted in AUFM table and to check if entry is written to MSEG.

      Only then code proceeds further.

Create Delivery :

7. FM ''RV_SCHEDULE_CHECK_DELIVERIES' is called

8. FM 'Z_CREATE_DELIVERY_VL01N' is called. (BDC to create Delivery)

9. COMMIT AND WAIT. 

The issue is, at times, Delivery is created before Inventory is posted, though we have put Commits with Wait and Checking AUFM and MSEG table for entries (which hv 2 second wait and runs 5 times to check entries). Is there any way I can prevent this. I tried using SET UPDATE TASK LOCAL but it was giving some other issues and failed to create delivery. Can you please help me to rectify this scenario !!

Thanks in Advance !!

Thanks and Regards

         Vivek

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

4th step should be

4. 'BAPI_TRANSACTION_COMMIT' is called with WAIT parameter = ' '.

should not required to wait.

Also you saying that you are cross checking the tables for inventory posting . Do you see that problem even after you figured out successful posting of the inventory .

May be tables check you are doing is not working properly all the time.

Priya

4 REPLIES 4

Former Member
0 Kudos

Hi ,

4th step should be

4. 'BAPI_TRANSACTION_COMMIT' is called with WAIT parameter = ' '.

should not required to wait.

Also you saying that you are cross checking the tables for inventory posting . Do you see that problem even after you figured out successful posting of the inventory .

May be tables check you are doing is not working properly all the time.

Priya

0 Kudos

Hi, Yes, the inventory is getting posted and tables are getting updated. But the inventory posting time is before delivery creation time. And we cannot catch this debugging as it always works during debugging properly.

Can you please explain why the WAIT is not required in BAPI_TRANSACTION_COMMIT ?

0 Kudos

Reason for me asking not to wait is you want to commit the inventory posting irrespective of the delivery creation . (Asynchronous) .

As I said earlier you tables check may not be correct completely .

I found this BAPI BAPI_PRODORDCONF_EXIST_CHK(Existence Check for Confirming Production order) . You can try to use this to check .

Priya.

0 Kudos

Thanks a lot. I'll surely try this out and update about the outcome.