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: 

regarding commit work

Former Member
0 Kudos

Hi all,

Iam inserting/updating one z-database table through my report.

that z-table is going to update only through my report.

now thing is after modify z-table statement i didn't use any commit work statement......

and my report is already transported to quality........

can any one suggest me what will happen if I update any database table and didn't use the commit work?......

is the system will perform auto commit work for my z-table.... if it performs when it will do?.... when it is going to close the LUW.

if commit work is not used..... is the select query on that z -table is not going to work?....

any suggestion will be rewarded....

Regards,

cnu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

The COMMIT WORK and ROLLBACK WORK are important in any DB updation but if you have not used COMMIT WORK there will not be any issue. But lets say you are updating 10 entries and 5 updated and some error occured then those 5 entries will be commited and no rollback will happen. No need to much worry as it is a Z table and used only in your program.

If you still want to add the LUW concepts then just add them and create another TR.

Regards,

Atish

3 REPLIES 3

Former Member
0 Kudos

Hi,

The COMMIT WORK and ROLLBACK WORK are important in any DB updation but if you have not used COMMIT WORK there will not be any issue. But lets say you are updating 10 entries and 5 updated and some error occured then those 5 entries will be commited and no rollback will happen. No need to much worry as it is a Z table and used only in your program.

If you still want to add the LUW concepts then just add them and create another TR.

Regards,

Atish

Former Member
0 Kudos

So long as the program finsishes normally, there will be an implicit commit at the end. The problem will be if it abends. I'm not sure under what circumstances a rollback will be done. If you return an error message, I'd expect a complete rollback, but if there's just a return code of 4 say, It might do the commit. You can experiment in your development server.

I'd expect all records to be either committed or rolled back, though.

Rob

Former Member
0 Kudos

Hi

commit work is mainly used for database operations .

commit work means if all the stetments above that works fine then it will execute if one fails it won't execute

you can see discription here

reward if usefull

The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process. In this case, COMMIT WORK performs the following actions:

It executes all subroutines registered using PERFORM ON COMMIT.

It triggers an internal event in Object Services that ensures the registration of changes in persistent objects as the last update function module, as well as the subsequent initialization of persistent object attributes.

It initiates the processing of all registered update function modules in the update work process.

This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).

If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.

In parallel, it also executes the individual function modules registered using CALL FUNCTION ... IN BACKGROUND TASK DESTINATION in a separate database LUW for each destination.

It handles all SAP locks set in the current program according to the value of the formal parameter _SCOPE of the corresponding lock function modules.

It triggers a database commit that also terminates the current database LUW.

The completion of statement COMMIT WORK triggers the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE, where the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>COMMIT_WORK.

If the statement COMMIT WORK is executed by calling special programs, be aware of the following:

In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.

In a program called using CALL DIALOG, COMMIT WORK initiates the processing of subroutines or updated function modules registered using PERFORM ... ON COMMIT and CALL FUNCTION ... IN UPDATE TASK. Therefore, it does not complete the current SAP LUW. The SAP LUW cannot be completed until you execute the COMMIT WORK statement in the calling program.

You cannot execute the COMMIT WORK statement during the updating procedure or during the execution of subroutines registered using PERFORM ... ON {COMMIT|ROLLBACK}.