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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Try catch doesn't work in RDP class ProcessReport () method x++

(0) ShareShare
ReportReport
Posted on by 163

0572.Screenshot-_2800_84_2900_.png

This is my code , I made a ssrs report , so in RDP class (Process report method) I write a while loop to add values in tmp table based on General Journal trans table . 

I called a method in class and put it in try catch to handle errors But report throw an error and didn't hit a catch statement How to fix it ?

I have the same question (0)
  • Martin Dráb Profile Picture
    238,848 Most Valuable Professional on at

    First of all, isn't try try/catch statement in a transaction? If so, it explains everything.

    Are you saying if use "Step into" or something, the catch block is skipped?

    What is your version of AX?

  • Menna Allah Ahmed Profile Picture
    163 on at

    Yes , I put a ttsbegin and ttscommit before and after my while loop to insert in tmp table , inside this while loop I put a try and catch in method get an error to handle errors .

    version of AX d365fo

    8726.Screenshot-_2800_76_2900_.png

    1682.Screenshot-_2800_77_2900_.png

  • Suggested answer
    Martin Dráb Profile Picture
    238,848 Most Valuable Professional on at

    That's reason - you catch exceptions inside a transaction.

    (Moved from Dynamics AX Forum.)

  • Menna Allah Ahmed Profile Picture
    163 on at

    I can't understand what to do , Can you explain please ? , I try to run my code in a runnable class and it works but doesn't work in report

  • Martin Dráb Profile Picture
    238,848 Most Valuable Professional on at

    What you need to do depends on what exactly you're trying to achieve.

    For example, maybe you don't need any transaction at all. If things fail, you'll throw an exception, the processing will be interrupted, the temporary table will get out of scope and the inserted data will ceased to exist together with it.

  • Menna Allah Ahmed Profile Picture
    163 on at

    how can I do this ? the method I called is a void method didn't return any thing ?

    there is any way to check if this method get an error then I will insert in tmp table

  • Menna Allah Ahmed Profile Picture
    163 on at

    I try to put an ttsbegin , ttscommit before and after intert of tmp table (outside catch statement) and also doesn't work

  • Menna Allah Ahmed Profile Picture
    163 on at

    I add values in temp table based on errors in infolog , I loop on infolog and based on every single error I put enum values in temp table

  • Martin Dráb Profile Picture
    238,848 Most Valuable Professional on at

    You created a duplicate threads about the same thing, and when I pointed it out, you said: "I asked you another questions but you didn't answer". But what is the question? I have no idea what you mean by your last reply, but I can say for sure that it's not a question.

  • Menna Allah Ahmed Profile Picture
    163 on at

    I mean that my issue didn't work so I asked another question in community if anyone know how to fix it ,or If anyone have another workaround

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 470

#3
Adis Profile Picture

Adis 270 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans