Skip to Content
0
Former Member
Dec 18, 2013 at 03:01 AM

How to rollback the premised result of function modules

439 Views

Hi, Experts

Now I'm developing the function module which calls 2 other function modules by itself as below.

---- FM which I'm developing ----

Call Function 'FM1'

Call Function 'FM2'

But I need to write 'Commit work' or 'BAPI_TRANSACTION_COMMIT' between FM1 and FM2 because FM2 is based on commit of FM1.

---- FM which I'm developing ----

Call Function 'FM1'.

IF SY-SUBRC = 0.

COMMIT WORK. "or BAPI_TRANSACTION_COMMIT

ENDIF.

Call Function 'FM2'.

And then, I have a problem.

Even though FM2 is failed, commit of FM1 is completed. I would like to rollback the result of FM1 and FM2 when failing.


I heard that assigning 'COMMIT WORK AND WAIT' into between FM1 and FM2 achieves my above requirement.

But I don't know how to write it.

Let me know how to use COMMIT WORK AND WAIT or the way to rollback the result of all function modules.

Thanks,

yuki