General X++ Development
How do `ttsBegin`, `ttsCommit`, and `ttsAbort` work in X++?
How do ttsBegin, ttsCommit, and ttsAbort work in X++?
1 answer
Write an answerttsBegin starts a transaction scope and ttsCommit commits it.
ttsBegin;
select firstOnly forUpdate myTable
where myTable.RecId == _recId;
myTable.Status = MyStatus::Complete;
myTable.update();
ttsCommit;If an exception escapes the transaction, X++ rolls the transaction back.
You normally do not need to scatter ttsAbort everywhere. The bigger concern is making sure your ttsBegin and ttsCommit levels are balanced and that the transaction is not wider than it needs to be.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer