Home > Dynamics Ax > Displaying the Standard Ax report in EP pages of AX

Displaying the Standard Ax report in EP pages of AX


If we have scenario like, client not ready to adapt the SSRS, and he wants the report in EP pages of Dynamics Ax 2009. Eventually we need to use standard Ax reports for generating the reports.

 

Can we show the standard Ax reports in EP pages?

Yes, we can utilize the same standard Ax reports and can be displayed in the EP pages.

 

The following example will illustrate the same.

 

Displaying the Standard Ax Customers report in EP pages.

 

 Create the following Class and add to the Proxies node.

 

class PSReportRunFromEP

{

    Args                 reportArgs;

    ReportName           reportName;

    ReportRun            reportRun;

    Report               report;

    PrintJobSettings     printJobSettings;

    Query                query;

    CustAccount          custAccount;

}

 

void initValue()

{

    ;

    reportName = "Cust";

    reportArgs = new Args(reportName);

    reportArgs.name(reportName);

}

 

void reportRun()

{

    ;

    reportRun = new ReportRun(reportArgs);

 

    // Set printersettings

    printJobSettings = reportRun.printJobSettings();

    printJobSettings.setTarget(PrintMedium::File);

    printJobSettings.format(PrintFormat::PDF);

    printJobSettings.fileName("D:\Customers.pdf");

    printJobSettings.suppressScalingMessage(true);

   

    reportRun.report().interactive(false);

If we want add any filters to the query like passing customer account number, then we will use the following statement.

    //reportRun.query(query); 

    reportRun.query().interactive(false);

    reportRun.init();

    reportRun.run();

}

public static void reportToPDFFile()

{

    PSReportRunFromEP reportRunFromEP = new PSReportRunFromEP();

    ;

    reportRunFromEP.initValue();

    reportRunFromEP.reportRun();

}

 

static void main(Args args)

{

    ;

    PSReportRunFromEP::reportToPDFFile();

}

 

We can test the same, by executing the above class. PDF file will be generated with the customer details.

 

Development for EP:

 

Add the above class to the Proxies under  AOT àWebàWeb FilesàStatic FilesàProxies

 

/class:PSReportRunFromEP

    /method:PSReportRunFromEP.reportToPDFFile

 

 Create the new web part and add the following code to the web part:

 

using Microsoft.Dynamics.Framework.BusinessConnector.Session;

using System.IO;

using ApplicationProxy = Microsoft.Dynamics.Portal.Application.Proxy;

using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;

 

protected void Page_Load(object sender, EventArgs e)

    {

        FileInfo fi = null;

 

//calling the proxy method for generating the report into PDF file and the same report we are displaying in EP       

Microsoft.Dynamics.Portal.Application.Proxy.PSReportRunFromEP.reportToPDFFile(this.AxSession.AxaptaAdapter);

        fi = new FileInfo("D:\Customers.pdf");

 

        if (fi.Exists)

        {

            Response.Clear();

            Response.ContentType = "application/pdf";

            Response.Flush();

            Response.WriteFile(fi.FullName);

            Response.End();

           

        }

       

    }

 

Add this web part to the new page, import the URL definition in to the Ax AOT, and add this URL to web menus of Sales module.

 

 

This way, we can show the standard Ax reports in EP pages. Gift with a bow

Advertisements
Categories: Dynamics Ax
  1. Bala
    June 1, 2011 at 3:20 pm

    Hi Santosh,

    Thanks for the good article to display AX Standard Report in the EP Page.

    We are facing some issue in displaying PDF file in distributed servers (Web server, AOS Server, Terminal server, etc.).

    When we generate the AX report in EP, it stores the file in the Web server, and the same report should be displayed in the terminal server (user access the report thro’ RDC in terminal server).

    We are able to see the report in web server but not in the terminal server, it popups with empty screen after redirecting to the New Report Page.

    Note: – No error seen in the EP Report Page and also no error thrown in the EventVwr also.

    Any comments or help for this issue is highly appreciated!!!

    Regards,
    Bala

  2. Vikas Mehta
    June 6, 2011 at 12:14 pm

    Hi,
    Is there a way I can call can standard ax reports(eg. sales Invoice) from the enterprise portal ,I am able to run reports of ax from ep , but am not able to do the same with AX SalesConfirm.

  3. September 20, 2012 at 2:28 pm

    Hi i am develop Purchase order report in SSRS not in ssrs envoirment of Ax2009 i want to open that ssrs report against selected purchase order of vendor onn EP how i cqan please guide me
    Thanks

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: