Microsoft Dynamics AX development

Goal: how to manage the printer settings for reports in AX 2012.

The following example is based on the new report Quality Orders in the Invent Module.


Create the SSRS Report

  • Report name:          InventQualityOrder
  • Contract name:       InventQualityOrderTableContract
  • Controller name:    InventQualityOrderTableController


Add new values to the BaseEnums:

  • PrintMgmtNodeType; add “QualityOrders”
  • PrintMgmtDocumentType; add “QualityOrders”


Create an extension of the PrintMgmtNode class:

public class PrintMgmtNode_QualityOrder extends PrintMgmtNode

public List getDocumentTypes()
    List docTypes = new List(Types::Enum);
    return docTypes;
public RefTableId getReferencedTableId()
    return tablenum(InventQualityOrderTable);


Modify the following classes:


1) Add the following code to the method “construct”:

case PrintMgmtNodeType::QualityOrdersWCH:
return new PrintMgmtNode_QualityOrderWCH();

A PrintMgmtNode class defines a level at which Print Management information can be associated.


1) Method getDefaultReportFormat()

case PrintMgmtDocumentType::QualityOrders:
return ssrsReportStr(InventQualityOrder, Report);

2) Method getQueryRangeFields()

case PrintMgmtDocumentType::QualityOrders:
fields.addEnd(fieldNum(InventQualityOrderTable, QualityOrderId));

3) Method getQueryTableId()

case PrintMgmtDocumentType::QualityOrders:
tableId = tableNum(InventQualityOrderTable);

The PrintMgmtDocType class represents the document types that are available in print management.


1) Method getNodesImplementation()


2) Method getParentImplementation()

case PrintMgmtNodeType::QualityOrders:


1) Method getDocumentTypes()


The PrintMgmtNode_Invent class is responsible for managing print management settings at the module level in the inventory module. Add the new document type in the method getDocumentTypes().


Create an extension of the FormLetterReport class:

class InventFormLetterReport_QualityOrder extends FormLetterReport
    InventTransType transType;
protected container getDefaultPrintJobSettings(PrintSetupOriginalCopy _printCopyOriginal)
    return new PrintJobSettings().packPrintJobSettings();
protected PrintMgmtDocumentType getPrintMgmtDocumentType()
    return PrintMgmtDocumentType::QualityOrders;
protected PrintMgmtHierarchyType getPrintMgmtHierarchyType()
    return PrintMgmtHierarchyType::Invent;
protected PrintMgmtNodeType getPrintMgmtNodeType()
    return PrintMgmtNodeType::QualityOrders;


Modify the FormLetterReport class:

1) Method construct()  

case PrintMgmtDocumentType::QualityOrders:
return new InventFormLetterReport_QualityOrder();

The FormLetterReport class controls the printing of documents.


Create the controller, which extends the TradeDocumentReportController class, which allows to manage multiple prints.

The following dialog aims to provide the possibility to choose printer settings that are different from the ones defined in the standard configuration (Inventory and warehouse management > Setup > Inventory and warehouse management parameters > Print management):

The dialog offers two scenarios:

– “Use print management destination” is flagged – in this case the system takes the settings from Inventory and warehouse management parameters

– Otherwise, the system takes the printer settings from the dialog (“Current print destination”).

In any case, it is necessary to overwrite the following methods in the controller:


protected void initFormLetterReport()
    printCopyOriginal = this.parmArgs().parmEnum();
    formLetterReport = FormLetterReport::construct(PrintMgmtDocumentType::QualityOrders);
    if (printCopyOriginal == PrintCopyOriginal::OriginalPrint)
        // Always use the print mgmt destinations when reprinting for the OriginalPrint case.


This method is called from the runPrintManagement method, for every selected journal.

protected void output()
    InventQualityOrderTableContractWCH rdpContract = this.parmReportContract().parmRdpContract() as InventQualityOrderTableContractWCH;
    //If the flag is not set, I set the current print destination in case of original/copy printing
    if (!rdpContract.parmUsePrintManagementSettings())
        formLetterReport.parmDefaultCopyPrintJobSettings(this.parmReportContract().parmPrintSettings()); formLetterReport.parmDefaultOriginalPrintJobSettings(this.parmReportContract().parmPrintSettings());
   // load the new setup for printing the report
   formLetterReport.loadPrintSettings(inventQualityOrderTable, inventQualityOrderTable, CompanyInfo::languageId());


Go to method populate() in table PrintMgmtReportFormat and add this line of code:


Finally go to:
Inventory and warehouse management > Setup > Inventory and warehouse management parameters > Print management
Here add a new node for the new report and set the print management settings.

For further information see also:

– SalesQuotationController class – for example – create a new SSRS report


