Just a few points about running classic reports from RTC, based on common support scenarios:
RTC runs classic reports (reports with no RDL Layout) by starting the report engine from a classic client. However, RTC is not able to run classic reports MODALLY. RUNMODAL as opposed to just RUN means that execution of the next line of C/AL code waits until the report has completed. Of course RTC reports which DO have a layout can run MODALLY without any problems.
So Report.RUNMODAL on a classic report from RTC does exactly the same as Report.RUN, i.e. RTC will launch the classic report engine but not wait for the report to finish before executing the next line of code. In most cases this doesn't matter. But the challenge is when the next line of code dependeds on the report having completed, for example to email the report, convert it to pdf, write back a result of the report to the database, or something else.
The good news is that there has been a few small other improvements relating to running classic reports from RTC. When the classic client closes, it updates a few files like the .zup file, and in the case of breakpoints having been used, also NaviBP.xml as described here:http://msdn.microsoft.com/en-us/library/dd355196.aspxIn case we launched a batch of classic reports, one instance of the classic report engine would start up for each report. And each instance could overwrite each other's files, leading to error messages like this:
You cannot use the file C:\Users\[USER]\AppData\Roaming\fin.zup because it is already in use.
Microsoft Visual C++ Runtime LibraryRuntime Error!
This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for more information.
But with KB 2398170 (build 31587) the behaviour is changed, so that now when the classic client closes the report engine, it willl 1) only try to update the .zup file, and 2) not try to update naviBP.xml at all, avoiding the error messages mentioned above.
When you run a classic report from RTC, this does NOT consume a user license. If you watch the Session table while a classic report is running, you will see that a new session has connected, but with "Application Name" = '111'. In this way the system knows not to count it as a normal NAV client, so it will not count as a concurrent session.
Microsoft Dynamics UK
Microsoft Customer Service and Support (CSS) EMEA
Thank you for this very helpful post!
Talking about section "RUNMODAL (Not possible)" - is there a chance in later NAV versions to support the modal report call?
What is your personal recommendation to workaround this problem (without creating an RTC layout)?
Thanks for asking! And sorry, but there are no plans to make RUNMODAL possible. Unfortunately it's really not a simple thing - it wouuld require building the native client into RTC (or at least the repor engine) or some other major redesign of RTC. So, the workaround I recommend is creating RTC layout...
I have discovered the following:
This code is executed in the RTC:
1 - Whatever
2 - REPORT.RUNMODAL(...) // using a pdf printer
3 - whatever
The report in line 2 does not have layout hence it is run in the CC (NOT modally). Got it.
The problem is: I expect the lines 2 and 3 to be run concurrently (as they are shared by two clients). But in fact the report in line 2 will be run AFTER line 3 has finished!
Hence I cannot operate adding SLEEP, save to table, whatever to line 3.
Example: If I add SLEEP(9000) to line 3, then AFTER 9 seconds the report is run. You can test that because there will be popup.
Is this a known issue or a bug in my pdf printer?
As soon as you do REPORT.RUN(123), then this has its own life and runs independently. As the time it takes to start up the classic client etc, it's likely that it will run after the next lines of C/AL code yes - basically think of it as random...
Would it work for you if you add a CONFIRM dialogue to halt the next C/AL code until the report has printed? Like the example below where the two reports must be run in the the right order (as opposed to random order):
Confirm Report - OnAction()
IF CONFIRM('Please press yes to continue after the report has printed.') THEN;
//Whatever code etc
I hope that's something that could work?
well, in the meatime I could proove that the CC instance waits until the whole RTC transaction has finished - like MESSAGE. I did not test the CONFIRM method but would suppose it fails as well.
Actually I was trying to print a report as a pdf and then inserting the pdf file into an e-mail as attachment (calling a new codeunit function).
My workaround has been: The user has to click twice (= 2 transactions): Once to create the PDF, next to load the PDF into a new e-mail.
For another project (again a report without RDLC layout) I solved it differently:
The user has to call the report manually (-> CC instance opens) and set a new option. Instead of printing, the report calls the codeunit function(pdf, e-mail). As we are in the CC, the RUNMODAL works and the code waits, hence everything is run within one transaction.
Does this apply to process only reports as well? I'm calling a report modally from a codeunit and it's not running the report. I'm not able to add an RDLC since it's a process only report. Any suggestions?
No, it doesn't apply if the report is ProcessingOnly. Such reports run in RTC whether there is a lyout or not (which of course there wont be), so should run Modally.
I was wondering about the licenses. We have tested printing classic reports from the RTC and when al users are working (so the licences are full) we can not print. We get the error message that the licenses are full.
However when licenses are available, and i look at the Application Name it does show code 111 when active (reporting). It works when we have got a license left, but if we are full the classic report wil not run/print.
If i have read your comment about the licenses correctly, this should not happen.
Can this be some kind of setting in the classic.....?
We are using the Navision 2009 R2 version.
Thanks in advance for your reaction.
This should be corrected in a later build of NAV2009 R2. Currently, latest build is 34931, if you can get hold of that and try it out?
Thanx for your advice, yesterday we updated to buildversion 6.0.34931.0 Problem solved. We can now print an run reports without having to expand our licences :).