Report.RUNMODAL not running modally

remco_rausch
Member Posts: 68
Hi,
I'm having problems with a report running on RTC when trying to print it to PDF. The basic process is as follows:
Set printer selections to Bullzip Printer
Run Report
Reset Printer selections
E-mail the PDF file
If I do this from a classic client it works fine, the file gets printed, attached and e-mailed. When I do this through the RTC, the e-mail code runs first, falls over because the file doesn't exist and then the report gets printed.
My code for this is as follows:
FileName := '\\Neptune\' + SalesHeaderPrm."No." + '.pdf';
PDFEmailMgt.InitBullZip(ReportSelection."Report ID",FileName);
REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,FALSE,SalesHeaderPrm);
PDFEmailMgt.ResetPrinterSelection(ReportSelection."Report ID");
UserSetup.GET(USERID);
SendEmail(FileName,UserSetup."E-Mail")
So for some reason the Report.RUNMODAL always runs last, I was under the impression that if you run it modally it should run in order? I have tried calling the report in a codeunit and then doing a IF Codeunit.RUN THEN; but I get exactly the same result, the codeunit gets run after the rest of the code.
I have also tried to put a sleep(10000) after the report.runmodal, this results in it sleeping for 10 seconds, then running the e-mail code, it falling over and eventually running and printing the report.
The report is too complicated to convert and use SaveAsPDF, the pdf gets created after so all the permissions are fine too.
Any ideas?
Thanks,
Remco
I'm having problems with a report running on RTC when trying to print it to PDF. The basic process is as follows:
Set printer selections to Bullzip Printer
Run Report
Reset Printer selections
E-mail the PDF file
If I do this from a classic client it works fine, the file gets printed, attached and e-mailed. When I do this through the RTC, the e-mail code runs first, falls over because the file doesn't exist and then the report gets printed.
My code for this is as follows:
FileName := '\\Neptune\' + SalesHeaderPrm."No." + '.pdf';
PDFEmailMgt.InitBullZip(ReportSelection."Report ID",FileName);
REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,FALSE,SalesHeaderPrm);
PDFEmailMgt.ResetPrinterSelection(ReportSelection."Report ID");
UserSetup.GET(USERID);
SendEmail(FileName,UserSetup."E-Mail")
So for some reason the Report.RUNMODAL always runs last, I was under the impression that if you run it modally it should run in order? I have tried calling the report in a codeunit and then doing a IF Codeunit.RUN THEN; but I get exactly the same result, the codeunit gets run after the rest of the code.
I have also tried to put a sleep(10000) after the report.runmodal, this results in it sleeping for 10 seconds, then running the e-mail code, it falling over and eventually running and printing the report.
The report is too complicated to convert and use SaveAsPDF, the pdf gets created after so all the permissions are fine too.
Any ideas?
Thanks,
Remco
0
Answers
-
I don't think you can run a classic report in rtc in modal mode! I think i have read something that a runmodal is interpreted as a normal run if its a classic report.
edit: here is the article about it - not possible!
http://blogs.msdn.com/b/nav/archive/2010/10/20/running-classic-reports-in-rtc-runmodal-and-a-few-other-things.aspx0 -
As it was written, because the classic report is started in separate instance of classic client, it is started non-modally. But if you transform the report into RTC, you can use the SaveAsPDF standard functionality and you do not need to use the Bullzip for it... ;-)0
-
Bah that sucks #-o
Thanks for the explanation guys.
I'll just put a confirmation message in, it seems to print the report while it waits for user input.0 -
How do I mark the topic as solved?0
-
remco_rausch wrote:How do I mark the topic as solved?Regards,
Andwian0 -
Hello,
i´m facing the same probleme. Did you have found a solution here?
Thanks and Regards
JK0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions