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

Rollback a transaction

Former Member
0 Likes
553

Dear All,

I am calling an RFC from VB.

The RFC first executes a BDC, then a BAPI and finally inserts data in z-table.

In case operation fails in any one process, I want to rollback.

Is this possible ? if yes then plz let me know.

Thanks.

Dear All,

I am calling an RFC from VB.

The RFC first executes a BDC, then a BAPI and finally inserts data in z-table.

In case operation fails in any one process, I want to rollback.

Is this possible ? if yes then plz let me know.

Thanks.

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
526

for BAPI u can use BAPI_TRANSACTION_ROLLBACK

and for BDC you can put a commit and wait statement in a condition..

if <condition> eq 'false'.
commit work and wait.
endif.

Read only

Former Member
0 Likes
526

call commit BAPI after entire process is done...

this way is anything fails in between data will not get comitted...

Read only

Former Member
0 Likes
526

Hi,

In BAPI we can use BAPI_TRANSACTION_ROLLBACK.

FORM commit_work .

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = ' '.


ENDFORM.                    " COMMIT_WORK

For BDC we can commit in following way.

CALL TRANSACTION 'SE38'  USING BDCDATA  MODE 'N' 
                           MESSAGES INTO ITAB.

A call transaction ends successfully for the following reasons:

1. COMMIT WORK

2. Next screen = 0

3. LEAVE TO TRANSACTION SPACE.

If any errors are found they get stored in itab as above.

We can handle that error message and commit the work.

If itab[] is initial.

commit and wait.

endif.

Hope this helps you.

plz reward if useful.

thanks,

dhanashri.

Read only

former_member435013
Active Participant
0 Likes
526

Hi,

Your procedure should first lock all necessary data.

After that it should check out whether intended changes are possible.

If it is not possible remove locks and provide negative return.

If it is possible perform your changes, remove locks and provide positive return.

Regards

Walter Habich

Edited by: Walter Habich on Jul 7, 2008 8:30 AM