Database.Commit() Method

Version: Available or changed with runtime version 1.0.

Ends the current write transaction.




This method can be invoked without specifying the data type name.


When a codeunit begins, it automatically enables write transactions to be performed. When an AL code module completes, it automatically ends the write transaction by committing the updates made by the AL code.

This means that if you want the codeunit to perform a single write transaction, it is automatically handled for you. However, if you want the codeunit to perform multiple write transactions, you must use the Commit method to end one write transaction before you can start the next. The Commit method separates write transactions in an AL code module.


The following pseudo-code example contains two write transactions. When it begins, a write transaction is automatically started. Using the Commit method, you end the first write transaction and prepare for the second. When the code completes, the second write transaction automatically ends.

(AL Statements) // Transaction 1  
(AL Statements) // Transaction 2  

See Also

Database Data Type
Get Started with AL
Developing Extensions