‎2008 Apr 28 10:29 PM
Hi people,
If I put a UPDATE statement in a code I need obligatory to put 'COMMIT WORK' after that to make true it or not necesary?
UPDATE zavg_bal_table FROM wa_zavg.
COMMIT WORK
Thanks for the help!
‎2008 Apr 28 10:39 PM
UPDATE zavg_bal_table FROM wa_zavg.
if sy-subrc = 0.
COMMIT WORK.
endif.
‎2008 Apr 28 10:39 PM
UPDATE zavg_bal_table FROM wa_zavg.
if sy-subrc = 0.
COMMIT WORK.
endif.
‎2008 Apr 28 10:46 PM
No its not compulsary to put the commit work statement. But if you dont put that it may take some time depending upon where have you used this code (LUW concept)
and its better to use lock objects before updating the database to avoind any conflict,which might occur if some another person is also trying to update the same kind of data
‎2008 Apr 28 11:06 PM
Hello Carlos
If you commit the operation just after the update, if there is an error you wont be able to rollback the operation, so have to be aware of it.
The commit will be automaticaly done after program´s execution.
It depends on what you need...
Bye
Gabriel
‎2008 Apr 29 2:10 AM
Thanks to everyone!
But... In the code I check that is I don't put the commit work the update statement not work. If I don't put that, in the table I can't see the records updated...
I have the update statement into a loop... but I don't know why is not working without the commit.
‎2008 Apr 29 4:03 AM
There are some places that SAP will issue its own commit work and I've certainly encountered some report programs, for example, that have relied on this "feature" for them to work... However it is best practice to issue the commit work explicitly - there are some features of SAP that will not work unless you do e.g. a workflow trigger, email send, XI proxy send etc.
Jonathan
‎2008 Apr 29 4:21 PM
Hello Carlos
You wont see the updated records until the program ends...if still not seeing anything check tables keys...your may be repeating data so will not update any records.
Bye
dont forget to reward
Gabriel P-
‎2008 Apr 29 5:53 PM
Hi,
It is not compulsory to write Commit statement.
If you commit the operation after the update, if there is an error you wont be able to rollback the operation.
Regards,
Kinjal
‎2008 Apr 29 6:05 PM
Thanks all for the responses. Today I will try to wait the finish of the program to see if without the commit statement the update works... because yesterday I tested without waiting the ending execution of the program.
I let you know the results.
Thanks again!