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

How to use transactions


I am trying to implement transaction on an Objects. When I use Company.StartTransaction , my application becomes very slow. I want to know how it works? Does it lock the object? If it locks how to implment concurrent users transactions? How to avoid deadlock?

Thanks & regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2012 at 03:12 PM


    transaction handling:

    - local transaction (single transaction)

    so basically each data manupilation (update, add) over a business objects using a transaction, called local transaction of the business object.

    Business Object means DI API objects, like Documents, BusinessPartners, Items, etc.

    Example: if you issue a sales invoice document, it writes many tables in the background in a single transaction.

    Dim oDoc as SAPbobsCOM.Documents
    Set oDoc = oCompany.GetBusinessObject(oInvoices)

    This not causes deadlocks, only wait locks on the object while the process is finish. It has automatic rollback procedure, and you can query the result (eg the transaction is commited or rolled back) by the return code of the transaction. if return code differs from 0 you have a rollback event, and the error. If return code is 0 the transaction is commited

    lRetCode = oDoc.Add()

    - global transaction

    This global transaction can be used when you load large amount of flow pending data, and if there is an error in the flow you must redo (rollback) all your operations in the transaction. It is overrides the single transactions

    you can start the transaction by


    if the job finished, then you can till decide you dismiss the operations (roll back) or accept the data (commit). operations with business objects in the flow can do automatic rollback before you commit your work you may inquery the transation status

    if (oCompany.Intransaction) then 
    end if

    If is comfortable used with Try Catch End Try error handling.


    you load Business Partners and sales orders into SAP B1. If your business partner import is fails, your sales order will defekt by missing the business partner. In this case you can use global transaction for each BP - Sales Order pair. some pseudo code: BP's

    2. start loop over BP-s

    3. Add BP

    - if BP cannot be added, skip loop and take next BP (step 5)

    4. Add Sales Order

    - if Sales Order cannot be added, rollback transaction and goto step 5, In this case BP and sales order will be not added.

    5 look for next BP

    This can cause deadlock's in the system, so take care usage of this.



    Edited by: Janos Nagy on Jan 3, 2012 4:13 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2012 at 04:08 PM

    Thank you very much for your reply. I am using global transactions and users are trying to save the data in the table at the same time. In that case, My system is not responding. I am using Silverlight application. How do I avoid the slowness and implement transactions.

    Add a comment
    10|10000 characters needed characters exceeded

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.