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.
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.