web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Printing Purchase Order to file by code

Denis Macchinetti Profile Picture Denis Macchinetti 16,444
Hi

Below the code for generate a file ( PDF, Xlsx, etc. ) from a Purchase Order Report.

SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract rdpContract = new PurchPurchaseOrderContract();
SRSPrintDestinationSettings settings;

// Define report and report design to use
controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));

// Use execution mode appropriate to your situation
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);

// Suppress report dialog
controller.parmShowDialog(false);

// Explicitly provide all required parameters
rdpContract.parmRecordId( VendPurchOrderJour::findRecId(5637146077).RecId );
controller.parmReportContract().parmRdpContract(rdpContract);

// Change print settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.fileName(@'\\UNCPATH\test.pdf');

// Execute the report
controller.startOperation();

Enjoy !
 

This was originally posted here.

Comments

*This post is locked for comments