Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HOW to rollback transaction?

Former Member
0 Kudos

expert:

two transaction is CALL TRANSACTION tcode1 and CALL TRANSACTION tcode2 perform in turn.

if Call transaction tcode2 occurs error ,CALL TRANSACTION tcode1 will be rollback.how to do it.

thanks in advance.

fgq.

12 REPLIES 12

former_member181995
Active Contributor
0 Kudos

Can you bit elaborate the term Rollback?

0 Kudos

tcode1 is reversed

0 Kudos

Not sure but you can try with Submit <your report name> if your tcode2 contains error.

Former Member
0 Kudos

Hello There.

While calling the transaction from program we use SUBMIT statement.

I hope you also have used that statement.

If this statement is removed after calling of the transaction, there is no updating and automatic rollback is performed.

If this is the case then that's good.

If not then you can give feedback.

Good Luck & Regards.

Harsh Dave

0 Kudos

my program don't submit report,I will perform two tcodes: 'mb1b'. Material move type is '541' and '309'.

0 Kudos

try somthing like:

call transaction tcode2.

if fails.

submit <current reportname>.

endif.

0 Kudos

at first tcode1 is performed ,then tcode2 is performed.

0 Kudos

Hello There.

I suppose you will have to use, (SAY)

loop at _____

If ____ sucess.

COMMIT WORK.

else.

ROLLBACK WORK.

endif.

endloop.

COMMIT WORK statement updates the database.

If there is no COMMIT WORK, the transaction is terminated in case of error ROLLBACK WORK serves the purpose.

If that solves its fine and if not give feedback.

Good Luck & Regards.

Harsh Dave

Former Member
0 Kudos

you can use this for example:

call tarnsaction tcode1.

if sy-subrc = 0.

call transaction tcode2.

if sy-subrc = 0.

commit work.

else.

rollback.

endif.

endif.

Hope this will solve the problem.

0 Kudos

to perfom commit work and rollback work has no effect to call transaction....

but thank very much.

fgq

Former Member
0 Kudos

try posting reversal 542 if tcode 2 fails... i think you cant rollback work in tcode1 if you fail in tcode 2. because it is already commited work and separate transaction. hope it helps

0 Kudos

Your answer is good. But i want rollback like database.