Mentor SAP

ABAP annotations for Views

 

 

ABAP annotations

It defines technical and semantic attributes of a CDS object. They are usually envaulted for every CDS object when activated by the ABAP runtime environment. ABAP annotations can modify the behavior of Open SQL statements that access a CDS entity.

 

Framework-specific annotations

In most cases, the framework-specific annotations must be evaluated by the frameworks of the corresponding software components using a suitable API and are not relevant for activations and the ABAP runtime environment. Here, the names and values of these framework-specific annotations must fellow the rules of the relevant framework.

 

Dependent on the scope, we distinguish 5 groups of annotations

View annotations: Annotations for a CDS view. Placed in front of the DEFINE VIEW statement.

Element annotations: Annotations for an element of the SELECT list of a CDS view. Placed in front of or after the element.

Parameter annotations: Annotations for a parameter of a CDS view. Placed in front of or after the parameter.

Extension annotations: Annotations for a CDS view extension. Placed in front of the EXTEND VIEW statement

Function annotations: Annotations for a CDS table function. Placed in front of the DEFINE TABLE FUNCTION statement.

 

 

For CDS views, the following important ABAP annotations exist:

 

AbapCatalog.sqlViewName: Specifies the name of the CDS database view in the CDS view

 

ClientDependent: Defines client handling when Open SQL is used to access the CDS view. Is optional and the default value is “true”.

 

AccessControl.authorizationCheck: Define the implicit access control when Open SQL is used to access the CDS view.

 

AbapCatalog.compiler.compareFilter: Defines the evaluation of filter conditions in path expressions of the CDS view.

 

AbapCatalog.buffering<…>: Define the buffering of the CDS view in SAP buffering.

 

 

ABAP Annotations for View Elements

 

 

The semantics annotations are used to define the currency fields and quantity fields of CDS view and CDS table functions.

 

ABAP Annotations for Translatable Texts

 

 

ABAP annotations starting with EndUserText are used to define translatable semantic texts for a CDS object.

 

EndUserText.label is available as view annotation or as element annotation. The value is limited to a length of 60 characters.

EndUserText.quickinfo is only available as element annotation. The value is stored as a string and can have arbitrary length.

 

Translation of Annotations

 

 

The values of text annotations are stored in special tables that have a language key and that are translatable. The value specified in the source code should consist of text in the original language of the CDS source code and is translated into the required languages.

 

To translate the texts defined in a given DDL source, proceed as follows:

  1. Start transaction SE63
  2. Choose short texts from the toolbar
  3. On the next dialog window, expand node User Interface Texts
  4. Choose subelement DDLS CDS Views
  5. On the next dialog window, enter the name of the DDL source, the source language, and the target language.
  6. Choose edit.

Dynamic Access to Annotation Texts

 

 

The method of global class CL_DD_DDL_ANNOTATION_SERVICE read the texts as specified by an input parameter for the language.