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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Print Bank Reconciliation Summary in PDF

(1) ShareShare
ReportReport
Posted on by 84
Hi,
I'm trying to print the Bank Reconciliation Summary in pdf and save it in a specific path when I clicked the reconciliation buttom. When I use the print buttom, it shows a dialog where I select some parameters. I will like to know if its possible to set the values of the dialog by code and save the report in a path:
 
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,722 Most Valuable Professional on at
    Which version of AX are you using?

    Fill in parameters in code is possible (maybe you don't even need a dialog if you want to set everything automatically).
     
    How you can handle the path depends on whether you're talking about an on-premises deployment or a cloud deployment.
  • Anton Venter Profile Picture
    20,343 Super User 2025 Season 2 on at
    Hello,
     
    The thread below has a code example which seems to be working I believe.
     
     
     
  • SP-22072258-0 Profile Picture
    84 on at
    Hi Martin, I'm using AX2012. I'm kind of new to this and I have printed reports before but, in this case, is different because in my past reports I dont need to fill parameters and now I have to. If there was a way to print the report and fill all the parameters by code it will be amazing. The process that I do in AX to print manually the report is the following:
     
    1. I click the print button:
     
    2. I fill the parameters and click the Ok button:
     
    The classes that the system is using are this:
  • Anton Venter Profile Picture
    20,343 Super User 2025 Season 2 on at
    The parameters can be set by accessing a reference of the data contract of the controller class using the getDataContractObject method.
     
    MyContactClass contract = controller.getDataContractObject(); // Change contract class to your type.
     
  • Martin Dráb Profile Picture
    237,722 Most Valuable Professional on at
    Here is an example of such code, including a parameter and a file path:
    SrsReportRunController          controller = new SrsReportRunController();
    SysUserLicenseCountRDPContract  rdpContract = new SysUserLicenseCountRDPContract();
    SRSPrintDestinationSettings     settings;
     
    // Define report and report design to use
    controller.parmReportName(ssrsReportStr(SysUserLicenseCountReport, Report));
    // Use execution mode appropriate to your situation
    controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);
    // Suppress report dialog
    controller.parmShowDialog(false);
     
    // Explicitly provide all required parameters
    rdpContract.parmReportStateDate(systemDateGet());
    controller.parmReportContract().parmRdpContract(rdpContract);
     
    // Change print settings as needed
    settings = controller.parmReportContract().parmPrintSettings();
    settings.printMediumType(SRSPrintMediumType::File);
    settings.fileFormat(SRSReportFileFormat::Excel);
    settings.fileName(@'\\share\UserLicenseCount.xlsx');
     
    // Execute the report
    controller.startOperation();
    When thinking about the location, don't forget that server code doesn't execute on client's machine, there usually are multiple AOS servers, the process must have permissions to write to the location and so on.
  • SP-22072258-0 Profile Picture
    84 on at
    Thank you to everyone, I tried to set some parameters according to some code I saw but I have the error that BankReconciliationSummaryRdlContract has not been initialized and the problem is that the class is private. This is my code:

     
     
  • Martin Dráb Profile Picture
    237,722 Most Valuable Professional on at
    There are no private classes in X++. The 'private' modifier is used for class members, but not for classes. What do you actually mean when saying that the class is private?

    Also, it's strange that you pass an object called an "RDL" contract to parmRdpContract(), because RDL and RDP contracts are two different things. Shouldn't you use parmRdlContract() instead?
  • SP-22072258-0 Profile Picture
    84 on at
    Hi,
    I'm sorry, I meant the method in the class is private. I've been working in that and I think I kinda figure it out. But now, I'm facing another problem. When I set the values, it does not set the right type. Here is what I've been doing:
     
    1. This is my code. Here I set the values of CheckingDate (date), ClearedTransactionDetails (boolean), ReconciliationSummary (boolean) and UnClearedTransactionDetails (boolean):
    void clicked()
    {
        #define.ParamCheckingDate       ('CheckingDate')
        #define.ParamSummary            ('ReconciliationSummary')
        #define.ParamClearedDetails     ('ClearedTransactionDetails')
        #define.ParamUnclearedDetails   ('UnClearedTransactionDetails')
    
        SrsReportRunController               controller = new BankReconciliationSummaryController();
        SRSPrintDestinationSettings          settings;
        SRSReportParameter checkingDateParam = new SRSReportParameter();
        SRSReportParameter clearedTransactionDetailsParam = new SRSReportParameter();
        SRSReportParameter reconciliationSummaryParam = new SRSReportParameter();
        SRSReportParameter unClearedTransactionDetailsParam = new SRSReportParameter();
        SrsReportRdlDataContract rdlContract;
    
        Map reportParametersMap = new Map(Types::String, Types::Class);
        Map rdlReportParamMap;
    
        reportParametersMap.insert("CheckingDate", checkingDateParam);
        reportParametersMap.insert("ClearedTransactionDetails", clearedTransactionDetailsParam);
        reportParametersMap.insert("ReconciliationSummary", reconciliationSummaryParam);
        reportParametersMap.insert("UnClearedTransactionDetails", unClearedTransactionDetailsParam);
    
        rdlReportParamMap = SrsReportRunUtil::createClonedParameters(reportParametersMap);
    
        rdlContract = SrsReportRdlDataContract::newContract("BankReconciliationSummaryRdlContract", rdlReportParamMap);
    
        controller.parmReportName("BankReconciliationSummary.Report");
        controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch);
        controller.parmShowDialog(false);
        
        rdlContract.setValue(#ParamCheckingDate,mkDate(27,05,2024));
        rdlContract.setValue(#ParamClearedDetails,true);
        rdlContract.setValue(#ParamSummary,true);
        rdlContract.setValue(#ParamUnclearedDetails,false);
    
        controller.parmReportContract().parmRdlContract().setValue(#ParamCheckingDate,mkDate(27,05,2024));
        controller.parmReportContract().parmRdlContract().setValue(#ParamClearedDetails,true);
        controller.parmReportContract().parmRdlContract().setValue(#ParamSummary,true);
        controller.parmReportContract().parmRdlContract().setValue(#ParamUnclearedDetails,false);
    
        settings = controller.parmReportContract().parmPrintSettings();
        settings.printMediumType(SRSPrintMediumType::File);
        settings.fileFormat(SRSReportFileFormat::PDF);
        settings.fileName(@'C:\Users\spineda\Desktop\reporteTest.pdf');
    
        controller.startOperation();
    }
    2. When the I call the method setValue, it checks the datatype I'm supposed to send and, in this case, is showing String when the first datatype is Date:
     
     
  • Martin Dráb Profile Picture
    237,722 Most Valuable Professional on at
    The first thing I would check is whether your parameter in the SSRS report has the right type.
  • Verified answer
    SP-22072258-0 Profile Picture
    84 on at
    Hi,
    I was able to set all the parameters correctly and now the report is printed successfully! Thank you everyone for the help.
     
    This is my code:
    void clicked()
    {
        #define.ParamCheckingDate       ('CheckingDate')
        #define.ParamSummary            ('ReconciliationSummary')
        #define.ParamClearedDetails     ('ClearedTransactionDetails')
        #define.ParamUnclearedDetails   ('UnClearedTransactionDetails')
    
        SrsReportRunController               controller = new BankReconciliationSummaryController();
        SRSPrintDestinationSettings          settings;
        SRSReportParameter checkingDateParam = new SRSReportParameter();
        SRSReportParameter clearedTransactionDetailsParam = new SRSReportParameter();
        SRSReportParameter reconciliationSummaryParam = new SRSReportParameter();
        SRSReportParameter unClearedTransactionDetailsParam = new SRSReportParameter();
        SrsReportRdlDataContract rdlContract;
    
        Map reportParametersMap = new Map(Types::String, Types::Class);
        Map rdlReportParamMap;
    
        checkingDateParam.name(#ParamCheckingDate);
        checkingDateParam.dataType("DateTime");
    
        clearedTransactionDetailsParam.name(#ParamClearedDetails);
        clearedTransactionDetailsParam.dataType("Boolean");
    
        reconciliationSummaryParam.name(#ParamSummary);
        reconciliationSummaryParam.dataType("Boolean");
    
        unClearedTransactionDetailsParam.name(#ParamUnclearedDetails);
        unClearedTransactionDetailsParam.dataType("Boolean");
    
        reportParametersMap.insert("CheckingDate", checkingDateParam);
        reportParametersMap.insert("ClearedTransactionDetails", clearedTransactionDetailsParam);
        reportParametersMap.insert("ReconciliationSummary", reconciliationSummaryParam);
        reportParametersMap.insert("UnClearedTransactionDetails", unClearedTransactionDetailsParam);
    
        rdlReportParamMap = SrsReportRunUtil::createClonedParameters(reportParametersMap);
    
        rdlContract = SrsReportRdlDataContract::newContract("BankReconciliationSummaryRdlContract", rdlReportParamMap);
    
        controller.parmReportName("BankReconciliationSummary.Report");
        controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
        controller.parmShowDialog(false);
    
        rdlContract.setValue(#ParamCheckingDate,DateTimeUtil::newDateTime(mkDate(27,05,2024), 0));
        rdlContract.setValue(#ParamClearedDetails,true);
        rdlContract.setValue(#ParamSummary,true);
        rdlContract.setValue(#ParamUnclearedDetails,false);
    
        controller.parmReportContract().parmRdlContract().setValue(#ParamCheckingDate,DateTimeUtil::newDateTime(mkDate(27,05,2024), 0));
        controller.parmReportContract().parmRdlContract().setValue(#ParamClearedDetails,true);
        controller.parmReportContract().parmRdlContract().setValue(#ParamSummary,true);
        controller.parmReportContract().parmRdlContract().setValue(#ParamUnclearedDetails,false);
    
        settings = controller.parmReportContract().parmPrintSettings();
        settings.printMediumType(SRSPrintMediumType::File);
        settings.fileFormat(SRSReportFileFormat::PDF);
        settings.fileName(@'C:\Users\spineda\Desktop\reporteTestExitoso.pdf');
    
        controller.run();
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 687 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 535 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 403 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans