0

Is it possible to generate an SSRS report in Dynamics AX 2009 and save it as a pdf file using X++ ?

The problem I have is that I need to generate the data for the report and then generate the report. Reporting server subscriptions wont work in this case as there is no way for them to call the x++ to generate the data.

I have also had a look at passing the rendering type to the SSRS report in the URL, but it doesnt seem to accept a filename to save the report as.

The logic that generates the data is not a straightforward query, and takes quite a while to run. I want to be able to turn this into a batch process so that several reports can be generated by a batch server.

Joe Brewer
  • 33
  • 1
  • 3

1 Answers1

1

Ensure that AX is configured as a batch server and then you will need to create a batch job.

The art of creating a batch class (for the batch job to call) which calls a report and generates a pdf file overnight has already been mastered here.

The following snippet for generating a PDF file is from the class EPSendDocument.makeDocument()

        Filename        file = "\\\\Server\\SharedFolder\\File.pdf";

        printSettings = reportRun.parmReportContract().parmPrintSettings();
        printSettings.printMediumType(SRSPrintMediumType::File);
        printSettings.fileFormat(SRSReportFileFormat::PDF);
        printSettings.fileName(file);
        printSettings.overwriteFile(true);

Another link for converting a report to a pdf file.

Finally do check first if the files are generated by executing the class from within your AX client, and then when it is run on the batch server. There may be permission or path issues.

ian_scho
  • 5,906
  • 9
  • 35
  • 51
  • Hi ian_scho. I'm afraid both of your examples are for AOT reports and not SSRS reports. I notice that it is possible to generate SSRS reports in AX 2012 using batch jobs, however the classes that accomplish this are missing from 2009. The best solution that I can think of at the moment is to generate the data for the report in a batch job, and add a subscription to the SSRS report which isnt ideal at all. – Joe Brewer Nov 20 '13 at 09:07
  • Ack! Sorry. You stated quite clearly that it was for AX 2009. – ian_scho Nov 21 '13 at 09:05