07-14-2008 8:12 AM
We want update more than two tables at one time,for example we code following:
update A set ***
update B set ***
we first update A, but sometimes B can not be updated sucessful,
How to update A&B tables in its entirety? Or, if any one of these tables can not be updated sucessful,two talbes don't update at all.
Thank you very much?
07-14-2008 8:50 AM
Thank you!
But when I only use ' update A*** ' (not commit work),the table A have been updated.
if the table B can not been updated sucessful, do we need delete the information from A?
Could you pls give me a example code?Thank you very much.
07-14-2008 8:19 AM
Hi susi,
Use COMMIT WORK after your update statements..
Best of luck,
Bhumika
07-14-2008 8:42 AM
hi,
You want to update or not update at all that means either Update or rollback.
So Put A COMMIT WORK statement after the update starement.
It will either fully update or Automatically Rollback the whole
Processing.
Regards
Sumit Agarwal
07-14-2008 8:50 AM
Thank you!
But when I only use ' update A*** ' (not commit work),the table A have been updated.
if the table B can not been updated sucessful, do we need delete the information from A?
Could you pls give me a example code?Thank you very much.
07-14-2008 9:32 AM
after the first update statement...check for sy-subrc..
if sy-subrc eq 0.
use the second update.
if sy-subrc NE 0.
restore the original value of the first table field using update statement only..
endif.
07-14-2008 9:54 AM
thank you very much,I find the solution:
update A ***.
if sy-subrc = 0.
update B****.
if sy-subrc = 0.
commit work.
else.
rollback work.
endif.
else.
rollback work.
endif.