BAPI_TRANSACTION_COMMIT with WAIT = 'X' in BADi
What would be the effect of using "BAPI_TRANSACTION_COMMIT" with the "WAIT" parameter when it is "X" inside the BADi? Should I expect SAP to transfer data when LUW is running?
I know that inside "BAPI_TRANSACTION_COMMIT" this happens "COMMIT WORK" or "COMMIT WORK AND WAIT" if you give the parameter "WAIT" = "X".
I also know it is wrong to do "COMMIT WORK" inside BADi, but what if I use "COMMIT WORK AND WAIT" via BAPI?
The SAP documentation regarding COMMIT states:
Executes all high priority update function modules (VB1) in the order of their registration and in the general LUW database. If you do this without specifying the AND WAIT addition, the program does not wait while it has completed the update process (asynchronous update), but instead resumes immediately after COMMIT WORK. However, if AND WAIT is added, program processing after COMMIT WORK will not continue until the update work process has completed the high-priority update function modules (synchronous update).
When all of the high performance update function modules have completed successfully, the operator executes the low priority (VB2) update function modules in order to register together in the shared LUW database.
My confusion arises from the fact that we have a BADi implementation where there is a call to the specified function with the parameter "WAIT" = "X" and we found SAP Notes where it forbids the use of "COMMIT WORK" inside this BADi, however it says "COMMIT WORK", not "COMMIT WORK AND WAIT".
So, I might think the implementation is correct, because this data will be committed when LUW finishes ... or not. Any comments?
source to share
LUW actually ends when you call COMMIT WORK
or COMMIT WORK AND WAIT
. The only difference is that it COMMIT WORK
is asynchronous and COMMIT WORK AND WAIT
is synchronous.
Parameter BAPI_TRANSACTION_COMMIT
with parameter WAIT
is COMMIT WORK AND WAIT
. Without a set of parameters, it is equal COMMIT WORK
.
And it is true. You do not have to commit to the BAdI. What if there is a rollback after the BAdI has already been executed? It can leave your data in a completely inconsistent state.
source to share