2013 Jun 05 3:02 PM
Hi all
I have requirement where i need to update records in 2 database tables.
My first doubt is can we update 2 database tables at same time with code..
or if not..how do we do it one after another??
and suppose if i am doing database update 1 after another//
if first database table update is not happened, i want to stop the database update of second table???how can i achieve it?
and if first database table update is done successfully. 2nd dbtable also should get updated...
Thanks
2013 Jun 05 3:14 PM
Are these Z tables?
If not, then think very hard before doing.
If they were however say za and zb.
A simple logic of:
Lock za
Lock zb
Update za from waza
update zb from wazb
If either fail roll back
else commit
unlock za
unlock zb
could be very reasonable. That puts za and zb in the same LUW.
Would you please explain in more detail what you fully need.
Neal
2013 Jun 05 3:18 PM
I hope these are custom tables...
use update/modify statement (depending on your requirement)it would return a sy-subrc if it is 0 go ahead and update the second database table, if not then roll back , if both returns a sy-subrc as 0 then only commit work else put a roll back.
look for abap help F1 for how to use update/modify syntaxes and uses.
2013 Jun 05 6:26 PM
Hi,
You can update two or 'N' database tables at the same time.
For the other Query please refer Neal's or Manoj's Answer.
BR,
Ankit.