SAP provide many CDS views of the type dimension and cube that can be used as data sources to build analytical queries. .
There are times, however, when you need to create a custom dimension or cube view. For example:
- The ready-made CDS views include only the most commonly used fields from the underlying SAP S/4HANA tables. You need additional fields that SAP did not include in the standard views.
- Custom fields may have been added to the SAP S/4HANA source tables by the customer and these need to be included in the views.
- You may want to simplify the SAP-delivered cubes or dimensions so that they are easier to work with by the people who need to build queries on top of them by removing unwanted fields or changing field descriptions.
- You might want to apply fixed filters to the SAP-delivered views so the data is more relevant to the user.
- You might want to offer users a prompt to allow them to choose their own filters at run-time.
- You may want to create custom calculations.
It is possible to develop new CDS views with the Eclipse IDE, but this tool requires a detailed understanding of the syntax used by CDS views.
SAP provide the Custom CDS Views app which requires only a basic knowledge of views.
The Custom CDS Views app uses a guided process, similar to a wizard. No coding is needed.
The key steps to define a custom CDS view are:
- Choose a primary data source from a list of existing CDS views
- Optionally, choose additional data sources and define the join conditions to the primary data source
- Optionally, define user prompts (provide users an opportunity to select filters)
- Define output columns (choose columns from the primary and additional data sources and create new calculated columns)
- Customize each column (for example, choose an aggregation behavior for measures)
- Optionally, define static filters (these filters cannot be adjusted by the user)
- Check for errors, then publish
A custom view can be consumed by a custom analytical query which in turn can be used as a source for a custom KPI or a new multidimensional report.