Get Example source ABAP code based on a different SAP table
Example: C0 Released CDS View Entity, Design and Consumption This topic provides an example for the design of a C0 released CDS view entity. It also shows an example for an extension to this released API from the restricted ABAP language version> ABAP for Cloud Development >. CDS view entity as C0 released API> The following CDS view entity DEMO_CDS_PRODUCTTP_E>> is based on the DDIC database table DEMO_PRODUCT>> 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 Persistence> which fulfills all requirements necessary for C0 release. ABAP_NOTE This CDS view entity 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_E CDS view entity extension to a C0 released API> The following CDS view entity extension DEMO_CDS_EXTEND>> extends the view entity displayed 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 Persistence> and use the alias name of the stable data source as prefix.
The newly defined association _ii_ToUnit_EMO> uses the mandatory element suffix EMO >.
The association target DEMO_CDS_UNIT> of the newly defined association _ii_ToUnit_EMO> is C1 released. 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. DDLS DEMO_CDS_EXTEND The class CL_DEMO_CDS_RELEASED_API_VE>> provides type information of the enhanced CDS view entity. It also includes the view fields added by the extension.