ABAP - Keyword Documentation →  ABAP - Rules for ABAP Cloud →  Contract Rules for ABAP Released APIs →  C0 Contract Rules →  C0 Contract Rules for CDS Entities → 
Mail Feedback

Example: C0 Released CDS Projection View, Design and Consumption

This topic provides an example for the design of a C0 released CDS projection view. It also shows an example for an extension to this released API from the restricted ABAP language version ABAP for Cloud Development.

CDS projection view as C0 released API

The following CDS projection view DEMO_CDS_PRODUCTTP_PV is based on the CDS view entity DEMO_CDS_PRODUCTTP and it fulfills all requirements for C0 release:

Note: This CDS projection view shows how to create a released API. It meets all the requirements for C0 release. However, it is not released under the C0 contract for extensibility, because it is not intended to be used as an API.

@EndUserText.label: 'Demo for released API, projection layer'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.allowExtensions: true

@AbapCatalog.extensibility: {
  extensible: true,
  elementSuffix: 'EMO',
  allowNewDatasources: true,
  dataSources: ['Product'],
  quota: {
    maximumFields: 250,
    maximumBytes: 2500
  }
}
define root view entity DEMO_CDS_PRODUCTTP_PV  
provider contract transactional_query
as projection on DEMO_CDS_PRODUCTTP as Product
{

  key ProductId,
  
      ProductTitle,
      
      Amount,
      Currency
      
}

CDS view entity extension to a C0 released API

The following CDS view entity extension DEMO_CDS_EXTEND_1 extends the CDS projection view shown above and it fulfills all requirements for consuming a C0 released API from the restricted ABAP language version ABAP for Cloud Development:

The class CL_DEMO_CDS_RELEASED_API_PV provides type information of the enhanced CDS projection view. It also includes the view fields added by the extension.