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: 

Problem during BAPI_TRANSACTION_COMMIT

Former Member
0 Kudos

I have a custom program that performs mass final confirmations by calling IW41 and then IW32. In performing IW41, I'm using the BAPI 'BAPI_ALM_CONF_CREATE' and then 'BAPI_TRANSACTION_COMMIT'. Then it will do a BDC for IW32 to update the user status.

My problem occurs for orders with more than 1 operations. After the BAPIs are called successfully or with errors, by the time it calls IW32 I get this error 'E 0020/Order 30005161 is already being processed by', sy-uname.

Also, how can I capture other messages during the BAPI_TRANSACTON_COMMIT. For example, I get this pop-up message 'The dates for at least one order are not current'. How can I avoid these messages that pop-ups? Is it possible to prevent this pop-ups and instead just capture the messages and display them as a log report?

Comments and suggestions for these 2 issues are highly appreciated.

4 REPLIES 4

Former Member
0 Kudos

I don't believe you can prevent the popup from occuring or capture the popup output; however, maybe you can check for the error conditions prior to calling the bapi.

maciej_domagaa
Contributor
0 Kudos

The reason why you get an error message about an order being processed by some user may be the following:

- you call BAPI_TRANSACTION_COMMIT in your program and the database update operations start in update task

- your program does not wait for the update task to finish, it start the next transaction - batch input for IW32 - so this transaction finds data locked

The solution is either to wait for the update task to finish or make the system not to perform BAPI updates in an update task at all.

To wait for the update task to finish you can call BAPI_TRANSACTION_COMMIT with an input parameter WAIT = 'X'.

To make system not to perform BAPI updates in an update task you can perform "set update task local" before calling BAPIs.

regards

0 Kudos

I cannot call the BAPI BAPI_ALM_CONF_CREATE in update task because there are import parameters so I decided to use the WAIT parameter during the BAPI_TRANSACTION_COMMIT but my problem is performance issue. It seems to be taking longer than doing a BDC with a call transaction. Is is correct? Is there a better way to do this to avoid performance problems?

0 Kudos

You're not supposed to call BAPI_ALM_CONF_CREATE "in update task" - I just meant that this bapi internally may perform calls to some function modules "in update task" and that's why commit triggered by the subsequent BAPI_TRANSACTION_COMMIT called without WAIT = 'X' returns immediately to the calling process - while the actual process of updating data is still not finished yet and running in a separate, "update" process.

If you have noticed that BAPI_TRANSACTION_COMMIT called with WAIT = 'X' takes longer to perform - that's just the reason why: it does not return immediately but waits until the update is really finished and all data locks released. This must take longer than a call to BAPI_TRANSACTION_COMMIT without WAIT = 'X' because the latter only <u>initiates</u> commit in a separate process and returns to your program immediately regardless whether the commit has finished or not.

If you want to perform 2 separate transactions, one after the other, and both these transactions need to lock the same data, you won't get rid of errrors you get if you don't make the first transaction release its locks. You can achieve this only by waiting until the commit of the first transaction is done.

You can check if the performance will be better when using the other method I mentioned, that is using statement "set update task local" before calling bapi's (here you don't care about parameter WAIT - it can be =space).

good luck