Resolving problem of unbalances tts in MSD Axapta

Resolving problem of unbalances tts

Sometimes when we're debugging, for some reason have not completed the sequence of TTS ttsbegins and left more than it should, I get the AX to give you messages saying he found a pair of unbalanced TTSBEGIN / TTSCOMMIT and solve just create a job with a ttsabort.

 while (appl.ttsLevel() > 0)  
 ttsAbort;