How to: Print a Report [AX 2012]

Updated: October 24, 2013

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

In Microsoft Dynamics AX, you can print reports that were created using Visual Studio tools for Microsoft Dynamics AX. This topic provides the pre-requisite steps for printing a report and to print from a menu item, including steps for programmatically specifying advanced printer properties like orientation and paper tray. For more information on how to programmatically print a report, see the Report Programming Model.

Pre-requisites to Print a Report

To Print a Report from a Menu Item

  1. Open a menu item that corresponds to the report that you want to print.

  2. Set the parameters that exist.

    If you have queries, click the Select button and set the range.

    Click the Print Destination button to set the print destination fields. You can print to a screen, printer, file, or email recipient.

  3. Click OK to print the report.

To Print a Report and specify printer properties in X++

  • Use the methods of SRSPrintDestinationSettings to set properties such as landscape/portrait orientation, number of copies, paper tray, and whether to collate the printed report.

    public static void main(Args _args)
        SrsReportRunController controller = new SrsReportRunController();
        SRSPrintDestinationSettings printSettings;
        // set report name
        controller.parmReportName(ssrsReportStr(LedgerBalanceControl, Report));
        // get print settings from contract
        printSettings = controller.parmReportContract().parmPrintSettings();
        // set printer as the destination
        printSettings.printerName = "My Printer"; // specify your printer name 
        printSettings.printLandscape(true); // print in landscape orientation
        printSettings.numberOfCopies(2);    // print 2 copies
        printSettings.setPaperTray(1); // print to paper tray with index = 1 
        printSettings.collate(true);          // collate printed copies
        // suppress the parameter dialog to send directly to printer
        // start operation