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

How to split an AX SSRS report in several windows

(0) ShareShare
ReportReport
Posted on by

Hi guys,

We have an interesting requirement. We will have the standard Purchase Order document output on the screen at the end of posting of an PO confirmation. With header and lines.

However, for each of the PO lines, a separate document should be produced with details of this line. So for example:

1 PO header, 3 PO lines: output in 1 SSRS window, will be saved as PDF
3x SSRS windows: output in 3 windows, each will be saved as Excel

The layout of this Excel file will be quite complex, but we were able to design a mockup in SSRS and when you save it as Excel, it looks OK. So I don't think producing such complex layout can be done via X++ directly but also we want to keep the ability to save it as Excel or PDF.

Now, I thought about creating a new Report Data Provider class in X++, build a new SSRS report and simply call it X times (where X is the number of the posted PO lines) after the standard PO is generated (passing the posted PO of course).

But I thought, wouldn't it be easier to customise the standard PurchPurchaseOrderDP to populate a new temp table, which will be exposed as Dataset in SSRS alongside the PurchPurchaseOrderHeaderTmp and PurchPurchaseOrderTmp. Then in Visual Studio after processing the standard PO, tell SSRS to create a new window when we need it?

Or is it something controlled from AX?

Thanks,
Waldemar

*This post is locked for comments

I have the same question (0)
  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi Waldemar

    As per my understanding, as you wrote, you have to create another ssrs report just for the lines.

    In the new report, use a Group for handle the page break.

    Take a look to this old thread community.dynamics.com/.../97643

  • Verified answer
    Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    My answer is based on the assumption that by "output on the screen" you mean showing the report in the report viewer form.

    It's not clear to me how you would you like to tell the report server to create a new instance of the report viewer form in AX. SSRS don't have any idea what the caller is and what it does with the report it receives.

    The report viewer form clearly is a part of Dynamics AX and must be handled there. Nevertheless if your goal is to create an Excel sheet or a PDF document, you could do it directly (by configuring print destinations) and skip the form in AX completely.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at
    • Each call to a report opens only one instance of SrsReportViewer
    • For 'export into excel or pdf', if you think to do it using x++, while neglecting layout using report, it can give you tough time. Compared to that if your ssrs report has already a set layout, its just a matter of one click and it will be exported as expected layout.
    • So, all you can do, is create 2 layouts, 1 for complete report and another for single line. and call your report using code 1XN times.

    1 stands for calling complete report with all lines

    N can be any number of lines. for each line a new instance of SrsReportViewer will open. i.e. a new call to report with a specific LineNumbe+PO Number.

  • Suggested answer
    syed baber Profile Picture
    11,633 on at

    Hi Waldemar,

    As far as opening a new SSRS window is concerned, this can be achieved by calling outputReports() method under runPrintMgmt method multiple times. There is a method runPrintMgmt in PurchPurchaseOrderController class, so you just need to modify that to call outputReports method based on the number of PO lines. I saw this working in External customer account statement report in which separate window opens for each customer. So you can easily open separate window based on number of PO lines. You need to set a flag somewhere to get the information that how many lines have been printed, so that you can hide other lines based on the flag value.

    For printing one PO header and 3 PO lines and saved as PDF will be easy, if the print management destination is set to PDF under Print management. For the other three lines, once the outputReports method is called, you can probably change the destination to Excel in \Classes\PrintMgmtReportRun\incScreenOutput. I have never done this, but you can try and see if it works for you.

    One thing which I am not sure about is how you can call your new report design in runPrintMgmt method.

    But try other things and see if you are getting any success and may be you can find some workaround later on to call different report design.

    Please let me know if you have further queris.

    Thanks,

    Baber.

  • Community Member Profile Picture
    on at

    Martin, yes, we basically need to show the standard PO header+lines in one SrsReportViewer instance (-> save as PDF), and then for each line another SrsReportViewer window with details for this line (-> save as Excel). Basically this Excel is a matrix based on product dimensions, which is quite complex.

    The user also needs to preview all that on the screen before saving as PDF and Excel. But maybe later when we have confidence in this report, we'll be "printing" it directly to file.

    Yes, it kind of makes sense that you cannot control from SSRS how many SrsReportViewer instances can be created.

  • Community Member Profile Picture
    on at

    Hi Denis. I think we cannot use Group, as we need to output details of each line in a separate window (SrsReportViewer form), so the user can save them as separate files.

  • syed baber Profile Picture
    11,633 on at

    Hi Waldemar,

    You can open separate window by calling outputReports() method as I mentioned above.  Similar requirement implemented in Customer account statement report.

    Please have a look and let me know if you have further queries.

    Thanks,

    Baber.

  • Community Member Profile Picture
    on at

    Hi Baber,

    Thanks a lot. I am already checking it and will let you know if I have any success.

    Is this the method you mean?

    msdn.microsoft.com/.../srsprintmgmtcontroller.outputreport.aspx

  • syed baber Profile Picture
    11,633 on at

    Thanks Waldemar. Yes this is the method which I talked about in my first comment. Better to check the runPrintMgmt method in PurchPurchseOrderContrller class which calles the outputReports method. Also, the same method is being called in CustAccountStatementExtController class well in runPrintMgmt method.

  • Community Member Profile Picture
    on at

    cool, thanks!

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

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans