How to Run a Docentric SSRS Report from Code
You can print a Docentric SSRS report from X++ using the standard approach of running an SSRS report from the code. The only difference is that you have to additionally specify that the target print destination is Docentric Screen/File/Email/Printer/Print Archive and set the corresponding settings.
To achieve some custom scenarios such as sending report to a web service, you can use Docentric Memory print destination to print report to a memory stream or container, and handle it from there as needed.
Learn how >>
Learn how >>
Generate and save Customer Invoice to Azure Blob storage
In the following example we are going to generate Customer Invoice using its built-in SSRS report design and save it to Azure Blob storage using the Docentric File print destination.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | public static void printSalesInvoice_useOriginalDesign() {     SalesInvoiceController     salesInvoiceController;     SalesInvoiceContract       salesInvoiceContract;     Args                       args = new Args();     CustInvoiceJour            custInvoiceJour;     SalesInvoiceJournalPrint   salesInvoiceJournalPrint;     select firstonly custInvoiceJour where custInvoiceJour.SalesId != '';     // Add record to be printed.     // In order to have the context table we need to set args.record().     args.record(custInvoiceJour);     salesInvoiceController = SalesInvoiceController::construct();     salesInvoiceController.parmReportName(         PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat());     salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract();     salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo());     salesInvoiceController.parmArgs(args);     salesInvoiceController.parmExecutionMode(SysOperationExecutionMode::Synchronous);     // Set print destinations.     SRSPrintDestinationSettings pds = salesInvoiceController.parmReportContract().parmPrintSettings();     pds.printMediumType(SRSPrintMediumType::File_DC);     pds.parmFilePrintDestSettings_DC().parmOutputFilename('SalesInvoice_@FIELD_InvoiceId@.xlsx');     pds.parmFilePrintDestSettings_DC().parmOutputFileFormatSrs(SRSReportFileFormat::Excel);     // Save to Azure Blob storage.     pds.parmFilePrintDestSettings_DC().parmSendOutputFileToUser(false);     pds.parmFilePrintDestSettings_DC().parmSaveToAzureBlobStorage(true);     pds.parmFilePrintDestSettings_DC().parmAzureBsContainerName('docentric-report-output');     pds.parmFilePrintDestSettings_DC().parmAzureBsBlobPath('@COMPANYID@/Invoices');     pds.parmFilePrintDestSettings_DC().parmAzureBsOverrideFileIfExists(true);     // Use the original SSRS design.     pds.parmFilePrintDestSettings_DC().parmUseSsrsBuiltInDesign(true);     pds.parmSrsPrintReportSettings_DC().setProperty_PrintSrsOriginalDesign(true);     /* Use the default Docentric design */     //pds.parmSrsPrintReportSettings_DC().setProperty_PrintSrsOriginalDesign(false);     //pds.parmFilePrintDestSettings_DC().parmUseSsrsBuiltInDesign(false);     //pds.parmFilePrintDestSettings_DC().parmOutputFilename('SalesInvoice_@FIELD_InvoiceId@.pdf');     //pds.parmFilePrintDestSettings_DC().parmOutputFileFormat(DocOutputFileFormat::PDF);     // Initalize SalesInvoiceJournalPrint class instance because there is no other way     // NOT to use Print Management.     salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct();     salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes);     salesInvoiceJournalPrint.parmUsePrintManagement(false);     salesInvoiceJournalPrint.parmUseUserDefinedDestinations(true);     salesInvoiceJournalPrint.parmPrinterSettingsFormLetter(salesInvoiceController.parmReportContract().parmPrintSettings().pack());     args.caller(salesInvoiceJournalPrint);     args.parmEnumType(enumNum(PrintCopyOriginal));     args.parmEnum(PrintCopyOriginal::OriginalPrint);     // Start the report execution.     salesInvoiceController.parmShowDialog(false);     salesInvoiceController.startOperation(); } | 
See also
How to Use the New Memory Print Destination >>
How to Change Print Destination Settings Dynamically >>
How to Use Custom Placeholders in Print Destinations >>