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

Commit work and wait after bapi execution not working

Former Member
0 Likes
2,936

Hi experts,

I have a requirement from my client that consists on posting 2 documents and then clearing them.

Right now Iu2019m posting the first 2 documents using BAPI_ACC_DOCUMENT_POST and for clearing both documents Iu2019m using Tcode F-51 but sometimes it's giving me an error clearing the documents because after the second bapi run, posting the second document, apparently all went right and a document number it's returned but the database doesnu2019t updated the doc number.

Iu2019m using commit work and wait, and already tried BAPI_TRANSACTION_COMMIT, but it doesnu2019t work sometimes, and the only solution that i found was the Wait up 1 second command , which it's slowing the program execution.

i think the problem it's on the bapi posting execution, due to a lag on the database side, but Iu2019m not sure...

Did anyone already had this problem? Has anyone has a solution for this?

Thanks in advance

Best Regards

João Martins

1 ACCEPTED SOLUTION
Read only

0 Likes
2,134

Hi , use this statement

set update task local

The above statement will ensure that the it will commit to data base.

Ram.

5 REPLIES 5
Read only

Former Member
0 Likes
2,134

Hello,

yes, I already had that problem but a BAPI_TRANSACTION_COMMIT with the WAIT parameter solved the problem.

Read only

Former Member
0 Likes
2,134

Thanks for your reply but i allready tried the BAPI_TRANSACTION_COMMIT with the wait parameter but it didn't work...

This is a program of mass posting and let's say the in a 1 second period 2 documents are posted by the bapi, what it's happening it's the the second document isn't update on the database when i call the F-51 tcode to clear the items of both documents...

Any sugestion?

thank in advance

Regards

João Martins

Read only

0 Likes
2,134

Hi,

Normally every BAPI will work on Update task so that the data will be updated once the commit work is done. For the commit work, we will normally call the bapi function module - BAPI_TRANSACTION_COMMIT. It should work.

In your case, just try the below option:

Please call the bapi - BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT in a seperate function module and call this function module in your program (just pass the import / export / table parameters accordingly).

For the information, I had once a similar type of issue and it got solved once I did like the above.

Regards,

Selva K.

Read only

0 Likes
2,135

Hi , use this statement

set update task local

The above statement will ensure that the it will commit to data base.

Ram.

Read only

Former Member
0 Likes
2,134

Thanks!!

The SET UPDATE TASK LOCAL work out

Regards to all

Thanks

João Martins