2019 Oct 05 8:14 PM
Hello Gurus,
I want to know what is the difference between FM DB_COMMIT and the ABAP statement COMMIT WORK. The function module DB_COMMIT will commit all the database changes (but COMMIT WORK will also do the same thing ) , then what is the significance of writing a DB_COMMIT . I read that DB_COMMIT will end the DB LUW and COMMIT WORK will end the SAP LUW but is there any practical example where we can demonstrate the difference between two?
2019 Oct 06 6:09 AM
Hello subhant banerjee,
Both Commits you have mentioned above is just type Database Commits, let me explain further for better understanding!
What is a Database Commit?
These are commands/Controls that system posses to close all the opened cursors that are applied on the table.
In other words during program execution which directly/indirectly deals with tables, system will be locking the table up front until its operation is complete on the associated tables. These commit statements helps in releasing the table for other work processes i any.
These are two Types:
1) Implicit Commits
2) Explicit Commits
Implicit Commits:
These are the ones that will create its own work process to start and LUW, which means it will not interfere in other work process and waits until gets completed and once there are free Work process it will begin to start its LUW with the available work process. As the Name indicates, the call is implicit and in real time they get triggered at below Instances:
--> After completion of user interaction in any transaction.
--> After completion of FM call both Synchronous/Asynchronous Call.
--> When an external framework is used.
I short this Implicit Commits will work upon all open database connections
Explicit Commits
Well these are the commits we are most used to. As the name indicates the Commit statements that are explicitly coded in the program are called as Explicit Commit.
Even Calling the FM DB_COMMIT explicitly in the program is also Explicit Commit. We would have used it many of our developed objects.
As you have mentioned this Commit closes the open LUW that is running.
To Summarize:
--> An Implicit Commit (DB Commit) Closes only the Database Connections but an Explicit Commit in addition to DB connections it also closes the LUW which is Running.
--> An implicit Commit (DB Commit) waits for the Work process to get released to initiate its own LUWs for closing DB Connections but an Explicit Commit Will close the DB connections and the respective LUW in the same cycle and finish the necessary actions for the LUW.
--> This is the exact reason we explicitly call the COMMIT WORK statement because we wanted to progress further quickly with next steps of operations and we can't really afford to wait for system To close the DB connections on its ow time Frame.
Hope you got a better idea now!
Regards!
2019 Oct 06 6:09 AM
Hello subhant banerjee,
Both Commits you have mentioned above is just type Database Commits, let me explain further for better understanding!
What is a Database Commit?
These are commands/Controls that system posses to close all the opened cursors that are applied on the table.
In other words during program execution which directly/indirectly deals with tables, system will be locking the table up front until its operation is complete on the associated tables. These commit statements helps in releasing the table for other work processes i any.
These are two Types:
1) Implicit Commits
2) Explicit Commits
Implicit Commits:
These are the ones that will create its own work process to start and LUW, which means it will not interfere in other work process and waits until gets completed and once there are free Work process it will begin to start its LUW with the available work process. As the Name indicates, the call is implicit and in real time they get triggered at below Instances:
--> After completion of user interaction in any transaction.
--> After completion of FM call both Synchronous/Asynchronous Call.
--> When an external framework is used.
I short this Implicit Commits will work upon all open database connections
Explicit Commits
Well these are the commits we are most used to. As the name indicates the Commit statements that are explicitly coded in the program are called as Explicit Commit.
Even Calling the FM DB_COMMIT explicitly in the program is also Explicit Commit. We would have used it many of our developed objects.
As you have mentioned this Commit closes the open LUW that is running.
To Summarize:
--> An Implicit Commit (DB Commit) Closes only the Database Connections but an Explicit Commit in addition to DB connections it also closes the LUW which is Running.
--> An implicit Commit (DB Commit) waits for the Work process to get released to initiate its own LUWs for closing DB Connections but an Explicit Commit Will close the DB connections and the respective LUW in the same cycle and finish the necessary actions for the LUW.
--> This is the exact reason we explicitly call the COMMIT WORK statement because we wanted to progress further quickly with next steps of operations and we can't really afford to wait for system To close the DB connections on its ow time Frame.
Hope you got a better idea now!
Regards!
2019 Oct 09 8:26 AM
Thanks Satish for your answer. Really helpful.