12-16-2016 8:55 AM
Dear experts,
I just've seen following code and would like to ask why I have to confirm after I did a rollback?
Thanks in advance.
BR.
Denis.
12-16-2016 9:21 AM
As you can see, COMMIT is not directly after ROLLBACK ; so maybe it's because the between code (INSERT_TABLE) updates the database, or do some other stuff related to SAP LUWs.
12-16-2016 9:21 AM
As you can see, COMMIT is not directly after ROLLBACK ; so maybe it's because the between code (INSERT_TABLE) updates the database, or do some other stuff related to SAP LUWs.
12-16-2016 4:35 PM
As Sandra said, looks good to me, you are logging the error and then committing the log to the database. Actually pretty darn good, because who ever wrote that code is thinking forward to supporting the system!
12-16-2016 5:09 PM
Hi,
As you can see the message is into lv_msg.
and you do after that mo_log->insert_message()
That commit is because of the method insert_table, to make sure the data was inserted in the table..
If that table is for error log the commit after the error message is to guarantee the error was saved in the log table to display when necessary.
Best Regards
Filipe Sardinha
12-16-2016 7:11 PM
ABAP Help:
The statement ROLLBACK WORK closes the current SAP LUW and opens a new one.
In this case COMMIT WORK belongs to the LUW that was started after ROLLBACK. If there was no code at all in between then, of course, this would just make no sense. Also I'd say that you don't necessarily have to do COMMIT here (because there is always COMMIT at the end of the program) but it could be needed depending on the context and requirement, as Raghu noted.