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
0
Answers
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.aspx
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
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.
Andwian
i´m facing the same probleme. Did you have found a solution here?
Thanks and Regards
JK