How to reset TTSBegin/TTSCommit in AX

We are using TTSBegin and TTSCommit when update and create a record in AX, but some times an error is occurred  and through an exception.

If we did not abort TTS by using TTSAbort  statement between try and catch keyword as below




// your update code







so we may facing this error below,

To fix this error please run the following job

static void ResetTTS(Args _args)
    while (appl.ttsLevel() > 0)
        info(strfmt("Level %1 aborted",appl.ttsLevel()));

  1. First of all, you should NOT call ttsabort; in the catch statement. An exception aborts te transaction unconditionally, so your ttabort; has no matching ttsbegin; in this case.

    See http://msdn.microsoft.com/en-us/library/aa609617.aspx
    and http://msdn.microsoft.com/en-us/library/aa893385.aspx, especially the section “Exceptions Inside Transactions”.

  2. Your error is caused by unbalanced ttsgein; / ttscommit; pairs. This most often happens when your try to show a form from within a uncommitted transaction, what is not possible in AX.

    See https://community.dynamics.com/ax/f/33/t/118114.aspx, for example.

  3. Jacob Hjørnet Sørensen

    Static void ResetTTS(Args _args)

    should be enough.
    It works for me.

  4. I would suggest you use a standard try..catch blok, where you catch the exceptions and use throw error command.
    This will result that all tts levels will be reset and the update is rolled back.
    The suggested solution is not good in a production environment.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Get every new post on this blog delivered to your Inbox.

Join other followers:

error: Content is protected !!