Skip to main content

Notifications

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 ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    Regarding TtsLevel, see my reply starting with "The first step is analyzing the cause".

    Using a different validation method doesn't belong to this thread, which topic is "Try catch doesn't work in RDP class ProcessReport()". But you can create another thread and explain it there (with sufficient details about what you're trying to achieve).

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    Can you help me to get another method validate dimension combination before posting ledger journal instead of calling simulate posting () method ? , I want to call method that validate financial dimension

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    I want to call simulateposting in try catch but simulateposting have ttslevel = 1 , How can I change this in simulateposting to make my code hit catch statement ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    simulatePosting() is inside the try block, therefore it's irrelevant to our discussion about whether the try/catch block is in a transaction or not.

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    no I mean that transaction start in method I called (simulateposting()) , you mean that I need to ttsabort when transaction start ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    The first step is analyzing the cause. The debugger can give you the call stack; the sequence of calls leading to processReport(). Look into those method and find when a transaction is started.

    My guess is that you're using pre-processing and the transaction is created in SrsReportRunRdpPreProcessStrategy.execute().

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    yes you are right I debug my code and see ttslevel = 1 , this problem has a solution ? , How to make it = 0 to hit catch statement ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    That doesn't say whether there is a transaction or not. A transaction could be created at another place then in your code. You need to learn how to find out whether code is executed in a transaction or not.

    For example, put a breakpoint to the 'try' block, run the report with debugging. When the execution stops on your breakpoint, look into the 'Autos' window and check whether the value TtsLevel is zero.

    Consult Debug X++ code by using the debugger in Visual Studio if needed.

  • Menna Allah Ahmed Profile Picture
    Menna Allah Ahmed 163 on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    Yes I remove ttsbegin and ttscommit from my while loop

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Try catch doesn't work in RDP class ProcessReport () method x++

    First of all, verify that your tr/catch statement isn't inside a transaction. You can see it in debugger, for example.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans