Extending SAP Fiori app based on CDS Query
You have checked the Fiori application in Fiori app library and identified the analytical query(Bex Query) is used. This kind of Fiori app allows user to slice and dice the report with dimensions and measures. Analytical query used in Fiori application are mostly built by CDS analytical query. CDS analytical query a powerful framework to model and expose ERP data to front-end such as Fiori, SAP Analytics Cloud and Business Technology Platform. The development of analytical query is done in S4 as embedded analytics requiring only building CDS view in S4 client. They can be created in ABAP Development Tool(ADT) in a form of CDS analytical query and CDS analytical cube.
The Setup
This blog will use Journal Entry Analyzer(F0956) as an example to demonstrate how to extend SAP Fiori app based on CDS Query.
1. Identify CDS view Query
Go to Fiori app library and identify the CDS view Query underneath the Fiori Application. https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/home
Go to tab ‘IMPLEMENTATION INFORMATION’ , open section ‘Configuration’ and find Bex Query. Remove the prefix and copy the view name.
Go to ADT(ABAP Development Tool) and go to search. Enter the view name CFIGLLITMQ0001 and open the view which is listed in the search tab section. Open the CDS view and GUI screen is prompted. Click on the Data definition, which is the CDS view definition.
2. Identify CDS view Cube & Add custom field
Identity CDS view cube that is underneath query. In this case, query C_GLLineItemsQ0001 is fetching data from I_GLAccountLineItemCube, which is the CDS view Cube we are looking for. Create an extension view in your package to extend this CDS view cube. It will look something like this. Define the custom fields and custom association as needed. In the below example, Consolidation Unit is added from the source data and association is added. Association is needed to fetch text information and hierarchy definition. Activate the extension view.
3. Add custom field in CDS view Query
Now CDS view cube is extended, the extended field can be brought up to the CDS view query level. This time, create an extension view for C_GLLineItemsQ0001 following the same principle as extension view for cube. Add Consolidation Unit field defined in cube to query extension view. Activate the extension view.
4. Preview app
Check the Fiori app and extended field Consolidation Unit is available as dimension and filter. Depending on the field annotation in CDS Query, the field appearance in the report and filter may vary as the user see fit.
Custom fields are not appearing in filter bar?
Certain Fiori application requires additional adjustment for the custom fields to appear as filter. Follow my next blog to learn how to perform manual adjustment on WebDnypro FMP.
Adjust WebDynpro FPM to display custom filter for SAP Fiori app based on CDS Query