Comments on: "Manage printer settings for SSRS Report in AX 2012" (18)

  1. Martin Mikes said:

    Hello Martina,
    really nice instructions thanks for it.
    I followed you steps, but after run report I got message “No print management settings are applicable so no document is produced.”
    Did I something wrong?
    My report is really similar salesQuatiton, only I’m confused at methods initFormLetterReport and output at class controller, so this is reason why I used your manuall.
    Do I understandt correctly when I extended class TradeDocumentReportController I must overload all this classes?

    • Hi!
      Have you set the “Print management setup”?
      Inventory and warehouse management > Print Management (on the left) > Print management (button) > here you must add a new node as the picking list.
      And then you must define a print destination.

      • Martin Mikes said:

        I have report after sales so it shoud be at Account receivable/setup/forms/Form setup button Print management node Documents but I dont see new node:(

    • You should add code in the class PrintMgmtNode_Sales; the method name is: getDocumentTypes().


      • Martin Mikes said:

        It’s help great thanks 😉 Only I would like to have a dialog with some parameter from my extends class from TradeDocumentReportController and it looks like it;s not supported, I must overload method templateForm, param method show dialog and etc didnt’t help. Didn’t you have similar problem?

      • MarkKopan said:

        I have followed the instructions, added everything to the AR Node rather than the Invent node. I see my PM settings for my DocType, but can not select the SSRSReport from the drop-down list as my DefaultSettingReportFormat. It shows nothing. Did i miss a reference in the code?

      • Have you add a new record in the table: PrintMgmtReportFormat? This table contains all the reports with the print management settings.
        Add a new record and set it as system report(the flag in the table).

      • THANKS That was it… grrr. Why do they have to make so difficult. I also had to add Edit Classes so that my Document types show up in PrintMgmt & also modify PrintMgmtReportFormat Table method populate() . reference must be added so that any report designs will show up on PrintMgmt select Design addOther(PrintMgmtDocumentType, ssrsReportStr(), ssrsReportStr() , LanguageId or #NoCountryRegionId) for EACH Design template for your Report

  2. Martin Mikes said:

    I mean my new node

  3. I get this error after exactly following your steps :

    PrintMgmtPrintSettingDetail object not initialised.

    Stack trace

    (C)\Classes\TradeDocumentReportController\outputReport – line 5
    (C)\Classes\MSTARemittanceAdviceController\outputReport – line 28
    (C)\Classes\MSTARemittanceAdviceController\runPrintMgmt – line 71

  4. and neither parameter dialog pops up where we apply prin settings. infact it directly takes to printing the repotrt

  5. I keep getting this Error… WHY?
    TradeDocumentReportContract object not initialized.

    Stack trace

    (C)\Classes\TradeDocumentReportController\preRunModifyContract – line 11
    (C)\Classes\INSMedClaim837FormLetterController\preRunModifyContract – line 6
    (C)\Classes\SrsPrintMgmtController\outputReports – line 65
    (C)\Classes\TradeDocumentReportController\output – line 6
    (C)\Classes\INSMedClaim837FormLetterController\output – line 14
    (C)\Classes\INSMedClaim837FormLetterController\runPrintMgmt – line 3
    (C)\Classes\SrsPrintMgmtController\run – line 14
    (C)\Classes\SysOperationController\startOperation – line 10
    (C)\Classes\SrsReportRunController\startOperation – line 12
    (C)\Classes\SrsPrintMgmtController\startOperation – line 14
    (C)\Classes\SrsPrintMgmtFormLetterController\startOperation – line 14
    (C)\Classes\INSMedClaim837FormLetterController\main – line 9

    • Can you post, please, the class declaration of your contract (INSMedClaim837FormLetterContract) and the method INSMedClaim837FormLetterController.output ?

      • Mark Kopan said:

        public class INSMedClaim837FormLetterContract extends TradeDocumentReportContract
        INSMedClaimId claimId;
        SalesId claimNumber;
        PrintMgmtDocInstanceType printMgmtDocInstanceType;
        PrintMgmtIdentificationTxt printMgmtIdentificationTxt;
        INSMedClaimHeader claimHeader;
        PrintCopyOriginal printCopyOriginal;

        protected void output()

        INSMedClaim837FormLetterContract rdpContract = this.getTradeReportContract() as INSMedClaim837FormLetterContract;


      • It seems ok! Another test you can do is: open the report with Visual Studio, make “Refresh” on datasource and re-deploy.

  6. Hey Martina, here’s one for you: I want to print my SRS “Report A” with it’s PM settings, then while still in the run, print all supporting documentation DocuRef stored documents (PDF’s). The supporting pdf documents have their own PM settings. Scenario: SSRS Report A prints on Printer 1, Tray 2 (because it’s pre-printed form stock). The additional docs may print to the same printer, Tray 1 or another printer. This is similar to Bank Check printing on a MICR printer, but statement/letters print to separate non-MICR printer. I must be making the call in the wrong place because Infolog shows the correct printer, but physically prints on Printer 1. So, the re-assignment of srsPrintDestinationSettings isn’t saved. Thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: