Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
Definition:

When a data operation is performed on a business object, a transaction is started. If the operation is successful, then a Commit is issued and the data is saved. If the operation fails, then a Rollback is issued and the data is discarded.

This kind of transaction handling is sufficient as long as only one business object is being modified.

If you want to perform a consistent transaction that contains changes to more than one business object, Global Transaction is used. You must specify the start and end of the transaction using the company object methods StartTransaction and EndTransaction.

In other words, a Global Transaction is a logical unit of work in which:

  1. All operations are either successful or unsuccessful.

  2. Operations are performed that correctly transform data from one consistent state to another.


When GLOBAL TRANSACTIONS are used, the database isolation levels are maintained at the highest level. This means all the resources (tables, indexes, views etc.) will have exclusive locks and will be blocked for any operation by other transactions.

StartTransaction:

Use this method to start a Global Transaction that can contain multiple changes to several business objects.

When you call StartTransaction, all business object changes that are issued after this call and before a following call to the method EndTransaction, belong to one logical unit of operation.

If one of the business object changes fails during any process, the transaction ends and a rollback is issued automatically.

EndTransaction:

Use this method to end the Global Transaction started by StartTransaction method.

You must pass a parameter to EndTransaction (endType as SAPBobsCom.BoWfTransOpt) to indicate whether the changes contained within this transaction are to be committed or rolled back.

Common Issues:

  1. When one of the user uses GLOBAL TRANSACTION, other user using SAP Business One System forms or add-on forms freezes.

  2. When one of the user uses GLOBAL TRANSACTION, login to Business One Application might become slow.

  3. Business One application users and Add-on application might crash or transaction end with error code -2038,-2039 or -5002

  4. Using transactions can also increase the number and extent of locks (or other isolation mechanism, depending on the database) used in the system, which can lead to concurrency issues.


Recommendations:

  1. Every StartTransaction should be completed with the EndTransaction method.

  2. Use the GLOBAL TRANSACTIONS only for short duration transactions with less concurrency.

  3. If you are running complex time consuming logic, please schedule such activity on productive hours.

  4. Make sure logic involving GLOBAL TRANSACTIONS does not wait for user inputs.

  5. Do not use multithreaded programing with GLOBAL TRANSACTION, this will lead to data inconsistency. Be aware that DI API does not support multithreading.

  6. Employ retry mechanism in case of deadlock errorcode – 2038. Refer to SAP Note 1444532 for the same.

5 Comments