Ansicht
Dokumentation
ABENCDS_F1_ELEMENT_ANNOTATION - CDS F1 ELEMENT ANNOTATION
BAL_S_LOG - Application Log: Log header data BAL Application Log DocumentationThis documentation is copyright by SAP AG.
- element_annot
... @annotation ...
... @annotation ...
Effect
Specifies an annotation annotation as an element annotation for the following CDS entities:
- Elements in the SELECT list of a CDS view entity
- Elements in the element list of a CDS projection view
- Elements in an element list of a CDS table function
- Elements in an element list of a CDS hierarchy
- Elements in an element list of a CDS custom entity
- Elements in an element list of an CDS abstract entity
- Elements in the SELECT list of a
The elements of the SELECT list or element list of a CDS entity define the components of the result set of database accesses using SELECT and of structured data types in ABAP. The annotations enrich these components with additional semantic properties. The annotation should be defined as a CDS object in a CDS annotation definition and the annotation definition annotation @Scope should be specified using the value #ELEMENT.
Element annotations can be specified before and after the element:
- In front of the element, the character @ must be placed before the name annotation of the annotation.
- After the element, the characters @ must be placed before the name annotation of the annotation.
- This notation is possible for all CDS entities listed above, except for CDS view entities. For CDS view entities, all annotations, including element annotations, are possible only in front of the element they refer to.
Note
For each element annotation that is not part of an annotation array the special value null can be specified without quotation marks. This means that the annotations are ignored in the evaluation with class CL_DD_DDL_ANNOTATION_SERVICE by default.
Aggregation Annotation
Defines a field as analytical measure in an analytical data model.
Aggregation.default,,Defines a field as analytical measure in a
CDS cube view or in a
CDS analytical
projection view.,,#NONE: \lbr Field
is not an analytical measure. \lbr \lbr #SUM:
\lbr The sum of all values in this columns is returned as result. \lbr \lbr
#MIN: \lbr The lowest value of all values in this column is returned as result. \lbr \lbr
#MAX: \lbr The highest value of all values in this column is returned as result. \lbr \lbr
#AVG: \lbr The average of all values is calculated. \lbr \lbr
#COUNT_DISTINCT: \lbr The number of rows is calculated.\lbr \lbr
#NOP: \lbr Returns a value if all values are equal. Otherwise, it returns a special error value.
\lbr \lbr #FORMULA: \lbr Indicates that
the element is a formula. Mandatory for all fields that are newly defined and / or calculated in the element list of a CDS analytical projection view. \lbr ,,-,,-
- The annotation Aggregation.default replaces the obsolete annotation DefaultAggregation.
- This annotation is evaluated by both SADL and analytic manager.
API Annotations
Defines the release of the element in the restricted ABAP language versions.
API.element.releaseState,,In a CDS entity released using a
release contract,
overrides the release of individual elements.,,#DEPRECATED: \lbr The element should no longer be used. If accessed, the element produces a syntax check warning in restricted
ABAP language versions.,,-,,-
API.element.successor,,Name of a successor
that replaces an element forbidden using @API.element.releaseState:#DEPRECATED.,,Name
of an element of the type ElementRef.,,-,,-
Note
In the ABAP language versions and , accessing an element forbidden using @API.element.releaseState:#DEPRECATED in an ABAP program or CDS entity produces a syntax check warning. An element proposed by @API.element.successor should be used instead.
EndUserText Annotations
Translatable texts of the element.
EndUserText.label,,Translatable
short text of the element.,,Character string with maximum 60 characters,,-,,-
EndUserText.quickInfo,,Translatable tooltip of the element.,,String,,-,,-
Note
Environment Annotations
Controls value passing when using the element in a condition of.
Environment.sql.passValue,,Specifies whether a placeholder ? or a literal value is passed to the database in an
condition when the element is compared with
a host variable.,,true:\lbr The literal
value of the host variable is passed. \lbr\lbr false:\lbr
A placeholder ? is passed.,,
false,,true
Semantics Annotations
Semantic properties of the element. The following table contains an additional sixth column which describes further context-specific rules that apply only to certain CDS entities.
Semantics.amount.currencyCode,,Element is defined as a
currency field
to which a currency key is assigned,,'elem_name'
\lbrName of an element defined as a currency key,,-,,-,, In a CDS view entity, mandatory for all elements of data type abap.curr and possible for
CDS amount fields of other data types. Optional in all other CDS entities.
Semantics.currencyCode,,Element is defined as a
currency key,,
true \lbrfalse,,-,,
true,,This annotation is not supported in CDS view entities.
Semantics.quantity.unitOfMeasure,,Element is defined as a
CDS quantity field to which a unit of measurement key or is assigned \lbr In CDS view entities, this annotation can also be used to assign a
calculated unit to a
CDS
calculated quantity,,'elem_name'
\lbrName of an element defined as a unit of measurement key or as calculated unit.,,-,,-,,In a CDS view
entity, mandatory for all elements of data type abap.quan and for all calculated quantities. Possible for
CDS quantity fields of other data types. Optional in all other CDS entities.
Semantics.unitOfMeasure,,Element is defined as a
unit of measurement key,,
true \lbr
false,,-,,true,,This annotation is not supported in CDS view entities.
Semantics.amount.currencyCode and Semantics.quantity.unitOfMeasure must point to elements in the same view which contain the currency or unit key. This rule applies to all CDS entities except for CDS DDIC-based views. In CDS DDIC-based views, the currency or unit key can also be a field from one of the data sources.
If a CDS entity selects from a DDIC database table or from another CDS entity, these semantics annotations are propagated and they don't have to be defined again explicitly.
in CDS views with set operators, the annotation Metadata.ignorePropagatedAnnotations: true is mandatory, propagation is switched off and therefore, reference annotations must be redefined explicitly.
Notes
- The API CL_DD_DDL_ANNOTATION_SERVICE can derive the annotations Semantics.amount.currencyCode and Semantics.quantity.unitofMeasure from DDIC database tables only if the name of the referred currency key or unit key field isn't changed in a CDS view entity. If a CDS view entity selecting from a database table uses an alias name for a currency key or unit key field, then the annotation can't be evaluated by this API.
- These semantics annotations are used to define the currency fields and quantity fields of CDS views, CDS table functions, CDS abstract entities, and CDS custom entities.
- In addition to the ABAP annotations shown here, there are also framework-specific semantics annotations.
- The annotations Semantics.currencyCode and Semantics.unitOfMeasure declare a field as currency key or unit key. In CDS DDIC-based views, these currency/unit key fields are automatically and implicitly assigned to all currency/unit fields that have no other assignment. The assignment order is as follows:
- If there's a direct and local currency or unit key assignment, this assignment is considered.
- If there's no direct and local assignment, it is checked whether there's any inherited currency or unit key that can be derived from one of the data sources.
- If there's no inherited or derived currency or unit key, then the local currency or unit key field is assigned automatically and implicitly, even if it is not specified explicitly.
ObjectModel Annotation
The following ObjectModel annotation can be used in
CDS projection views to bind an ABAP class to a
CDS virtual element.
ObjectModel.virtualElementCalculatedBy,,Binds
an ABAP class to a virtual element in a CDS projection view.,,
'ABAP:class_name' \lbrThe name of the ABAP class
class_name must be specified in single quotation marks and written in uppercase letters. It must
be introduced by the string ABAP:.,,-,,-,, Currently only supported in CDS projection views for
CDS virtual elements.
rdisp/max_wprun_time - Maximum work process run time Vendor Master (General Section)
This documentation is copyright by SAP AG.
Length: 21091 Date: 20240426 Time: 082048 sap01-206 ( 253 ms )