Get Example source ABAP code based on a different SAP table
C0 Contract Rules for Providers of CDS Entities Currently, CDS view entities>, CDS projection views>, CDS abstract entities>, and CDS custom entities> can be released under the C0 contract for extensibility. The following sections show the most important C0 contract rules for these entities. ITOC
Prerequisites for a C0 Release
The CDS entity> must be marked as extensible. That means that the annotation @AbapCatalog.extensibility.extensible>> must be set to true >. In CDS view entities and CDS projection views, the annotation @AbapCatalog.viewEnhancementCategory >> can be used instead, or both annotations can be used at the same time. Their values must match each other, that means, they must both allow extensions.
The CDS entity must define a 3-character long element suffix using the annotation @AbapCatalog.extensibility.elementSuffix>>.
The CDS entity must define a quota that preserves capacity for extension content. Both annotations @AbapCatalog.extensibility.quota.maximumFields>> and @AbapCatalog.extensibility.quota.maximumBytes>> are mandatory. The maximum number of fields must be an integer between 0 and 1000 and the maximum number of bytes must be an integer between 0 and 100.000.
If the entity to be released is a CDS view entity> or a CDS projection view >, stable alias names for data sources and associations that can be used by extensions> are mandatory. The annotation @AbapCatalog.extensibility.dataSources> > must be set and define at least one stable data source. The data sources and associations which are allowlisted in this way must themselves be released, either under the C0 contract, or under the C1 contract>.
The stable data sources defined in the annotation @AbapCatalog.extensibility.dataSources> must fulfill at least one of the following conditions:
be a data source specified as part of the SELECT> clause (CDS view entity)
be specified as data source after DEFINE VIEW ENTITY AS PROJECTION ON> (CDS projection view)
be a locally defined or redefined association whose association target has exactly one data source defined after FROM> that is a DDIC database table>. An association can only be defined as stable data source if it has a target cardinality of maximum 1.
Release is possible only if all elements use the correct namespace> prefix. For repository objects developed in an SAP system, this means that the element names must not start with YY> or ZZ>. /namespace_prefix> is only allowed if the enclosing object has the same prefix.
For CDS view entities> and CDS projection views >, the following prerequisite applies: They must have exactly one data source after FROM>. This data source must be a DDIC database table>.
The CDS entity must not have any fields of data type LCHR> or LRAW>.
The annotation @AbapCatalog.extensibility.allowNewDatasources>> is optional. It can be set to true> or false>, but true > is allowed only in CDS projection views. When set to true>, consumers of the released API are allowed to use new data sources. This means that a consumer can use a newly defined association in a path expression to include a field from a new data source in the extension.
The annotation @AbapCatalog.extensibility.allowNewCompositions>> is optional. It can be set to true> or false>. The value true> is a prerequisite for node extensibility. It explicitly allows consumers of the released API to add new child nodes to a CDS data model.
Stability Rules After Release
The object in question must not be deleted and the release contract must not be removed.
Client-dependent views must not be changed into client-independent views after C0 release.
The provider contract> must not be changed after C0 release.
The CDS source type> must not be changed after C0 release.
The extensibility annotations must not be removed after C0 release. Changes are allowed within strict limits:
@AbapCatalog.extensibility.extensible> must not be removed and its value must not be changed.
The released stable alias names specified in AbapCatalog.extensibility.dataSources> must not be changed. The target object name a released alias refers to must not be changed. If the released alias name refers to an association, this association must not change its maximum target cardinality. New stable data sources can be added.
The quota definition defined in @AbapCatalog.extensibility.quota.maximumFields> and @AbapCatalog.extensibility.quota.maximumBytes> must not be reduced.
The element suffix defined with @AbapCatalog.extensibility.elementSuffix> must not be changed.
@AbapCatalog.extensibility.allowNewDatasources> must not be removed and its value must not be changed from true> to false >. The reverse, from false> to true>, is possible though.
Key fields must not be changed after the C0 release. Name, position, and data type of key fields must not change. Key fields must not be deleted and no new key fields can be added.
Restrictions
Union views> must not be released under the C0 contract.
Entities with a GROUP BY>> clause are not supported.
The annotation AbapCatalog.viewEnhancementCategory> must not be set to #UNION> or #GROUP BY>.
A maximum of 64 joins is supported (ATC error). A maximum of 32 joins is recommended (ATC warning).
Buffering> is not supported. The annotation @AbapCatalog.entityBuffer >> must not be set to true >.
Client-independent CDS views must not be released under the C0 contract.
Example Topics Example for a C0 released CDS view entity which is extended from a restricted ABAP language version> Example for a C0 released CDS projection view which is extended from a restricted ABAP language version> Example for C0 node extensibility>