In this post, you will learn about extending a CDS View.

A CDS view extension can be compared to APPEND STRUCTURE in ABAP Dictionary Table as we add fields to the view with extension.

Consider below CDS view which projects few fields from table SPFLI. As you can see, not all fields are available in the list.

Now, if we want to add few more fields such as fltime and distance, we can extend the view.

Create new data definition using New > Other Repository Object … > Data Definition

Enter Name and Description.

Select a template Extend View and click Finish.

Template appears as below.

Give a name for the sqlViewAppendName, view to extend and add required fields. All the fields should be prefixed with the data source from original CDS view.

Activate. The base view will see the enhanced / extended sign.

Execute the base view and you will get the added fields in the output.

The Extension Element List can have below

  • Literals, fields, expressions, functions
  • Parameters
  • Path expressions from association
  • Aggregates only if base view contains aggregates (as of 7.51)


  • View extension can add associations

GROUP BY Clause (as of release 7.51)

  • Only if target view contains a GROUP BY
  • Non aggregated new elements should be added to GROUP BY

UNION(ALL) Statements (as of release 7.51)

  • Same number of UNION statements are required when base view contains UNION

Restricting Extendibility

If you want to restrict what can be extended, use below annotation –

@AbapCatalog. viewEnhancementCategory: [#PROJECTION_LIST]

Possible values are as below

  • #NONE  – No extension
  • #PROJECTION_LIST – Extensions of the SELECT list/additional associations
  • #GROUP BY – Aggregated or non-aggregated elements
  • #UNION – Extensions of the SELECT list of a CDS view with a UNION clause are allowed

It is possible to create multiple extensions for a view. If you are working with custom applications, extension might not be needed, but when you are extending standard applications, it might be useful. However, extending standard views should be done only after lot of consideration and it is a good idea to check with SAP before we do so.

Standard view extension looks like below.

Base View


CDS view extension can be a never ending topic as we can add associations, unions, group by etc., more on that after we go through the basics of association etc., in next posts.

Code Reference

"Base Custom View
@AbapCatalog.sqlViewName: 'ZJP_SQL_SMPL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Simple CDS View'
define view ZJP_SIMPLE_CDS as select from spfli {
    key carrid as Carrid,
    key connid as Connid,
    countryfr as Countryfr,
    cityfrom as Cityfrom,
    airpfrom as Airpfrom,
    countryto as Countryto,
    cityto as Cityto,
    airpto as Airpto

@AbapCatalog.sqlViewAppendName: 'ZJP_EXTEND'
@EndUserText.label: 'CDS Extension'
extend view ZJP_SIMPLE_CDS with ZJP_EXTEND_CDS {

"Standard View Extension
@AbapCatalog.sqlViewAppendName: 'ZEXT_STANDARD'
@EndUserText.label: 'Extend Standard CDS'
extend view demo_cds_spfli  with ZJP_EXTEND_STANDAR_CDS {

Visit ABAP on HANA series for Tutorials on CDS, AMDP, Eclipse, and ALV IDA.

If you like the content, please subscribe…

Join 4,032 other subscribers

Discovering ABAP YouTube Channel