ABAP CDS Projection view – A new type of CDS entity


With ABAP Release 7.54 and S/4HANA 1909, there is a new CDS entity available called ABAP CDS Projection view. In this blog post, we will explain about CDS projection view and its features.


ABAP CDS Views are used to define semantic data models on the standard database tables in S/4HANA. It provides enhanced access functions compared to DDIC database tables and Views. 

There are currently three types of CDS views available: 

  • CDS DDIC-based views (DEFINE VIEW), 
  • CDS Projection views (DEFINE VIEW ENTITY AS PROJECTION) and 
  • CDS View Entities (DEFINE VIEW ENTITY) –  > ABAP 7.55 (or) S/4HANA 2020

What is an ABAP CDS Projection View?

A CDS project view is declared using the statement DEFINE VIEW ENTITY AS PROJECTION in DDL source code using ABAP Development Tools based Eclipse IDE. A projection view is a direct project on exactly one CDS DDIC-based view or CDS view entity and exposes a subset of its elements.

The underlying CDS entity used in the projection view is called a projected entity. The projected entity can be a CDS view without parameters. The DDIC database tables and DDIC database view are NOT allowed as a projected entity.

Syntax of CDS projection view

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Projection View for BuPa'
define view entity DEMO_SALES_PV_BUPA  
  as projection on DEMO_SALES_CDS_BUPA

  key id            as BusinessPartnerID,  
      given_name    as GivenName,
      middle_name   as MiddleName,
      family_name   as FamilyName  


The above DDL source code shows the syntax of an ABAP CDS projection view:

  • A projection view is defined using DEFINE [ROOT] VIEW ENTITY AS PROJECTION ON.
  • From the underlying CDS view DEMO_SALES_CDS_BUPA, all fields and CDS associations of projected entity are exposed.
  • A new alias name is given to all fields in the elements list(optional).
  • The result set can be further restricted by the addition WHERE.

Virtual elements in CDS projection views

In addition to the projected entity (or) underlying CDS view fields, you can also add/expose new read-only elements using the keyword VIRTUAL.

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Projection View on Products'
@Metadata.allowExtensions: true
define view entity DEMO_PRD_PV_I_SL
  as projection on DEMO_PRD_CDS_I_SL
    key node_key   as ProductGuid,
      product_id as ProductId,
      type_code  as CategoryCode,
      supplier_guid as SupplierGuid,
      tax_tarif_code as TaxTarifCode,
      price as Price,
      @ObjectModel.readOnly: true
      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_DEMO_CODE_EXIT'
      cast( '' as abap.char(4)) as Discount

In the syntax above, the class ZCL_DEMO_CODE_EXIT is used to calculate the discount of a product.

For more information, see Using Virtual Elements in CDS Projection Views.

Annotations in CDS projection views

A CDS annotation adds metadata to a CDS entity. The projection view inherits all annotations from the underlying project entity, i.e. CDS entity, except the header annotations.

Following are the ABAP annotations that can be used in ABAP CDS project views.

AbapCatalog.dataMaintenanceTo restrict data preview of a CDS projection view
AbapCatalog.viewEnhancementCategorySpecifies how to extend CDS projection view using ABAP CDS Extensions.
AccessControl.authorizationCheckDefines access control for the CDS projection view
ObjectModel.usageType.dataClassSpecifies the data type of the CDS projection view. For example:- #TRANSACTIONAL, #CUSTOMIZING 
ObjectModel.usageType.sizeCategorySpecifies the size of the data record that must be scanned to return the result.
ObjectModel.usageType.serviceQualityDefines the quality of the service concerning the performance.

Consumption View (vs) Projection View

Consumption views are introduced for data modeling as part of the ABAP Programming Model for SAP Fiori.

Both Projection views and Consumption serve the same purpose to access business objects. But with the new ABAP Restful Programming Model (RAP), projects views will be the future replacement for consumption views.

5 Key takeaways

Now that we have a good understanding of ABAP CDS Project Views, let look at some key takeaways and restrictions.

  • ABAP CDS projection views can not be used as a data source in other CDS entities.
  • They are allowed in ABAP programs as data type definitions and in ABAP SQL select statements.
  • Joins and subquery clauses are not allowed.
  • CDS projection views can’t directly access a DIDC database table and are always based on existing CDS view models.
  • CDS project views do not support Table buffering.
  • A CDS projection view can be extended using a CDS view extension.


Congrats!! you have successfully learnt about ABAP CDS Project views, a new type of CDS entity available from S/4 HANA 1909.

Continue Learning