Ansicht
Dokumentation

ABENCDS_F1_ENTITY_ANNOTATIONS - CDS F1 ENTITY ANNOTATIONS

ABENCDS_F1_ENTITY_ANNOTATIONS - CDS F1 ENTITY ANNOTATIONS

ABAP Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- entity_annot

... @annotation ...

Effect

Specifies an annotation annotation as an entity annotation in front of the statement in the definition of a CDS entity. Can be used for the following entities:

The character @ must be placed in front of the name annotation of the annotation. The annotation should be defined as a CDS object in a CDS annotation definition and the annotation definition annotation @Scope should be specified here using the value #ENTITY.

AbapCatalog Annotations

Technical settings of a CDS entity.
AbapCatalog.extensibility.elementSuffix,, Defines a 3-character element suffix which must be used for extension fields and extension associations when extending a released API. ,, 'suffix' \lbr suffix must consist of exactly three alphabetical characters. ,,-,,-
AbapCatalog.extensibility.extensible,,Controls the extensibility via CDS entity extensions. ,, true: \lbr Enhancements via CDS entity extensions are allowed \lbr\lbrfalse:\lbr Enhancements via CDS entity extensions are not allowed.,, true,,true
AbapCatalog.extensibility.quota.maximumBytes,,Defines the maximum number of bytes that can be added to a released API via extensions. ,, Integer between 0 and 10000,, -,,-
AbapCatalog.extensibility.quota.maximumFields,, Defines the maximum number of fields that can be added to a released API via extensions. ,, Integer between 0 and 1000.,, -,,-

  • AbapCatalog.extensibility.quota.maximumFields:
  • The maximum field count specified after maximumFields plus the field count of the current CDS entity must not exceed the technical limitations of the ABAP server. Currently, the technical limitation is at 1500 fields.

  • The value specified should be at least 100 (indicated by a syntax check warning).

  • AbapCatalog.extensibility.quota.maximumBytes:
  • The maximum byte count specified after maximumBytes plus the byte count of the current CDS entity must not exceed the technical limitations of the ABAP server. Currently, the technical limitation is at 2^19-1 bytes.

  • The value specified should be at least 1000 (indicated by a syntax check warning).

  • AbapCatalog.extensibility.elementSuffix:
A valid suffix must obey the following rules:
  • If the object is created in a customer or partner system, the suffix must have Y or Z as first character.

  • If the object is created in an SAP system, the suffix must not have Y or Z as first character.

  • If the field suffix is already used by another development object, a syntax check warning occurs.

Note

The annotation AbapCatalog.viewEnhancementCategory specifies how a CDS view can be extended. AbapCatalog.viewEnhancementCategory and AbapCatalog.extensibility.extensible can optionally be specified together in the same CDS view. In this case, the annotation values must fit to each other. They must both either allow or forbid extensions.

EndUserText Annotations

Translatable texts of the CDS entity.
EndUserText.label,,Translatable short text of the CDS entity,,Character string with maximum 60 characters,,-,,-

Note

Metadata Annotations

Defines whether metadata extensions are allowed for a CDS entity.
Metadata.allowExtensions,,Defines whether a CDS entity can be extended with metadata extensions,,true:\lbr The current CDS entity can be extended. \lbr false:\lbr The current CDS entity cannot be extended.,,false,,true

Note

Metadata extensions are currently only supported in CDS views and CDS abstract entities. In all other CDS entities, there is no syntax error, but the annotation Metadata.allowExtensions has no effect.

ObjectModel Annotation

The following subannotation of ObjectModel binds an ABAP class to a CDS entity.
ObjectModel.query.implementedBy,,Binds an ABAP class to a CDS entity that overrides the entity's own data retrieval method. The data retrieval is performed at runtime by a method of the class. ,, 'ABAP:class_name'\lbr The name of the ABAP class class_name must be specified in single quotation marks and it must be written in uppercase letters. It is introduced by the string ABAP:.,,-,,-

This annotation is currently supported in all CDS entities except for CDS abstract entities. The annotation is evaluated by frameworks such as SADL and therefore, it is especially relevant for entities that can be used in RAP business services.

Notes

  • This annotation is framework specific. It is not evaluated by the ABAP runtime framework, but, e.g., by the SADL framework instead. The ABAP class must implement the predefined ABAP interface IF_RAP_QUERY_PROVIDER to connect it to SADL.
  • This annotation was first made available for CDS custom entities and this kind of data retrieval is typical for CDS custom entities. Only later it was also made available for other kinds of CDS entities.
  • In CDS custom entities, the annotation ObjectModel.query.implementedBy is mandatory when working in or . In all other environments and for all other CDS entities, it is optional.
  • If a CDS projection view implements a RAP unmanaged query using ObjectModel.query.implementedBy and it also contains a CDS virtual element, then the ABAP query is evaluated first and the CDS virtual element is calculated afterwards. The CDS virtual element can use values returned by the ABAP query. This can be useful, for example, in extensibility scenarios.

Example

The CDS view entity DEMO_CDS_SCARR_FROM_ABAP_CLASS is bound to ABAP class CL_DEMO_GET_SCARR. This ABAP class implements the interface IF_RAP_QUERY_PROVIDER and it implements the same SQL query as the view entity does via its SELECT statement.

The program DEMO_CONSUME_BS_SCARR_ABAP accesses the CDS view entity once via its service binding DEMO_SB_SCARR_FROM_ABAP, which binds the service definition DEMO_SD_SCARR_FROM_ABAP_CLASS to an OData node in ICF. This is done using the demonstration class CL_DEMO_BS_CONSUMPTION, which accesses the OData service of the service binding by using an ICF client.

The program accesses the CDS view entity a second time using a SELECT statement. The result is the same, the only difference is that the query class returns the message Nothing found whereas the SELECT statement returns no entries in case the query doesn't return any values.






ROGBILLS - Synchronize billing plans   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 14859 Date: 20240329 Time: 104848     sap01-206 ( 169 ms )