In D365FO, there are two versions available for bank payment vendor invoices. However, in the latest version, Microsoft has made it mandatory for users to utilize the Bank Payment Advice V2 report, as shown in the image below.
In this blog, we will discuss how to customize the BankPaymentAdviceVendV2 report step by step.
Create an extension of BankPaymentAdviceVendV2Tmp Table.
Create an extension of the BankPaymentAdviceVendControllerV2 class and write a COC for the getReportName() method. Design your new custom report to replace the out-of-the-box report.
Create an extension of the BankPaymentAdviceVendDPTransferQueryGenerator class and write a COC for addInsertionFeilds() and addProjectionFields() methods to initialize and map your custom fields, if any.
addInsertionFields Method: In this method you need to initialize your custom fields
addProjectionFields Method: In this method you need to map the fields of BankPayAdviceVendTmp (V1) in the same sequenece as provided in addInsertionMethod. It is simply assignment of the value through version 1 table to version 2 table.
Note: If you have customize field in BankPaymentAdviceVendV2Tmp table then you also need to extend BankPaymentAdviceVendTmp, so that you can map it in addProjectionFields method. Otherwise you won't pass the values in fields.
Now subscribe the getDefaultReportFormatDelegate() method and under VendPaymAdvice enum add the highligted code.
Duplicate the OOTB BankPaymAdviceVendV2 report.
Override insert() method event handler (onInserted) of BankPaymentAdviceVendTmp table, so you can assign value in version 1 table and map it in projection fields method as show in step-3 image.
Now just we need to select report format design from Print management setup (Account Payable -> Setup -> Forms).
That is all you need. Cheers!