Friday, July 16, 2021

Part 1: Common issues & requirement in SSRS report D365FSCM with Solution.

 

 Requirement:

Design:

 1. Enable Label visibility based on parameter value:

Ex: Sales Invoice.Report > Invoice header (Invoice ops)

Pro forma caption (proforma ops)

Credit Note(credit note scenario)

=IIF(First(Fields!InvoiceId.Value, "SalesInvoiceDS") = Space(0),"PROFORMA INVOICE" , IIf(First(Fields!Qty.Value, "SalesInvoiceDS") >= 0,"INVOICE","CREDIT NOTE"))

 

 2.Visibility of columns based on value availability. 

ex: Discount Amount & Disc Pct ,Here you can't use Firstonly keyword,as 1st row can be zero but not the remaining one.

=IIF(Sum(Fields!DiscountAmount.Value, "SalesInvoiceDS") = 0,True , False)

3.Repeat Table header in Each page of the report.

Put focus on the Table in the report design ,you will find below 

 


4.Group of Text in the report.

Put all the text box under rectangular box.

 

5.Page Number

= Globals!PageNumber

6.Date Format ,remove time from datetime.

=format(First(Fields!CustInvoiceJourDueDate.Value, "SalesInvoiceDS"), "dd/MM/yyyy")

 

Logic:

1.Report Data provider class extension,not inheritance(extends)

 It is safe and reliable to use extension class ,rather than extends as in some scenario the extends class doesn't get trigger even though specifying it in Report Dataset query.

Benefit of using extension over extends is below.

a. No need to modify and sync/restore the Dataset of the Report.

  

b.Extension will get call every scenario.(proforma and salesInvoice calling sequence is different ,so extends create problem ,not extension)

2.Controller class extension

 a > If you want new menuitem or menuitem extension then you have to create extends class

class SalesInvoiceController_AVI extends SalesInvoiceController
{
    public static SalesInvoiceController_AVI construct()
    {
        return new SalesInvoiceController_AVI();
    }

    public static void main(Args _args)
    {
        SrsReportRunController formLetterController  = SalesInvoiceController_AVI::construct();
        SalesInvoiceController_AVI controller = formLetterController;

        controller.parmArgs(_args);
        controller.parmReportName(ssrsReportStr(AVI_SalesInvoiceCopy,Report));
        controller.parmShowDialog(false);
        controller.startOperation();
    }

}

b. We have to do below modification to use our design in print management.

public final class SalesInvoiceController_Extension
{
    protected void outputReport()
    {
        if(Curext() == "USMF")
        {
            formLetterReport.getCurrentPrintSetting().parmReportFormatName(ssrsReportStr(SalesInvoiceCopy, Report));
        }
        next outputReport();
    }

}

3.Menu-item Extension

a >If you want to handle newly created /modified report design  using Print management ,then no need to create a menuitem /no need for change in menuitem.

b > If you want to use existing menuitem then create extension(no print management)

C > If you want to create a separate button to call your new report then create a new Menuitem.

4.Table extension

a > If you want to modify/ add new field to the temporary table ,then you have to create extension of table.

b > If you want to keep the new functionality fields in new table ,then you create a new table.


Print management:

 Below Tables play major role in setting print management for AX Report printing.

1.PrintMgmtReportFormat  

2.PrintMgmtSettings

3.PrintMgmtDocInstance

 

Main Class:

a. create a extension of PrintMgmtDocType

 

b. PrintMgmtReportFormatPopulator

[ExtensionOf(classstr(PrintMgmtReportFormatPopulator))]
final class PrintMgmtReportFormatPopulator_Extension
{
    protected void addDocuments()
    {
        this.addStandard(PrintMgmtDocumentType::SalesOrderInvoice);
        next addDocuments();
    }

}
 

c. Runnable class (job)

Create a runnable class to populate the new design in the above tables.



Reference:

SSRS custom report :

1.       https://denistrunin.com/xpptools-reportsalesinvoice/

2.       http://dynamicsaxtechnicalstuff.blogspot.com/2019/01/customize-design-and-business-logic-of.html

3.       https://www.youtube.com/watch?v=tZOk7EvobjE

4.       https://dynamicsuser.net/ax/f/developers/97588/how-to-call-new-ssrs-report-design-format-in-d365-in-proforma-in-purchase-order

5.       https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/analytics/custom-designs-business-docs#customize-a-business-document


No comments:

Post a Comment

Deploying all SSRS reports or single report in D365FSCM Using PowerShell.

  All reports can be deployed using following commands . 1. Open PowerShell run as administrator  2.Copy and paste below command and enter....