Extensibility is the single most powerful attribute of any enterprise application, and SAP S/4HANA Document and reporting compliance - statutory reporting (formerly Advanced compliance reporting - ACR) application is no exception. In this blog I will cover a simple yet powerful way on how standard DRC reports can be extended with attributes from different data sources.
Let’s get started, in this blog we will extend parts of generic VAT report definition (ADV_VAT_RET). For more information on Generic VAT DRC report refer to the link.
The company code has branches in several countries, and business store their relevant input tax information in a table in Z namespace in group currency. Whereas in standard generic VAT DRC report TaxAmountInRptgCrcy is mapped in the output. The task is to extend the standard report definition and map the input tax with relevant attribute of the table in which the business store their data. The question arises how do you achieve this requirement with minimal effort? Let’s find out.
The first step would be to identify the data source that is currently mapped in the report definition (ADV_VAT_RET).
Extension flow diagram
All the screenshots have been taken from SAP S/4HANA 2020 OP release.
Part 1 - Extending standard DRC report definition.
Step1: Open Define Compliance Reports application.
Define Compliance Report Tile
Step 2: Click on Add button to extend the generic VAT report (ADV_VAT_RET).
Add new report definition
Step 3: Give the Reference report definition as “ADV_VAT_RET”. Let’s call our new report definition as “ZADV_VAT_RET_EXT”. Click continue.
Extend existing report definition
This will extend the report definition and all the functionalities of the standard report definition would be “inherited” refer column inherited status.
Step 4: Note the Data Source Name and corresponding Query ID. The Query ID is used in the Document definition for the mapping.
Query ID and Data Source Name
Step 5: TAX_SUMMARY_INPUT_TAX query id has ISRTAXRETURNC (I_StRpTaxReturnCube) as a data source. As a next step open document definition and navigate to the mapping section.
Data source ISRTAXRETURNC (I_StRpTaxReturnCube) is not released under C1 stability contract hence there can be changes in the interface of the CDS view.
Document definition mapping
Step 6: As per the business requirement the business do not need TaxAmountInRptgCrcy in the output instead the business wants Amount in group currency from their custom table mapped in the report output.
Let’s call the table ZGRP_RPTG and the attribute that holds the relevant information IPTAXAMTINGRPCRCY.
“The data source ISRTAXRETURNC (I_StRpTaxReturnCube) identified in step 6 do not have Amount in Group Reporting Currency (IPTAXAMTINGRPCRCY) from ZGRP_RPTG. Part 2 shows how the data source ISRTAXRETURNC (I_StRpTaxReturnCube) can be extended with attribute IPTAXAMTINGRPCRCY from ZGRP_RPTG”.
Part 2 - Extending standard CDS data source mapped in standard DRC report output.
Step 1: Fire up the IDE where you have ADT installed, and create the data definition ZI_AMTINGRPCRCY (you can give it any name you like). Give a description and press Next.
Step 2: Select Extend View and click Finish. This will generate a boiler plate code.
Extend CDS view
Step 3: Replace sql_view_append_name with ZAMTGRPCRCY(again you can give a name of your choice) and replace view_name with I_StRpTaxReturnCube.
Step 4: Define an association with ZGRP_RPTG as shown below and expose the attribute IPTAXAMTINGRPCRCY from data source ZGRP_RPTG with an alias of TaxAmtInGroupCurrency.
CDS extension code
@EndUserText.label: 'Amount in group currency'
extend view I_StRpTaxReturnCube with ZI_AMTINGRPCRCY
association [0..1] to zgrp_rptg as ZGRP_RPTG on $projection.companycode = ZGRP_RPTG.bukrs
and $projection.fiscalyear = ZGRP_RPTG.gjahr
and $projection.accountingdocument = ZGRP_RPTG.belnr
and $projection.taxitem = ZGRP_RPTG.buzei
zgrp_rptg.iptaxamtingrpcrcy as TaxAmtInGroupCurrency
The data source(I_StRpTaxReturnCube) mapped in the document definition(Part 1 – Step 6) is extended with IPTAXAMTINGRPCRCY from data source ZGRP_RPTG. Now we can use the exposed attribute for mapping in document definition. So, let’s head back to where we left off in part1.
The exposed attribute would also be available in the corresponding analytical query which consumes the cube view
Note: The performance of the CDS view would have to be taken into consideration. Once the attribute is materialized the corresponding association would be executed as a left outer join.
Part 3 - Mapping the extended data source in DRC output.
Step 1: Go to edit mode and Click on the F4 help against the attribute that you want to remap with. Once the popup appears scroll to the query id TAX_SUMMARY_INPUT_TAX and give the attribute exposed in the extended view in search bar and select the attribute.
Step 2: You can change the label and once it's done save and activate the changes.
Save and activate
Step 3: Let's test the changes. If everything goes fine the report would be generated successfully, and our changes would reflect in the report output.
That's how simple extensibility is in SAP Document and Reporting Compliance. If the blog added something to your knowledge and helped you in your SAP Document and Reporting Compliance journey let me and the community know in the comment section and drop a like. It would be very interesting to see different scenarios where you made use of extensibility. If you have questions related to following topics please refer to the link Advance compliance reporting.
Happy learning and Thank you for reading!
A big thank you to kumarabhishek for sharing his inputs.