Starts a transaction, allowing you to perform data operations on several business objects.
Use the EndTransaction method to end the transaction and free locked records, allowing other users to access them.
| Visual Basic |
|---|
Public Sub StartTransaction() |
Use this method when you want to perform data operations on several business objects:
- If the operations succeed, either commit the transaction to save the data in the database, or roll back to discard the changes.
- If one of the operations fail, the DI API rolls back the transaction, which discards the changes. After a failed DI API call in the transaction, you must immediately exit the transaction (see the example below).
When working with transactions, make sure to check the return code when executing SAP Business One APIs and, if an error occurs, immediately exit the transaction. If a call fails, SAP Business One automatically ends the transaction with a rollback (of all actions up to that point); if you do not exit the transaction code, all subsequent code is still executed even though an error occurred.
| Starting a transaction (C#) | Copy Code | |
|---|---|---|
| ||