11-22-2005 3:44 PM
Hi,
Does SAP support database transations, what I am doing is getting the values from one Zdatabase table , and taking a value which holds the total, adding one to this , and placing the record in a differnt ztable, and then incrementing the 'total' value in the orginal; ztable , I obviously want to make sure the whole transaction occurs or nothing, I'm using insert , update in opensql.
Thanks
11-22-2005 3:49 PM
11-22-2005 3:48 PM
Hi Sims,
The required all-or-nothing cane be done using a flag based approach.
You can set a flag for succesful updates in both Z tables and based on that flag, you can say
<b>Commit work.</b>
In case of failure use,
<b>Rollback work.</b>
Regards,
Ravi
11-22-2005 3:49 PM
11-22-2005 3:50 PM
You can achieve that by creating Lock objects through SE11. Create one lock object including these tables. Once you do that, the system will generate a ENQUEUE and a DEQUEUE function module. You need to call the ENQUEUE function module before making any updates to the table and then the DEQUEUE after making the updates. This ensures that your data is locked in one single transaction. Now coming to making all updates or no updates, you need to do the entire sequence in one single task. The sequence is
CALL ENQUEUE FUNCTION MODULE
DO THE UPDATES.
CALL DEQUEUE FUNCTION MODULE.
Srinivas
11-22-2005 4:02 PM
And of course as always, Rich and Ravi are correct in saying that you will do a commit or rollback depending on the situation. But the key is to do all of them in one task.