0% found this document useful (0 votes)
150 views

CDS Annotations

Uploaded by

Jamila Hamdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views

CDS Annotations

Uploaded by

Jamila Hamdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

CDS Annotations

Table of Contents

Table of Contents 2

Overview 3

ABAP CDS - ABAP Annotations 4

Framework-Specific Annotations 5
Aggregation Annotations 5
AccessControl Annotations 9
Analytics Annotations 11
Consumption Annotations 18
@Consumption.derivation 21
ObjectModel-Annotations 23
Semantics Annotations 26
AbapCatalog Annotations 33

2
Overview
Annotations are code snippets used to enable certain functions or to add component-specific
metadata to a CDS view. the statement which begins with @ called annotation, these are special
statements/ syntax which will enrich the CDS view.

Annotations are used to enrich the source code with meta information. They are relevant for the
generation of the views on the one hand and for the consumers of the CDS ABAP objects on the
other hand. Each framework has its own annotations for the CDS views, e.g. :

● @Analytics
● @Consumtion
● @EnterpriseSearch
● @ObjectModel
● @OData
● @UI

Annotations syntax

Values of an annotation

● Individual literals, e.g. the reference to another field name


● Single values with predefined fixed values. These start with a # and are suggested by the
code completion.
● Single logical values true and false
● Arrays as a list of values or subAnnotations, in square brackets separated by commas.

➔ Depending on their placement, annotations can be Header annotations (affect the entire view
and placed in the header of the file) or Body annotations (affect only the line of code in front of

3
which they are placed) Annotations provide domain-specific metadata to enhance the data
models.

The following list summarizes SAP annotations of the Data Definition Language (DDL)
of ABAP CDS that are relevant in the context of ABAP RESTful programming model
and released for ABAP Cloud Platform.

SAP CDS annotations are evaluated by SAP frameworks and can be either ABAP
annotations or framework-specific annotations.

ABAP CDS - ABAP Annotations

CDS annotations that are evaluated by ABAP runtime:

■ AbapCatalog Annotations
■ AccessControl Annotations
■ ClientHandling Annotations
■ EndUserText Annotations
■ Environment Annotations
■ MappingRole Annotations
■ Metadata Annotations
■ Semantics Annotations

See also: ABAP CDS - View Annotations (ABAP Keyword Documentation)

4
Framework-Specific Annotations

Framework-specific CDS annotations (as a rule) are exposed for OData and
evaluated during runtime.

■ Aggregation Annotations
■ AccessControl Annotations
■ Consumption Annotations
■ ObjectModel Annotations
■ OData Annotations
■ Search Annotations
■ Semantics Annotations
■ UI Annotations

Aggregation Annotations

With this annotation, you can specify the aggregation behaviour of elements in
generic usage like analytic manager or ODATA. Elements without default
aggregation or with Aggregation.default: #NONE will not be aggregated
and will be used in GROUP BY for aggregating access. Elements that can be
aggregated are known as measures.

5
6
7
AccessControl Annotations

Enable application developers to define how the authorization check for a CDS entity is
executed.

8
NOTE

The value #NOT_REQUIRED is recommended for entities for which no authorization


checks are planned yet, but might be needed by the developer or customer laster. To
prohibit roles for the entity, use the value #NOT_ALLOWED.

9
Example

When the developer activates the following DDL document, since an


authorization check is not required, ABAP development tools do not produce a
warning. It does not matter whether a role exists for the entity or not.

At runtime, if there is a role for the entity, then ABAP performs an authorization
check with the role. If there is no role, there is no check and no protection for the
entity.

Analytics Annotations

Enable the analytic manager for multidimensional data consumption,


performing data aggregation, and slicing and dicing data. It is mandatory for each
ENUM value that on field in the storage view exists. BI front ends like SAP
Analytics Cloud can consume the data via the analytic manager.

10
Usage

The Analytic Manager needs a star schema (multidimensional) and a query to consume
the data. Most annotations to define the star schema in different CDS views are
specified in ObjectModel annotations. Some Semantics annotations are also relevant.
The Analytics annotations also specify the facts (center of the star schema),
extraction capabilities for replicating data into further systems, and analytic query
properties. A semantic distinction can be made in the Analytics annotations between
annotations that are relevant for the InfoProvider (CUBE or DIMENSION) level and
annotations that are only relevant for analytic queries.

11
12
13
14
15
16
For more Analytics Annotation, please visit: Analytics Annotations.

Consumption Annotations

Define a specific behavior that relates to the consumption of CDS content


through domain-specific frameworks.

Usage

Via these annotations, the specific behavior is defined which is related to the
consumption of CDS content. This metadata makes no assumptions about the concrete

17
consumption technology/infrastructure, but it is applicable across multiple consumption
technologies (e.g. Analytics or OData).

18
19
Consumption.derivation

The @Consumption.derivation annotations enable values to be derived from


foreign entities by providing the navigation information to those values.
These values are then passed to the main entity, where they are used at
runtime.

20
The binding specifies whether an input parameter or an element filter is used for
the binding.

The binding type specifies how the binding is filled:

For more Consumption Annotations, please visit: Consumption Annotations.

21
ObjectModel-Annotations

Provide definitions of structural as well as transactional related aspects of the


business data model.

22
23
The most used annotations:

24
Semantics Annotations

Used by the core engines for data processing and data consumption.

Usage

Semantic annotations complement the concept of semantic data types, while


semantic data types always introduce specific behavior in the provider/core
infrastructure (through dedicated operations or conversion functions).

Semantic annotations allow the standardizing of semantics that only have an


impact on the consumption side (such as currency code representation
together with the amount).

25
26
27
28
29
30
For more Semantics Annotations, please visit: Semantics Annotations.

31
AbapCatalog Annotations

32
33

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy