web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Stack trace: Call to TTSCOMMIT without first calling TTSBEGIN

(0) ShareShare
ReportReport
Posted on by 230

We have been facing this strange error on some insert/update/delete calls to some of the table methods where there is some other code inside these methods which is also using ttsbegin/ttscommit in AX 2012 Feature pack. ttsbegin and ttscommit is balanced on all levels and declared on same levels every place they are used inside code. I find this behavoir very strange as same code is working in another environment which does have same specifications. Could it be some kernal related issue? Same error does sometimes occur when deleting multiple lines on CustTable form for instance. Any idea what it could be?

*This post is locked for comments

I have the same question (0)
  • Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at

    I don't think it's a kernel issue but probably an issue in the code. Every time I have seen this error it was because of a bug in the code. Use the debugger to find out why it's happening.

  • Umer Ejaz Profile Picture
    230 on at

    Thanks for your Answer Anton,

    I have been debuging the code whole day today but can't find anything wrong with it... not as yet.... i know normaly this kind of message comes because of unbalanced ttsbegin/ttscommit but i think they are balanced in this case.. and proof of that is that code is working fine in Development environment.. its only when we moved the customization to the test environment problems started coming.

  • Suggested answer
    Community Member Profile Picture
    on at

    If the update is called from within a derived class, you might try to compile the base class forward. I can't explain this behaviour, but I had lots of weird errors because I didn't compile a class forward, including unbalanced ttsLevels although they look absolutely fine.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Umer,

    From the mentioned error it seems there is an additional ttscommit in your code. If you are having this issue on one system but not on other system, it could be because of some condition. Most probably, you have some if clause in your code which is doing ttscommit. For example you started ttsbegin out of loop and in between loop you may have two conditions where you have ttscommit (conditionally) So in some cases it is again trying to commit where it has already done. Focus more on conditional ttscommits while debugging.

    I recommend you checking ttslevel in your code by placing this line after every ttscommit or ttsbegin and debug code to see if it is on correct level.

    info (strfmt('I am at level %1'appl.ttslevel()));

    Or check after ttscommet if appl.ttslevel() is still greater than 0 where it should be 0.

    Otherwise, to get rid of this error you can also run this job

    static void AbortUnexpectedTTS(Args _args)

    {

       while (appl.ttsLevel() > 0)

       {

           info(strfmt("Level %1 aborted",appl.ttsLevel()));

           ttsAbort;

       }

    }

    Regards

    Syed

  • Iulian Cordobin Profile Picture
    8,201 on at

    What I would be interested in is if the issue is reproducible and you know the steps it takes to get it? Also, is it only in one place where it throws the unbalanced tts or in multiple places (sorry if you mentioned this, but I didn't get it).

  • Verified answer
    Community Member Profile Picture
    on at

    I don't think you need to change the code since you can see the current ttsLevel in the Debugger (lower right corner).

    Dosn't ttsAbort always nullify the ttsLevel no matter how high it is, making a loop unnecessary?

    I highly recommend compiling your customized classes forward after moving them to test envirment.

  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Umer,

    If you have an event handler used, try to debug this code of the event handler and see if the ttslevel gets lost here. I have seen issues on this point. Then on the original e.g. insert it tries to finish the ttscommit where the level is 0 at that moment.

  • Suggested answer
    Umer Ejaz Profile Picture
    230 on at

    I have now localized the error in code. Deep down inside the code on 5th ttslevel there was a customization in an insert method of ContactPerson table .. I know its very strange but we have newly overtaken this customer so this was clearly sign of a poorly managed test environment. After removing one TTSCOMMIT which was one too many things have obviously started working. This was my first post in forum and I am impressed with the response you guys have given me. I am very grateful for all help you guys have given on this case. I hope to return some in future :)

  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Umer,

    You are very welcome to come back. Have a look at all questions and answers; ask another great question!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans