Analytics Extensibility Part I : Custom CDS View
SAP S/4HANA Cloud offers various analytic applications for business users to better analyse the data and make informed decisions. The concept commonly known as S/4HANA Embedded Analytics provides analytical applications such as Overview Pages, Analytic List Pages, Smart Business Reports, Multidimensional Reports and SAP Analytics Cloud Embedded Stories. The Business users can analyse the data and take corrective actions using the intent based navigation configured in the analytical applications enabling the insight to actions scenarios.
It is quite common in the enterprise business scenarios that customers would like to develop their own analytics in addition to what is delivered as part of standard content. SAP S/4HANA Cloud offers end to end development of customer specific analytics using the following key user extensibility applications,
- Custom CDS Views
- Custom Analytical Queries
- Manage KPI and Reports
In this blog series I will take you take you through the above application using a Business Case. In this Blog we will look at the first application Custom CDS View.
In Part II will cove the Custom Analytical Queries application and demonstrate the some of the key capabilities of the tool .
Part III we will utilize the Manage KPI and Reports application to develop a Smart Business KPIs
So lets get started
SAP S/4HANA cloud offers Smart Business report called “Sales Volume: Check Open Sales”. The application provides information about total Invoiced Sales, Open Sales orders and Open deliveries. The standard application considers order related billing, delivery related billing and billing plans. The period to report open order for the above 3 scenarios is based on the following logic in the standard application,
- Open Orders for order related Billing: – Billing date of the sales order item
- Open Orders for delivery related Billing: – Goods issue date of the schedule line. In case goods are not issued then delivery date of the schedule line
- Open Billing Plan: – Billing plan date
Customer would like to report open sales bit differently than the standard application. In case of delivery related billing the customer would like to take a later date of goods issue or the Billing date available in the sales order item. The next sections of the document provides a detail guide on how to realize this requirement using the key user apps.
Custom CDS view
Custom CDS view can be used to create analytical data source. Custom CDS view can be used as the source for another custom CDS view thus enabling a CDS view based Virtual Data Model.
Custom CDS view can be created by,
- Selecting a Primary data source
- Adding one or more associated data sources to provide required data set
- Selecting the fields required from the primary and associated data sources. The application also provides functionality to create calculated fields using case statements, conversions etc
- Including the parameters of the source CDS views or adding new parameters
- Defining the semantics and aggregations behaviors of the fields
The above defined use case can be realized by defining a virtual data model
Building Custom CDS views
The following steps describe building Custom CDS views to realise the example business case
- Create a Custom CDS view using I_SalesAnalyticsCube_1 as primary data source and I_SalesDocumentItem as association with cardinality [ 0..1] on SalesDocument and SalesDocumentItem
- Don’t select any fields of the time dimension (Billing Document Year Month, Billing DocumentDateYear etc) except the Billing Document date field
- Include all other dimensions, all measures providing the quantities and all amount measures in transaction currency from I_SalesAnalyticsCube_1.
- Provide a constant value for the parameter P_Exchangeratetype (as we are going to consider amounts in transaction currency and utilize the query to do currency conversion) and hide it
- Create a calculated field BillingDocumentDate to report open sales in the required time period. The calculated field will populate the later of Billing Date maintained in the sales order item and the goods issue date of the open schedule line in delivery related billing document. The calculated field is defined as below
- Create second CDS view using the CDS view created in the previous step as the primary data source and I_CalendarDate as association with cardinality [0..1] on BillingDocumentDate (calculated field).
- This view will derive the time dimensions as Calendar year, Month, quarter etc based on the new calculated field
- Activate and Publish the CDS View