ABAP Tips: How to Extend a CDS View
ABAP Core Data Services (CDS) were created with application development on SAP HANA in mind. For SAP customers, a CDS view can be easily extended to cater custom requirements. What follows is a detailed, step-by-step guide on how to extend CDS views with ABAP.
How to Extend a CDS View with ABAP
- Logon to ABAP ADT perspective in Eclipse
- Locate your existing CDS view. In my example, I already have a simple CDS view YKD_EKPO.
Now, let’s create an Extension view.
- Create a new Data Definition.
- Tech name of CDS view is YKD_EXPO_EXT.
- Click Next and Select Extend View and hit finish.
- Give a meaningful – YKDEKPOEXT name for SQL view and give the base view – YKD_EKPO which needs to be extended.
- Remove the syntax- base_data_source_name.element_name.
- And hit Control+Space.
- In my case, I am selecting field BUKRS- Company Code and ELIKZ- “Delivery Completed” Indicator.
- Ensure to add the below annotation to this extension CDS view. This would show the text for the Append in next step:
- @AbapCatalog.compiler.compareFilter: true
- Activate the view and you are all set.
- Validate the Base SQL view in SE11 T- code.
- You would notice a spiral icon on the base CDS view which represents that this view has been extended.
- Finally, Validate the new fields in SE16 for the base CDS view.
Find More SAP Tips
This step-by-step guide is a simple example of how you can extend a CDS view to meet the unique needs of your business. We also have more tips on how to optimize your SAP system for your organization’s needs, including New vs. Old ABAP Table Summarizing and Dynamic Selection Screen with ALV IDA and Excel. Continue to follow Rizing for more SAP tips this week and beyond, and contact us for any questions about your SAP system.