Skip to Content
author's profile photo Former Member
Former Member

Rollback / Commit in JCO

Hi,

I would like to know how transaction management can be done from JCO. How do I Rollback transactions from JCO??

In Java

{

//Execute RFC through JCO Call(Creates DB record in R/3)

//Face exception here

//I need to roll back the RFC ????

}

Thanking You,

Guru

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 25, 2005 at 07:08 AM

    Hi Guru,

    Welcome to SDN.

    Use BAPI_TRANSACTION_COMMIT to commit changes to DB after any operation. Use BAPI_TRANSACTION_ROLLBACK to roll back.

    Cheers

    Kathirvel

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Karthivel,

      Thanks for ur reply!

      I would like to know if my approach is correct....

      1. I create a TId (transaction ID)

      2. I execute RFCs using this TId

      3. I use BAPI_TRANSACTION_COMMIT(TId) to commit (or)

      4. I use BAPI_TRANSACTION_ROLLBACK(TId) to rollback

      Regards,

      Guru

  • author's profile photo Former Member
    Former Member
    Posted on Aug 25, 2005 at 08:46 AM

    Hi Guru,

    Yes you approach is correct, make sure commit/rollback is possible only when a change is/was made in database.

    Go through these links will be helpful,

    BAPI_TRANSACTION_COMMIT with Web AS/SOAP Interface

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c

    Hope that solves your problem.

    Thanks & Regards,

    Kathirvel

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 25, 2005 at 09:44 AM

    Hi Guru,

    By default auto commit property is set to be false.whn you want to set is then you have explicitly set it to true.

    rdgs,

    guru

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I checked the BAPIs BAPI_TRANSACTION_ROLLBACK and BAPI_TRANSACTION_COMMIT. But these transactions do not take transaction ID as a prameter. So how do I associate the BAPI call with the transaction?

      Regards,

      Guru

  • author's profile photo Former Member
    Former Member
    Posted on Aug 25, 2005 at 11:35 AM

    Hi Guru,

    http://66.102.7.104/search?q=cache:YnarUK_KhHcJ:www.tnatum.com/SAP/SAPPJ/Vol%25202/Issue%25203/p025.pdfrollbackspecifictransactionsidsusingBAPI_TRANSACTION_ROLLBACK&hl=en

    Check this out.

    Regards,

    Kathirvel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 25, 2005 at 11:43 AM

    Hi Guru,

    I think you are performing a process through a Transaction Id (or without it) with the help of a remote enabled function module(RFM). All these changes will not be reflected in DB unless it is committed. Hence after performing the required task through a RFM you can commit it ot rollback it. This commit/rollback will affect for the transaction performed immediately before it. Hence there will not be any problem i suppose (as far as i have known).

    Thanks & Regards

    Kathirvel

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      what about doing a commit before you start doing anything to create a starting point for the transaction and then do a commit/rollback when you are done? Some colleague who does SAP told me that SAP people often do it this way.

      Regards, Oliver Plohmann

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.