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 :
Microsoft Dynamics AX (Archived)

Export multiple PDF's from single SSRS report

(0) ShareShare
ReportReport
Posted on by 1,260

Hi,

I have created a SSRS report which is running and I am able to export the report as a single PDF file.

Also, I have added a page break on the bases of Customer Account No.

Now my question is how can I print separate PDF on the bases of different customer account no. in the local directory?

I don't want to use the data-driven subscription, as it will run as we set the time; whereas I want the report to be exported whenever the client wishes to do so.


Version: Microsoft Dynamics AX 2012 R#, SSRS report 2010.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    No, using standard AX, its not possible, as of today.

    you can think of doing any customization (which can cost you too much time)

    or you can think to develop report in away or call report in a way that you should call it once for 1 customer, save pdf then call report again for next customer

    In standard AX most of reports are developed in same way. one prominent example is CustomerAccountStatement, which is very commonly used to send it to customers, by end of month. Microsoft has developed it in a way that it is run per customer and saved as pdf for each call of report.

    and one more important point there is difference between SSRS and AX-SSRS.

    AX flavored  SSRS lacks too much which standard SSRS provides you. you cannot even think of data-driven subscription easily in AX.

    As per my understanding the solution which can cost you least time, is to develop report in a way so that it can be called per customer and call it per customer and save PDF.

    Stay connected for other's views on this post

  • Suggested answer
    Community Member Profile Picture
    on at

    I agree with Sohaib you have to do customization in report or you may have to run report multiple times for different customers by passing different customer account numbers.

    Following sample code generates Purchase order confirmation PDF:

    PSAPurchaseOrderController poConfirmationController;

    PurchPurchaseOrderContract purchPOContract;

    SRSReportExecutionInfo     reportExecutionInfo;

    Args                       args = new Args();

    SrsReportRunImpl           srsReportRun;

    VendPurchOrderJour         vendPurchOrderJour;

    ReportName                 reportName = ssrsReportStr(PSAPurchaseOrder, Report);

    str                        fileName;

    ;

    select firstOnly vendPurchOrderJour

    order by RecId desc

    where vendPurchOrderJour.PurchId == '';//Replace with PurchOrder Id

    if (!vendPurchOrderJour)

    return '';

    args.record(vendPurchOrderJour);

    poConfirmationController= PSAPurchaseOrderController::construct();

    poConfirmationController.parmArgs(args);

    poConfirmationController.parmReportName(reportName);

    reportExecutionInfo = poConfirmationController.parmReportContract().parmReportExecutionInfo();

    purchPOContract= poConfirmationController.parmReportContract().parmRdpContract();

    purchPOContract.parmRecordId(vendPurchOrderJour.RecId); // Record id must be passed otherwise the report will be empty

    poConfirmationController.parmArgs(args);srsReportRun = poConfirmationController.parmReportRun() as SrsReportRunImpl;

    fileName = System.IO.Path::Combine(WinAPIServer::getTempPath(), strFmt('purchConfirmation_%1.pdf', _purchId));

    poConfirmationController.parmReportRun(srsReportRun);

    poConfirmationController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);poConfirmationController.parmReportContract().parmPrintSettings().overwriteFile(true);

    poConfirmationController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);

    poConfirmationController.parmReportContract().parmPrintSettings().fileName(fileName);

    poConfirmationController.runReport();

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Hi Qureshi,

    What are you including in the construct() method?

    poConfirmationController= PSAPurchaseOrderController::construct();

  • Community Member Profile Picture
    on at

    Nothing, PSAPurchaseOrderController construct method does not accept any parameters.

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Hi Qureshi,

    I have to create Customer Payment Journal Report, based on the code you provided I created one for the same:

    I have created a class "CustPaymentJournal"

    Created a method Custprocessfile(), which includes the following code:

    static void CustprocessFile()

    {

       CustPaymentJournalController_NA customerpaymentjournalcontroller;

       CustPaymentJournalContract_NA customerpaymentjournalcontract;

       SRSReportExecutionInfo reportexecutioninfo;

       Args args=new Args();

       SrsReportRunImpl srsreportrun;

       CustPaymentJournalTmp_NA customerpaymentjournal;

       ReportName reportname=ssrsReportStr(CustPaymentJournal_NA,Report);

       AccountNum accountnum;

       str fileName;

       ;

       select firstOnly customerpaymentjournal

       order by RecId desc

       where customerpaymentjournal.AccountNum=='';

       if(!customerpaymentjournal)

           return;

       args.record(customerpaymentjournal);

       customerpaymentjournalcontroller = CustPaymentJournalController_NA::construct();

       customerpaymentjournalcontroller.parmArgs(args);

       customerpaymentjournalcontroller.parmReportName(ReportName);

       reportexecutioninfo = customerpaymentjournalcontroller.parmReportContract().parmReportExecutionInfo();

       customerpaymentjournalcontract = customerpaymentjournalcontroller.parmReportContract().parmRdpContract();

       customerpaymentjournalcontract.parmLedgerJournalTransRecId(customerpaymentjournal.RecId);

       customerpaymentjournalcontroller.parmArgs(args);

       srsReportRun = customerpaymentjournalcontroller.parmReportRun() as SrsReportRunImpl;

       Filename = System.IO.Path::Combine(WinAPIServer::getTempPath(), strFmt('CustomerPaymentJournal_%1.pdf', AccountNum));

       customerpaymentjournalcontroller.parmReportRun(srsReportRun);

       customerpaymentjournalcontroller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);

       customerpaymentjournalcontroller.parmReportContract().parmPrintSettings().overwriteFile(true);

       customerpaymentjournalcontroller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);

       customerpaymentjournalcontroller.parmReportContract().parmPrintSettings().fileName(Filename);

       customerpaymentjournalcontroller.runReport();

    }

    //////////////////////////////////////

    When I run the report, I get an empty report. Is there anything I am doing wrong or have to do something more to get the report?

  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    I can see two mistakes in your code

    1) you have declared an object for temporary table

    CustPaymentJournalTmp_NA customerpaymentjournal;

    after declaring it, you are trying to get first record of this temp table and trying to pass it as args to controller class

    select firstOnly customerpaymentjournal

      order by RecId desc

      where customerpaymentjournal.AccountNum=='';

    100% its going empty record and as result you are getting nothing.

    2) you are passing a non-relevant DataSource as args, 

    the underlying query of this report, is named as CustPaymentJournal_NA, this query has two DatSources named as LedgerJournalTable and LedgerJournalTrans. None of the dataSources under query is CustPaymentJournalTmp_NA; whereas you are passing a buffer of CustPaymentJournalTmp_NA as args to controller class

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    For the first one:

    Should I use the LedgerJournalTrans table?

    The reason I am using AccountNum as my field because I have added a page break based on the AccountNum.

    Whereas AccountNum is not present in LedgerJournalTrans Table; whereas it has a method parmAccount().

  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    all I can understand from discussion is that you want to run report for specific customer, as you guys create journal for multiple customer and you wan to print report for one customer at a time.

    kindly confirm my understanding about requirement, or specify by yourself, before we suggest you anything further.

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    I want to create a report for Customer Payment Journal.

    The report is generated for all the customers in a single report; whereas when I export the report in PDF, I want it to create multiple reports for different customer.

    How can I achieve this?

  • Sohaib Cheema Profile Picture
    49,679 Super User 2026 Season 1 on at

    okay, as of now

    are you using a existing standard report?

    or

    you have your own customized report?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans