Saturday, 30 November 2013

SSRS Report Print in ax 2012

public static void print_skilt(ItemId ID) 

SrsReportRunController controller; 

controller = new SrsReportRunController(); 

controller.parmLoadFromSysLastValue(false); 

controller.parmReportName("mi_prisskilt.a5"); //name of report to print 

controller.parmReportContract().parmPrintSettings().landscape(true); 
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File); 
controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF); 
controller.parmReportContract().parmPrintSettings().overwriteFile(true); 
controller.parmReportContract().parmPrintSettings().fileName(strFmt("\\\\shop3\\AxaptaPDF\\P%1.pdf",ID)); //filename to print pdf to 
controller.parmReportContract().parmPrintSettings().fromPage(1); 
controller.parmReportContract().parmPrintSettings().toPage(1); 

controller.parmReportContract().parmRdlContract().setValue("mi_prisskilt_ItemId",ID); //parameters to send to report 

controller.runReport(); 

}

2 comments:

  1. Hello ,

    Can you specify what exactly "ItemId ID" is in this code?

    I have seen the same code at various places, but still not able to execute my report with parameter. Without passing parameter's it's working fine but with parameter it's not working.

    ReplyDelete
  2. I am always getting the below error.

    Microsoft.Dynamics.AX.ManagedInterop.ErrorException: Parameter CustListReportDS_DynamicParameter does not exist.

    ReplyDelete