webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

SAP RFC execution Commit/Rollback transaction

  • 1.  SAP RFC execution Commit/Rollback transaction

    Posted Wed October 14, 2009 09:20 PM

    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.

    Thanks,
    Santhosh.


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards


  • 2.  RE: SAP RFC execution Commit/Rollback transaction

    Posted Thu October 22, 2009 04:29 PM

    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 pub.sap.client:lockSession (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 pub.sap.bapi:commit
    (this calls the function module BAPI_TRANSACTION_COMMIT, which
    triggers a COMMIT WORK in the current user session on SAP side)
    else invoke pub.sap.bapi:rollback (triggers a ROLLBACK WORK
    in the current user session on SAP side)

    e) invoke pub.sap.client:releaseSession
    (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.

    Lanzelot


    #Adapters-and-E-Standards
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: SAP RFC execution Commit/Rollback transaction

    Posted Wed October 31, 2012 04:25 PM

    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 “[URL]wmusers.com” to get more details of the error that i am facing.

    Thanks in advance,
    Priya


    #Integration-Server-and-ESB
    #webMethods
    #Adapters-and-E-Standards