Transactions in Axapta
The X++ language supports three statements that you are probably well-acquainted with to support transactions when performing data manipulation in Axapta:
• ttsBegin: Starts a transaction block
• ttsCommit: Closes a transaction block and commits the data to the database
• ttsAbort: Closes a transaction and rolls back all data manipulation within the current transaction block
If data manipulation statements performing inserts, updates, or deletes are not enclosed in a transaction block, Axapta automatically commits with every insert, update, or delete statement.
If Axapta terminates abnormally or exits with open transactions, then all transactions not committed explicitly or implicitly are rolled back automatically.
It goes without saying that you should lock records that you select for updating by using the forUpdate keyword in X++ select statements.