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_TRANSACTION_COMMIT with WAIT = 'X' Still work after error modify table

Former Member
0 Kudos

Hi Experts,

I have some problems about commit transaction.

in my function module which the processing type is remote-enabled mode (already used for web service)

i have calling function of 'BAPI_GOODSMVT_CREATE' and put

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'

after the 'BAPI_GOODSMVT_CREATE' function.

There is a problem with 2 cases:

the first one is error when modify data of Transparent Table

and the second is some network fail.

my question is why there is an error like above but the commit still working?

i assume when i put wait = 'X' is mean if there is some error in function module, it should not commit the transaction.

here is some of my code:

Thank you in advance 🙂

*Sorry for my bad english

1 ACCEPTED SOLUTION

iftah_peretz
Active Contributor
0 Kudos

Hey, The Bapi_transaction_commit is basically running this command with message handling and buffer cleaning. The "WAIT" variable of the function is a flag decision for using (or not) the "AND WAIT" addition. Read the link and note especially this part: "If the addition AND WAIT is not specified, the program does not wait (in non-local updates) until the update work process has executed it (asynchronous updates), but instead is resumed immediately after COMMIT WORK. However, if the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating)."

3 REPLIES 3

iftah_peretz
Active Contributor
0 Kudos

Hey, The Bapi_transaction_commit is basically running this command with message handling and buffer cleaning. The "WAIT" variable of the function is a flag decision for using (or not) the "AND WAIT" addition. Read the link and note especially this part: "If the addition AND WAIT is not specified, the program does not wait (in non-local updates) until the update work process has executed it (asynchronous updates), but instead is resumed immediately after COMMIT WORK. However, if the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating)."

0 Kudos

Thank you for your answer, after i read your answer i realize it i was wrong. i think i want to try to replace the commit work at the end of the code. Thank you for your answer. 🙂

raymond_giuseppi
Active Contributor
  • You must always read/loop at return parameter when you call a BAPI before committing the work. This Is not optional.
  • The wait option only waits for the high priority update task FM (VB1) to be executed
  • There can be delay due to database or buffering update
  • When using WAIT option BAPI_TRANSACTION_COMMIT can return an error in RETURN parameter, else if some update FM aborts/dumps the error can be seen in SM13 (and trigger a message)

This information is available and easy to find in online help, look for SAP Transaction Concept or COMMIT WORK statement