SAP C0 DEMO 1



Get Example source ABAP code based on a different SAP table
  



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:
It defines the necessary extensibility annotations.
It is part of a transactional RAP application (indicated by the ROOT characteristic).
It defines the stable data source Product which fulfills all requirements necessary for C0 release.
ABAP_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.
DDLS DEMO_CDS_PRODUCTTP_PV
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 extension fields are derived from the stable data source Product and use the alias name of the stable data source as prefix.
The newly added element II_UnitDescription_EMO uses the mandatory element suffix EMO . ABAP_NOTE The prefix ii is representative. It is meant as reminder to use the correct namespace prefix. In customer systems, the namespace prefix yy or zz must be used.
The newly added element II_UnitDescription_EMO is a path expression with a path length of 3. This traversing along an association path is only allowed because the annotation @AbapCatalog.extensibility.allowNewDatasources is set to true .
DDLS DEMO_CDS_EXTEND_PV
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.