Dear SAP Learners, in the blog post we will learn on how to extend standard CDS Views using Eclipse ABAP Development Tools(ADT).
Given some client/business requirements we may have to extend standard CDS views to add extra fields.
CDS View Extensions
A CDS view is extended by creating a new DDL source with DDL statement EXTEND VIEW. As we know for every DDL source we have 2 corresponding dictionary objects created and we call them as DDIC based CDS view:
- The CDS View and
- SQL View
With S/4HANA 2020, DDIC-based CDS views are deprecated and replaced with ABAP CDS view entity, a new type of CDS view.
So when you extend a CDS view, there will be two corresponding objects created:
- The CDS view extension and
- Append View
Note: CDS view development and extensions is done using Eclipse ABAP Development Tools(ADT). If you have not installed ADT tool, click here to install Eclipse ABAP ADT
Extend Standard CDS Views
Lets see the steps to extend a standard CDS view. In this example I will be using standard CDS view “SEPM_SDDL_SALESORDER_HEAD” and add 3 new fields.
1. Launch the Eclipse ABAP Development Tools.
2. In your ABAP project, select the relevant package in the Project Explorer.
3. Right-click on the package and choose: New – Other ABAP Repository Object – Core Data Services – Data Definition to open the creation wizard.
4. Enter the Name and the Description for the CDS view extension. Choose Next.
5. Assign a transport request, if prompted and choose Next.
6. Select the Extend View template and choose Finish.
7. In DDL source code editor, enter the necessary information for names of the append view, the original CDS view and for the actual view extension like below.
8. In the above CDS view source code, I have extended the view SEPM_SDDL_SALESORDER_HEAD with three new fields:
- payment_terms and
9. Save and activate the newly created CDS view extension.
10. After successful activation, check the DDL SQL Append View “ZD_EXTENDAPPND” in SE11 transaction.
Additional fields are added to original CDS view using append view.
11. Now that, we have created CDS view extension let’s check the output of the original CDS view using Data Preview and in the CDS view output you can see the data for three new fields is displayed.
- A standard CDS view can be extended using multiple CDS view extensions.
- The annotation AbapCatalog.viewEnahancementCategory must be specified in ABAP CDS view with any of these values #PROJECTION_LIST, #GROUP_BY and #UNION.
- A CDS view with AbapCatalog.viewEnahancementCategory as #NONE cannot be extended.
Congrats!! you have successfully learned how to extend standard CDS view using EXTEND VIEW.
Please feel free to comment and let us know your feedback. Subscribe for more updates.
If you liked it ❤️, please share it! Thanks! 🙏