Technical Articles
Building Custom Solutions by Extending CDS Views on SAP S/4HANA Cloud
This blog post provides an insight into the required activities for the extension of the Core Data Services view (CDS view) in SAP S/4HANA Cloud, via the Extensibility app. The blog is a collection of useful information when extending CDS views. They are often required when building a custom solution.
The CDS views are built on existing HANA database tables and views, to provide an efficient way of data modeling. These CDS views can be utilized to retrieve various kinds of data from SAP data sources (dictionary tables), or other CDS Views created to be consumed. Therefore, CDS views are an essential element for customer extensions.
They are used in areas such as analytics, queries and to create forms and reports. To simplify the data access for customers and partners, the CDS views are pre-delivered with SAP S/4HANA Cloud. In the SAP S/4HANA Cloud world, Custom CDS views can only be built on existing CDS views.
Partners and customers can only extend CDS views released by SAP for custom extensions. For example, you can define views that aggregate and analyze data in a layered fashion, starting with existing views delivered by SAP and then add custom views to match your specific use case.
Finding the Relevant CDS View
For an overview of all available customers CDS views, use the View Browser app, found under the Query Design group. However, a user must have the Analytics Specialist business role. For more information, refer to the following link: https://help.sap.com/viewer/a630d57fc5004c6383e7a81efee7a8bb/latest/en-US/0bde695751505c08e10000000a441470.html
The View Browser app displays all the CDS views released by SAP, as well as the custom CDS views, irrespective of their draft or released status.
- For a list of released CDS views, search for the Content Type “CDS Views” in the SAP API Business Hub. Refer to the link – https://api.sap.com/.
- To find examples of SAP ABAP CDS views and demos, refer to the link – https://inui.io/abap-cds-views-examples/
Note:
As a data source for custom extensions, we recommend that you reuse the #INTERFACE-CDS View (#BASIC- and #COMPOSITE- type view).
The #CONSUMER – views are released only on customer request.
Releasing a CDS view for customer with a specific stability contract (C1 – for custom reusing), means that a contract with the customer or a partner is established, ensuring that extensions do not break with the next upgrade/hotfix.
Challenges in Finding the Relevant CDS View
If you cannot find a CDS view to reuse, it could possibly be because of the following reasons:
- The release process of the CDS view is still ongoing
- The CDS View is not available to customers for release, instead, an alternative might be released in the future.
Reusing an Existing CDS view
It is possible to use one of the database fields in an existing CDS view, or use it in a new CDS view to enhance an existing report/app, however, it depends on the requirement.
As a first step it is important to get an overview of the purpose, for which you need a CDS view. This will be the foundation for deciding if any of the existing CDS views can be reused for customer extensibility. For example,
- What is the objective of extending the CDS view? Is it to create a query in Advanced Compliance Reporting, for a custom CDS view, or for analytical queries?
- What are the field types needed (Is it database, calculated field, or other types)?
- Is there a data aggregation needed with other CDS Views?
CDS views used for different purposes in SAP S/4HANA Cloud
In the next step a partner or customer can look for a suitable CDS view. If the relevant one is not available, please contact SAP for a suitable CDS view and request the release for reuse by customers via the following link – Campaign for Extensibility.
We recommend that you apply in advance since there is a process that must be adhered to, for the evaluation and release of CDS views. If the custom CDS view is created, the responsibility for applying any legal and business change passes to the customer.
Kick-starting the extension of CDS Views
Before you move on with developing the extensions you would need to set up users and roles with extensibility authorizations. You should also create test data related to the functional extensions. Creating test data will ensure that you can test the functional extensions as a part of the end-to-end process.
In the subsequent step you start developing the functional extensions. You can refer to the following resources link, which provides step-by-step guidance on how to create CDS views:
https://blogs.sap.com/2019/02/05/key-user-extensibility-in-sap-s4hana-cloud-data-source-extensions-part-1/
After you create a custom CDS view, proceed with its mapping for a report or for analytics activities. You can also refer to the expert content section on the localization toolkit for S/4HANA Cloud for information on how to extend specific localization scenarios.
Finding the relevant BAdI
For some extensibility cases, you would need to do a BAdI implementation, for example, it is needed to adapt a form, and to create a custom logic. You could find a suitable BAdI in the Custom Field and Logic App of the Extensibility App by entering a Business Context.
If there are specific questions or support you need with this scenario, you can reach out to us via a comment on this blog or raise a question here.
Hi Tatiana
Not able to find this service here SAP Discovery Center - Services (cloud.sap)
Hi Leona,
could you explain what are you looking for?
Tatiana