SAP RFC execution Commit/Rollback transaction

Hi All,

I have a requirement where I have to execute RFC first and then webService on some other server. Based on webService call response, either I have to Commit the RFC call or Rollback the RFC call accordingly.

Can anyone please tell me if webMethods have that feature just like XA_Transaction execution of databases?

Please help and appreciate in advance.


Yes, webMethods has the necessary prerequisites. But you need the necessary prerequisites on SAP side as well, meaning the RFC function module you call needs to be an “update task” function module. (See the SAP documentation for more details. Basically it means the function module does not write its changes directly into the database tables, but into the VBLOG area. Only if a COMMIT WORK is triggered afterwards, the changes will be persisted into the SAP database.)

So assuming your function module uses the “update task” feature, then you can implement you scenarion as follows:

a) invoke (this locks an RFC connection from the
connection pool exclusively for the current session, which is necessary for
the update task to work)

b) call your function module

c) call your Web Service

d) if (webservice successful) invoke
(this calls the function module BAPI_TRANSACTION_COMMIT, which
triggers a COMMIT WORK in the current user session on SAP side)
else invoke (triggers a ROLLBACK WORK
in the current user session on SAP side)

e) invoke
(releases the exclusively locked RFC connection back to the pool and
resets the user session on SAP side)

Don’t forget step e)…! Otherwise your pool will soon run out of connections…
(A good idea is to perform this step in a finally block, if you use Java.)

BTW: the service names above are from webMethods 6. I haven’t seen a webmethods 7 system, yet, so not sure whether the names are still the same. But the necessary functionality will definitely also exist in wM 7.


Hello Lanzelot,
I ve the same set of code in mine to avoid parallel processing but below is the error that i got it…

""No session ID given, cannot release locked connection "

Please have a look at the thread “” to get more details of the error that i am facing.

Thanks in advance,