Options

Report.RUNMODAL not running modally

remco_rauschremco_rausch Member Posts: 68
edited 2011-02-16 in NAV Three Tier
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

Answers

  • Options
    deV.chdeV.ch Member Posts: 543
    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.aspx
  • Options
    kinekine Member Posts: 12,562
    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... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    remco_rauschremco_rausch Member Posts: 68
    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.
  • Options
    remco_rauschremco_rausch Member Posts: 68
    How do I mark the topic as solved?
  • Options
    AndwianAndwian Member Posts: 627
    How do I mark the topic as solved?
    Look at the right-bottom hand of your screen. There is "Attribute"
    Regards,
    Andwian
  • Options
    JoeKJoeK Member Posts: 53
    Hello,

    i´m facing the same probleme. Did you have found a solution here?

    Thanks and Regards
    JK
Sign In or Register to comment.