Issue :- I was trying to import the class in the application and when I click on any button to import or cancel the import I was getting this error as An unbalanced X++ TTSBEGIN/TTSCOMMIT. which means there are too many TTSBEGIN/TTSCOMMIT statements.
And the TTS level is "2".
At this unable to import the class as the dialog box throws error on all the buttons.
To resolve this error you need to remove all the extra TTSBEGIN/TTSCOMMIT from the code.
This can be done with the simple Job which is return below.
To resolve this error this TTS level should be ZERO, Run this job to get rid of that error, this job will find the tts level where its greater than zero and make it zero by calling TTSABORT.
static void TheAxaptaResetTTS(Args _args)
{
while (appl.ttsLevel() > 0)
{
info(strfmt("Level %1 aborted",appl.ttsLevel()));
ttsAbort;
}
}
Understanding TTSBEGIN /TTSCOMMIT
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.
I got the above information from the below source :
https://community.dynamics.com/ax/b/axaptavsme/archive/2013/08/29/error-an-unbalanced-x-ttsbegin-ttscommit-pair-has-been-detected-in-ax
above blog is very helpful you will get the help for most of the solutions.
And the TTS level is "2".
At this unable to import the class as the dialog box throws error on all the buttons.
To resolve this error you need to remove all the extra TTSBEGIN/TTSCOMMIT from the code.
This can be done with the simple Job which is return below.
To resolve this error this TTS level should be ZERO, Run this job to get rid of that error, this job will find the tts level where its greater than zero and make it zero by calling TTSABORT.
static void TheAxaptaResetTTS(Args _args)
{
while (appl.ttsLevel() > 0)
{
info(strfmt("Level %1 aborted",appl.ttsLevel()));
ttsAbort;
}
}
Understanding TTSBEGIN /TTSCOMMIT
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.
I got the above information from the below source :
https://community.dynamics.com/ax/b/axaptavsme/archive/2013/08/29/error-an-unbalanced-x-ttsbegin-ttscommit-pair-has-been-detected-in-ax
above blog is very helpful you will get the help for most of the solutions.