Ansicht
Dokumentation

ABENC0_CONSUMER_RULES_CDS - C0 CONSUMER RULES CDS

ABENC0_CONSUMER_RULES_CDS - C0 CONSUMER RULES CDS

BAL Application Log Documentation   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

C0 Contract Rules for Consumers of CDS Entities

The provider rules for objects with C0 contract ensure that released objects are changed only in a very restricted way and help to avoid errors and interruptions after an SAP upgrade. Nevertheless, the rules do not prescribe full downward compatibility and leave some room for necessary enhancements to released APIs. Therefore, users of released APIs still have to consider the allowed compatible changes and access the APIs in such a way that the following errors and interruptions are avoided:

  • Problems during the upgrade.
  • Syntax errors after the upgrade.
  • Runtime errors after an upgrade.
  • Wrong behavior after an upgrade.

The following sections list allowed extensions to released APIs that must be considered when creating an extension.

Naming

  • The alias name for elements and associations must start with the correct namespace prefix. For customers and partners, this means that either ZZ or YY must be used as prefix. For associations, it is strongly recommended that the alias name starts with an underscore (_) followed by the correct namespace prefix.

Examples for correct names:

  • DatasourceAlias.field as ZZ_customerField_suffix
  • DatasourceAlias._assoc as _YY_assoc_suffix

General Rules

Rules for Extension Fields

  • To define an additional field for a C0 released API that is selected from another data source, the field must either belong to the same software component, or be C1 released.
  • To define additional fields for a released API, in a scenario where these additional fields are selected from another extension, both extensions must be assigned to the same software component or the extended entity must be C1 released.

Rules for Associations

  • Associations that are released with a stable alias name by the extended entity, using the annotation AbapCatalog.extensibility.dataSources, must not be exposed in the element list.
  • To define a new association in an extension, the association target must be C1 released or created in the same software component.
  • Newly defined, local associations can be exposed in the element list. The name of a newly defined, local association must comply with the naming rules described in section Naming.

Rules for Path Expressions:

  • In an extension to a released API, exposed associations and associations used within path expressions can have a target cardinality of 0 or 1. A target cardinality greater than 1 is not allowed.
  • Path traversing with the exact length of 1 is allowed for released data sources with stable alias names.
  • Path traversing with the exact length of 1 is not allowed for locally defined associations.
  • Path traversing with a length greater than 1 is only allowed in the following cases:
  • The extended object must be a CDS projection view.

  • All traversed objects of the path are CDS view entities or CDS DDIC-based views.

  • Examples for path lengths:

BaseObjectAlias.fieldName //path length of 1
BaseObjectAlias._assoc.fieldName //path length of 2

Restrictions

  • Reusing expressions using $projection as pointer is not supported when extending a released API.
  • The built-in function utcl_current is not supported in extensions to released APIs.

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






ABAP Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 9424 Date: 20240511 Time: 102520     sap01-206 ( 104 ms )