Implementation of CDS Extensibility for S/4 HANA
Extensibility allows customers to adopt standard business software to their business requirement and it offers more convenience for customers in their end to end scenarios.
To achieve this we need to prepare suitable extension points by defining corresponding DDIC artefacts, registering extension options and preparing application code for dealing with the extended structures at runtime. It is applicable for both on-premise and cloud customers.
The following entities can be extended.
- CDS Views
- Email and form templates
- BAdi Implementations
In this blog, we will see how to implement CDS Extensibilty.
Advantages of CDS Extensibility
- Custom fields can be extended along with SAP standard fields.
- Enables to add the association of custom field extend CDS view with standard extensible CDS view.
- Possible to extend unions and views with aggregations.
Scenario: For On-Premise customers, they can extend any standard CDS views by using backend tools like ADT(ABAP Development Tools) or HANA Studio. Whereas cloud customers, cannot add their custom fields to any standard CDS views as they don’t have access to backend tools. In order to overcome this, we will create CDS extensibility where they can do the same by using “Custom Fields and Logic” App.
Required Steps for Extensibility Enablement of the CDS Model:
- Create two Extension Include DDIC Structures.
- Include Persistent Extension Include DDIC Structure into DB Table.
- Create Extension Include CDS View.
- Create Associations from the Extensible CDS views to the Extension Include CDS View.
- Create Business Context in Extensibility Registry.
- Define Extensible CDS Views in Extensibility Registry.
Step 1: Create two Extension Include DDIC Structures.
Creation of Persistent Structure and Transient Structure and their naming conventions as shown below.
Extension Include DDIC Structure for Persistent Extension Fields.
Extension Include DDIC Structure for Transient Extension Fields(This will be used for OData Extensibility)
Step 2: Include Persistent Extension Include DDIC Structure into DB Table.
Step 3: Create Extension Include CDS View
Step 4: Create Associations from the Extensible CDS views to the Extension Include CDS View.
Step 5: Create Business Context in Extensibility Registry.
T-code : SCFD_REGISTRY
Create Business Context in T-code “SCFD_REGISTRY” and provide Persistence Include, Transient Include which has been created in Step 1.
Field Suffix: All the custom fields which will be created by “Custom Fields and Logic” App will be suffixed with the name ‘XX1’ given in “Business Context”.
Step 6: Define Extensible CDS Views in Extensibility Registry.
In “Extensibility Registry” Navigate to “Extensible CDS View” tab and create Extensible CDS view by providing the details which has been created in previous steps as shown below.
Creation of custom fields to Extensible view using “Custom Fields and Logic” App.
- Login to Fiori Launchpad.
- Search for “Custom Fields and Logic” App.
- Navigate to “Custom Fields and Logic” App.
- Click on “Custom Fields” tab.
- Click on Add New Field( ‘+’ ).
- Select “Business Context” Description from the drop-down list and provide the custom field details.
- Click on the “Create” button.
Enable Usage and Publish Enablement
- Click on “UIs and Reports” tab and click on “Enable Usage” for extensible CDS view.
- Publish the custom field by click on “Publish” button.
DDIC Artifacts after Publishing a Custom Field:
After publishing the custom field the following DDIC objects Domain, Data Element, Append Structure will be generated in Backend. The append structure will be included in Persistent Structure and Custom field will be inserted in the DDIC table.
Extension of Extensible CDS views with the custom field.
A spiral symbol will appear at Extensible CDS view with the Extended custom field and added custom field will be displayed in the result set of CDS view along with standard fields.
In this way, we will implement CDS Extensiblity so that the customers can create their custom fields along with standard fields by using “Custom Fields and Logic” App.