Home » Microsoft » MB6-704 » What should you use?
You are developing X++ code to update multiple records as a single transaction. The records are located in several tables.
You need to ensure that if an update of one of the records falls, none of the records update.
What should you use?
A. Try and catch
B. Tts begin and tts commit
C. Insert record set and tts abort
D. For update and tts abort
Correct Answer: B
Explanation/Reference:
ttsLevel Checking
This check ensures that no record can be updated or deleted except from within the same transaction scope as it was selected for update. Integrity is ensured by using the following statements:
* ttsBegin: marks the beginning of a transaction. This ensures data integrity, and guarantees that all updates performed until the transaction ends (by ttsCommit or ttsAbort) are consistent (all or none).
* ttsCommit: marks the successful end of a transaction. This ends and commits a transaction. MorphX guarantees that a committed transaction will be performed according to intentions.
* ttsAbort: allows you to explicitly discard all changes in the current transaction. As a result, the database is rolled back to the initial state–nothing will have been changed. Typically, you will use this if you have detected that the user wants to break the current job. Using ttsAbort ensures that the database is consistent.
Reference: Transaction Integrity [AX 2012]