ABAP Tips: How to Extend a CDS View

ABAP Tips: How to Extend a CDS View featured image

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.

Related: How to Send an Email Alert when an XS Job Fails

How to Extend a CDS View with ABAP

  • Logon to ABAP ADT perspective in Eclipse

ABAP CDS Views

  • Locate your existing CDS view. In my example, I already have a simple CDS view YKD_EKPO.

ABAP CDS Views

Now, let’s create an Extension view.

  • Create a new Data Definition.

ABAP CDS Views

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

ABAP CDS Views

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

CDS Views ABAO

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

CDS Views ABAP

  • Finally, Validate the new fields in SE16 for the base CDS view.

CDS Views ABAP

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.