Application Development and Automation 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: 
Read only

Transaction rollback

Former Member
0 Likes
717

Hi,

I am using 'Call transaction...' statements for transactions VAP2 and XD02. If something goes wrong with XD02, changes made thru VAP2 should be rolled back.

Please advise me...

-Tejal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
644

Hi,

Each call transaction will be committed immediately and I don't think you can rollback that.

Probably you might want to look at calling BAPI's so that you can control commit and rollback.

Regards,

Ravi

Note : Please mark all the helpful answers

5 REPLIES 5
Read only

Former Member
0 Likes
645

Hi,

Each call transaction will be committed immediately and I don't think you can rollback that.

Probably you might want to look at calling BAPI's so that you can control commit and rollback.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
644

Hi Tejal,

they are independent transactions, so Roll back won't work, it is not possible to control also if you use Call transaction.

Regards

vijay

Read only

0 Likes
644

Thanks Vijay and Ravi both!!

Read only

Former Member
0 Likes
644

You can do it, but not through the rollback process. Before you change the contact information, keep everything that was changed in an internal table. If there's a problem with the customer, you can then call XD02 again and change the contact information back the way it was.

I've done this for a different process and it works quite well. The logic for you would be something like:


PERFORM call_vab2
  TABLES new_contact_data.
IF...   "the call to VAP2 is ok
  PERFORM call_xd02
    TABLES customer_data.
  IF...   "the call to xd02 didn't work.
    PERFORM call_vab2
      TABLES old_contact_data.
  ENDIF.
ENDIF.

Rob

Read only

Former Member
0 Likes
644

In calling the transaction, fill in the parameter RACOMMIT in CTU_PARAMS as 'X'

x_ctuparams-DISMODE = 'N'.

x_ctuparams-UPDMODE = 'A'.

x_ctuparams-DEFSIZE = 'X' .

x_ctuparams-RACOMMIT = 'X'.

call transaction <TCODE> using it_bdcdata options from x_ctuparams.

This wouldn't commit the transaction by default.

<b>call transaction <TCODE1> using it_bdcdata options from x_ctuparams.

call transaction <TCODE2> using it_bdcdata options from x_ctuparams.

if sy-subrc = 0.

commit work.

else.

ROLLBACK WORK.

endif.</b>

Regards,

Ravi