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

Common Notes

This document summarizes annotations in ABAP CDS, including ABAP annotations evaluated by the ABAP runtime and framework-specific annotations evaluated during runtime by frameworks like SADL, BOPF, and Analytics. It provides details on Analytics annotations, which enable the Analytic Manager for multidimensional data consumption, aggregation, and analysis. Key Analytics annotations include dataCategory, query, dataExtraction, and writeBack, which specify analytic data types, querying, data replication, and write-back capabilities.

Uploaded by

scsizmaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views

Common Notes

This document summarizes annotations in ABAP CDS, including ABAP annotations evaluated by the ABAP runtime and framework-specific annotations evaluated during runtime by frameworks like SADL, BOPF, and Analytics. It provides details on Analytics annotations, which enable the Analytic Manager for multidimensional data consumption, aggregation, and analysis. Key Analytics annotations include dataCategory, query, dataExtraction, and writeBack, which specify analytic data types, querying, data replication, and write-back capabilities.

Uploaded by

scsizmaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 119

12/10/2019

SAP - ABAP Programming Model for SAP


Fiori
Generated on: 2019-12-10

SAP NetWeaver 7.5 | SPS09

PUBLIC

Original content: https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.9/en-US

Warning

This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.

For more information, please visit the https://help.sap.com/viewer/disclaimer.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 1/119
12/10/2019

CDS Annotations
The following list summarizes all SAP annotations of the Data De nition Language (DDL) of ABAP CDS. SAP CDS annotations are
evaluated by SAP frameworks and can be either ABAP annotations or framework-speci c annotations.

ABAP CDS - ABAP Annotations


CDS annotations that are evaluated by ABAP runtime:

AbapCatalog Annotations

AccessControl Annotations

ClientDependent Annotations

DataAging Annotations

EndUserText Annotations

Environment Annotations

MappingRole Annotations

Metadata Annotations

Semantics Annotations

Tip
To access help for an ABAP annotation, position the cursor on relevant annotation in the DDL source editor and choose F1 .

For more information, look here ABAP CDS - ABAP Annotations

Framework-Speci c Annotations
CDS annotations that (as a rule) are evaluated during runtime by speci c frameworks such as SADL, BOPF, Analytics, or
Enterprise Search:

Analytics Annotations

AnalyticsDetails Annotations

Consumption Annotations

DefaultAggregation Annotations

EnterpriseSearch Annotations

Hierarchy Annotations

ObjectModel Annotations

OData Annotations

Search Annotations

Semantics Annotations

UI Annotations

VDM Annotations

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 2/119
12/10/2019

Tip
To access help for an framework-speci c annotation, position the cursor on relevant annotation in the DDL source editor and
choose F1 .

For more information, look here Framework-Speci c Annotations

Related Information
ABAP CDS - Anotations

Analytics Annotations
Enable the Analytic Manager for multidimensional data consumption, performing data aggregation, and slicing and dicing data. BI
front ends like Design Studio and Analysis Office can consume the data via the Analytic Manager.

Scope and De nition

@Scope:[#VIEW]
Annotation Analytics
{
dataCategory : String enum { DIMENSION; FACT; CUBE; AGGREGATIONLEVEL; };
query : Boolean default true;
hidden : Boolean default true;
planning
{
enabled : Boolean default true;
};
dataExtraction
{
enabled : Boolean default true;
delta :
{
byElement : elementRef;
{
name : RefToElement;
maxDelayInSeconds : Integer default 1800;
detectDeletedRecords: boolean default true;

ignoreDeletionAfterDays : Integer;

};
};
};
writeBack
{
className : String;
};
};

Usage
The Analytic Manager needs a star schema (multidimensional) and a query to consume the data. Most annotations to de ne the
star schema in different CDS views are speci ed in ObjectModel annotations. 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) level and annotations that are only relevant for analytic queries.

Annotation Meaning

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 3/119
12/10/2019

Annotation Meaning

Analytics.dataCategory Analytic queries can be de ned on top of CDS view


Analytics.dataCategory annotation.

Scope: #VIEW

Evaluation Runtime (Engine): By specifying the da


provide directives and hints, telling the analytic m
entities for example.

Value Description

#DIMENSION This value indicates t


data. Such a view can
queries.

Example
Typical dimensions
view.

#FACT This value indicates t


transactional data (ce
contains the measure
necessary for replicat
joined with master da

#CUBE The #CUBE value (like


data, but #CUBE does
redundancy. This me
possible. Queries are
where data is replicat

#AGGREGATIONLEVEL This value indicates a


the analytic manager
(planning functionalit
select from a view wit
which supports the a
Analytics.writeB
associations are allow
renamed.

Analytics.dataExtraction.enabled Application developers can use this annotation to


data replication (for example, delta capabilities mu

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which view


scenarios.

Note
This view must be annotated with Analytics.d
value AGGREGATIONLEVEL) or with ObjectMod
value #TEXT or #HIERARACHY .

Value Description

true The view is suitable fo


true, if this annotatio

false The view is not suitab

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 4/119
12/10/2019

Annotation Meaning

Analytics.dataExtraction.delta.byElement.name Application developers can enable the generic delt


This is the element that should be used for ltering
This element can either be a date (ABAP type DAT

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which view


scenarios.

Note
If the eld is a time stamp, the system checks als
Semantics.systemDate.lastChangedAt:

Value Description

elementName as String Name of an element t


during generic delta e

Analytics.dataExtraction.delta.byElement.maxDelayInSeconds There is always a time delay between taking a UTC


commit. This annotation speci es the maximum p

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which view


scenarios.

Value Description

Integer Maximum number of


stamp and the succe
default is 1800 secon

Analytics.dataExtraction.delta.byElement.detectDeletedRecords By using this annotation, the system will remembe


that were extracted in delta mode. If a key combin
anymore, this will automatically generate a delete

Scope: #VIEW

Evaluation Runtime (Engine): Detects deleted rec

Value Description

Boolean The default is true, i

Analytics.dataExtraction.delta.byElement.ignoreDeletionAfterDays
This annotation only makes sense together with
Analytics.dataExtraction.delta.byEle
The extraction will ignore deleted records if they a
of days. The main purpose is archiving.

Example
If records are archived after two years then this v
this case, the deletion in the database tables will
older than 700 days.

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which view


scenarios.

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 5/119
12/10/2019

Annotation Meaning

Integer Speci ed number of

Analytics.hidden You can use this ag to decide whether the entity s


clients.

Scope: #VIEW

Evaluation Runtime (Engine): Views with Analyt


value help. Views with Analytics.dataCatego
for the CDS query designer.

Values:

Value Description

true The view cannot be c


default is true, if this

false The view can be cons

Analytics.planning.enabled An input-enabled query provides writeback capab


scenarios.

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which view


enabled analytic query by the analytic manager.

Note
This view must be annotated with Analytics.q

Value Description

true The view is enabled fo


this annotation is use

Note
The view has to sele
annotated with Ana
#AGGREGATIONLE

false The view is not enabl

Analytics.query Query view classi cation.

Scope: #VIEW

Evaluation Runtime (Engine): By tagging the CDS


which views will be exposed to the analytic manag
interpreted as an analytic query by the analytic ma

Note
This view must not be annotated with Analytic

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 6/119
12/10/2019

Annotation Meaning

true The query view will be


The default is true, if

Note
Data will be selecte
from clause. The vi
annotated with the
as #DIMENSION, #C
and the DCL has to
from clause.

false The query view will no


manager.

Analytics.writeBack.className Views with Analytics.dataCategory: #AGG


type of view can be used for planning scenarios. T
the data, authorization checks and enqueuing.

Scope: #VIEW

Evaluation Runtime (Engine): Speci es which clas


to write data to the view.

Note
Only relevant if Analytics.dataCategory:
Analytics.dataCategory: #FACT.

Value Description

className as String Name of an ABAP cla


interface IF_RODPS_

Examples
Example 1

Example for replication-enabled master data.

Sample Code

@EndUserText.label: 'EPM Demo: Employee'


@Analytics:{ dataCategory: #DIMENSION , dataExtraction.enabled: true }
//@VDM.viewType: #BASIC
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.representativeKey: 'EmployeeUUID'
@AbapCatalog.sqlViewName: 'SEPM_IEMPLOYEE'
define view SEPM_I_Employee as
select from snwd_employees

association [0..1] to SEPM_I_Company as _Company on $projection.Company


...

{
key snwd_employees.node_key as EmployeeUUID,
@ObjectModel.foreignKey.association: '_Company'
snwd_employees.parent_key as CompanyUUID,
...}

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 7/119
12/10/2019
Example 2

Example for transactional data (fact).

Sample Code

@EndUserText.label: 'EPM Demo: Sales Order Item with Addtl. Data (private view)'
@Analytics.dataCategory: #CUBE
@AccessControl.authorizationCheck: #CHECK
@AbapCatalog.sqlViewName: 'SEPM_PSOIC'

define view SEPM_P_SalesOrderItemCube


with parameters
P_DisplayCurrency : snwd_curr_code //for currency conversion, TODO: data element with bett

as select from SEPM_I_SalesOrderItem

association [0..1] to SEPM_I_SalesOrder_E as _SalesOrder_E on $projection.salesord


...

{
@ObjectModel.foreignKey.association: '_SalesOr
key _SalesOrder.SalesOrder,
_SalesOrder_E,
...}

Related Information
ObjectModel Annotations
Semantics Annotations

AnalyticsDetails Annotations
Enable application developers to specify the default multidimensional layout of the query, the sequence of variables in UI
consumption, and the speci c aggregation and planning behavior of the data. All these annotations can only be used in views with
@Analytics.query : true.

Scope and De nition

@Scope:[#ELEMENT]
Annotation AnalyticsDetails
{
query
{
formula : String;
axis : String enum { FREE; ROWS; COLUMNS; };
totals: String enum { HIDE; SHOW; };
scaling : Integer;
decimals : Integer;
displayHierarchy : String enum { OFF; ON; FILTER; };
hierarchyBinding : array of
{
type : String enum { ELEMENT; PARAMETER; CONSTANT; USER_INPUT; };
value : String;
variableSequence : Integer;
};
hierarchySettings: {
hidePostedNodesValues: Boolean default true
};

elementHierarchy: {
parent: RefToElement;
initiallyCollapsed: Boolean default true
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 8/119
12/10/2019
};

};
exceptionAggregationSteps : array of
{
exceptionAggregationBehavior : String enum { SUM; MIN; MAX; COUNT; AVG; STD; FIRST; LAST};
exceptionAggregationElements : array of elementRef;
};
planning
{
enabled : Boolean default true;
disaggregation : String enum { NONE; TOTAL; DIFFERENCE; };
distribution : String enum { EQUAL; PROPORTIONAL; PROPORTIONAL_REF; };
distributionReference : elementRef;
};
resultValueSource : String enum { CUBE; DIMENSION; };
};
@Scope:[#PARAMETER, #ELEMENT]
Annotation AnalyticsDetails
{
query
{
variableSequence : Integer;
};
};

Usage

Annotation Meaning

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade96779… 9/119
12/10/2019

Annotation Meaning

AnalyticsDetails.exceptionAggregationSteps.exceptionAggregationBehavior Usually, the default aggregation determi

Caution
The default aggregation behavior cann
cube layer.

In some cases different aggregation beh


(dimension of a cube).

Note
Example: A measure "Inventory" can be
dimensions, but not for time – accordin

Exception aggregation is optional and is


aggregation behavior for speci ed eleme
measure has to be aggregated differently
can be assigned. ExceptionAggregat

Note
Example: In the query there is a measu
positive sales - where sales is a measur
SUM. When the sales measure is now u
exceptionAggregationBehavior
Customer, the sales must rst be agg
to be performed. If the sales for a custo
1 (otherwise it is set to 0). This number

Scope: #ELEMENT

Evaluation Runtime (Engine): The (logic


aggregation is as follows: Firstly the Defa
still grouped by all elements in the list of
aggregated by the exception aggregation

The rst remark holds even if the Default


is performed when the result is still grou
formula has been calculated, the result i
ExceptionAggregationSteps. This
calculation can be de ned precisely.

Value Descri

SUM sum

MIN minim

MAX maxim

COUNT counte

AVG averag

STD standa

FIRST FIRST

LAST LAST

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 10/119
12/10/2019

Annotation Meaning

AnalyticsDetails.exceptionAggregationSteps.exceptionAggregationElements The elements which should be aggregate


: [ '' ] characteristics.

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m


AnalyticsDetails.exceptionAgg

Value Descri

array of elementRef list of e

AnalyticsDetails.planning.disaggregation This annotations allows you to de ne the


for elements with AnalyticsDetails

Scope: #ELEMENT

Evaluation Runtime (Engine): If a measu


analytic query. It enables the user to ma
must be disaggregated on all the data re

Value Descri

NONE No Dis

TOTAL Disagg

DIFFERENCE Disagg

AnalyticsDetails.planning.distribution If disaggregation is chosen, you can choo


this annotation.

Scope: #ELEMENT

Evaluation Runtime (Engine): This anno


element is not enabled for planning.

Value Descri

EQUAL Equal d

PROPORTIONAL Propor

PROPORTIONAL_REF Propor
selecti
Analy
annota

AnalyticsDetails.planning.distributionReference If disaggregation is chosen and Analyti


#PROPORTIONAL_REF, you can specify
this annotation.

Scope: #ELEMENT

Evaluation Runtime (Engine): This anno


element is not enabled for planning.

Value Descri

elementRef Name

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 11/119
12/10/2019

Annotation Meaning

AnalyticsDetails.planning.enabled Individual members in the selection list (


enabling planning. The list can only be us
views have to be annotated with Analyt
Analytics.planning.enabled: t

Scope: #ELEMENT

Evaluation Runtime (Engine): If a measu


analytic query.

Value Descri

true The m
the de

false The m

AnalyticsDetails.query.axis The elements of the view can be position


annotated with their axis. Measures (ele
need to be on the same axis. The annota
measures of the query. If no Analytics
the measures on the columns.

The default value for elements which are


projection list, which belong to the same

Scope: #ELEMENT

Evaluation Runtime (Engine): If the BI c


the layout is derived by this annotation.

Value Descri

FREE Defaul

ROWS

COLUMNS Defaul

AnalyticsDetails.query.decimals For measures, restricted measures and c


to be used.

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m


For other elements it will be ignored.

Value Descri

Integer number from 0 to 9. Numbe

AnalyticsDetails.query.displayHierarchy This annotation allows you to specify the


possible for measures.

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m


speci ed element.

Value Descri

OFF No dis

ON With d
Analy

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 12/119
12/10/2019

Annotation Meaning

FILTER The dis


this ele
on the
lter.

AnalyticsDetails.query.formula This annotation allows you to specify the


SQL formula (operands required from th
(measures) can be used as operands.

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m

Value Descri

String This ex

AnalyticsDetails.query.hierarchyBinding.type The AnalyticsDetails.query.hie


special hierarchy for an element with a d
key eld of the hierarchy directory view.
hierarchy directory, the second entry to
exists, the hierarchy binding can be omit

AnalyticsDetails.query.hierar
lled (by a constant, a parameter, a lter

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m

Value Descri

#ELEMENT Name
lter v

#PARAMETER Param

#CONSTANT Consta

#USER_INPUT USER_
analyt
same n
The va
Analy

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 13/119
12/10/2019

Annotation Meaning

AnalyticsDetails.query.hierarchyBinding.value This annotation contains, depending on


$parameter), the element name and a

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m

Value Descri

String(512)

AnalyticsDetails.query.hierarchyBinding.variableSequence This annotation allows you to specify the


UIs.

Note
You can also use the annotation
Consumption.filter.hierarchy

In case lters or parameters are not ann


order they appear in the CDS document.

Scope: #ELEMENT

Evaluation Runtime (Engine): Analytic m

Value Descri

Integer This nu
the use

AnalyticsDetails.query.scaling For measures, restricted measures and c


used.

Scope: #ELEMENT

Evaluation Runtime (Engine): This anno


will be ignored.

Value Descri

Integer: Integer number Numbe


from 0 to 9.

AnalyticsDetails.query.totals For attributes you can set the behavior fo

Scope: #ELEMENT

Evaluation Runtime (Engine): These ann

Value Descri

HIDE Totals
elemen

SHOW In add
set for

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 14/119
12/10/2019

Annotation Meaning

AnalyticsDetails.query.variableSequence If user input is necesssary for the param


can be speci ed with this annotation.

Scope: #PARAMETER, #ELEMENT

Evaluation Runtime (Engine): UIs will cr


input or elements with lters (consumpt
sequence of user prompts at runtime. If
after the annotated ones - in the order th

Value Descri

Integer Order
contai

AnalyticsDetails.query.hierarchySettings.hidePostedNodesValues For some hierarchies (typical example: C


posted values on their own (and not just
are displayed as separate rows in the rep
can be suppressed.

Scope: #ELEMENT

Evaluation Runtime (Engine):

Value Descri

Boolean true i

AnalyticsDetails.query.elementHierarchy.parent Measures, restricted measures and calcu


structure of the Analytic Query. To achie
annotated with @AnalyticsDetails.
hierarchically below the speci ed parent

Scope:#ELEMENT

Evaluation Runtime (Engine):

Value Descri

elementRef Alias o
entry.

AnalyticsDetails.query.elementHierarchy.initiallyCollapsed If true, the hierarchy node represented b


applicable if the annotated entry has chi

Scope:#ELEMENT

Evaluation Runtime (Engine):

Value Descri

Boolean true i

AnalyticsDetails.resultValueSource This annotation in uences the list of valu


characteristic.

Scope: #ELEMENT

Evaluation Runtime (Engine): When the


characteristic if there are posted values

Value Descri

CUBE All valu

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 15/119
12/10/2019

Annotation Meaning

DIMENSION All valu

Examples
Example 1

Calculated Elements

Sample Code

@Analytics.query : true
define view fincancial as select from sales

{
@AnalyticsDetails.query.axis : #ROWS
product,
@AnalyticsDetails.query.axis : #COLUMNS
@AnalyticsDetails.query.formula : 'revenue - cost'

1 as absolute_margin,

@AnalyticsDetails.query.formula : 'NDIV0($projection.absolute_margin / revenue ) * 100'

1 as relative_margin,

@AnalyticsDetails.query.formula : 'CASE WHEN $projection.relative_margin > 20 THEN revenue ELSE 0


1 as revenue_for_margin_gt_20

Example 2

Display hierarchy selection: Specify the hierarchy directly.

Sample Code

@Analytics.query : true

define view costcenter_reporting

with parameters

cost_center_hier_param : String

as select from costcenters

...

@AnalyticsDetails.query : {

displayHierarchy: #ON,

hierarchyInitialLevel: 3, // three levels of the hierarchy will be opened at start

hierarchySettings{hidePostedNodesValues: true }, // don't show posted node values

hierarchyBinding :

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 16/119
12/10/2019

[ { type : #CONSTANT, value : 'CONTR_AREA_10' },

{ type : #PARAMETER, value : 'cost_center_hier_param' }

costcenter, // hierarchy node filter

costs,

...

Example 3

Use of $session variables, especially $session.system_date.

The system supports variables like $session.system_date for different use cases:

in cube parameters

Sample Code

@Analytics.query : true

define view …
as select from zCostCenter_Flt( P_KeyDate: $session.system_date )

in queries on time-dependent master data in where clauses

Sample Code

} where
DateTo >= $session.system_date and
DateFrom <= $session.system_date

in paths to time-dependent attributes or texts

Sample Code

_CostCenter[1: DateTo >= $session.system_date and DateFrom <= $session.system_date]._Text[1: L

in restricted key gures

Sample Code

case when PostingDate = $session.system_date

Related Information
DefaultAggregation Annotations
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 17/119
12/10/2019

Consumption Annotations
De ne a speci c behavior that relates to the consumption of CDS content through domain-speci c frameworks.

Scope and De nition

@Scope:[#ELEMENT, #PARAMETER]
Annotation Consumption
{
labelElement : elementRef;
valueHelp : elementRef;
hidden : Boolean default true;
derivation
{
lookupEntity : entityRef;
resultElement : elementRef;
resultElementHigh : elementRef;
binding : array of
{
targetParameter : parameterRef;
targetElement : elementRef;
type : String(10) enum { PARAMETER; CONSTANT; };
value : String(512);
};
};
};
@Scope:[#VIEW, #TABLE_FUNCTION, #PARAMETER, #ELEMENT]
Annotation Consumption
{
semanticObject : String;
};
@Scope:[#ELEMENT]
{
derivation.resultHierarchyNode:
{
nodeTypeElement : elementRef ;
mapping: array of { hierarchyElement : elementRef ;
lookupElement: elementRef } };

filter
{
mandatory : Boolean default true;
selectionType : String(20) enum { SINGLE; INTERVAL; RANGE; HIERARCHY_NODE; };
multipleSelections : Boolean default true;
defaultValue : Expression;
defaultValueHigh : Expression;
defaultHierarchyNode: { nodeType : elementRef ;
node : array of { element : elementRef;
value : expression } };
hidden : Boolean default true;
hierarchyBinding : array of
{
type : String(10) enum { ELEMENT; PARAMETER; CONSTANT; USER_INPUT; };
value : String(512);
variableSequence : Integer;
};
};
groupWithElement: elementRef;
};
@Scope:[#PARAMETER]
Annotation Consumption
{
defaultValue : Expression;
};

Usage

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 18/119
12/10/2019
Via these annotations, the speci c behavior is de ned which is related to the consumption of CDS content. This metadata makes
no assumptions about the concrete consumption technology/infrastructure, but it is applicable across multiple consumption
technologies (e.g. Analytics or OData).

Annotation Meaning

Consumption.defaultValue This annotation enables speci cation of a default value for

Scope: #PARAMETER

Evaluation Runtime (Engine): This annotation will be inter

Values:

This value is either proposed to the end user or implicitly s


view whenever the end user does not explicitly specify a di
transparent for the CDS runtime, which means that the Vi
level. Therefore, the consumption framework is responsibl
as a parameter binding when the view is invoked.

Note
The defaultValue annotation is only allowed for View
values can only be speci ed within lters. Hence, the ann
@Consumption.filter.defaultValue has to be us

Consumption.derivation This annotation enables derivation of the value for a param


by selecting a row from a given entity (table).

An element can be annotated with Consumption.deriv


Consumption.filter is present. The derivation is then
empty derivation of a hidden and mandatory parameter/

Note
Annotation of a non- ltered element of the projection list

Scope: #ELEMENT, #PARAMETER

Evaluation Runtime (Engine): This annotation will be inter

Consumption.derivation.binding.targetElement This sub-annotation enables provision of a parametrization


lookupEntity or procedure.

Value Description

elementRef

Consumption.derivation.binding.targetParameter This annotation enables provision of a parametrization for


lookupEntity procedure. This sub-annotation speci es
procedure.

Value Description

parameterRef

Consumption.derivation.binding.type This sub-annotation speci es how the target is lled (by a


element).

The following enumerations (String (10)) are provided

Value Description

#ELEMENT

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 19/119
12/10/2019

Annotation Meaning

#PARAMETER

#CONSTANT

Consumption.derivation.binding.value This sub-annotation contains, depending on the type, the c


(without : or $parameter) or the element name.

Note
If parameter values are used in this sub-annotation, the c
declared before the parameter that is to be derived.i

Note
All provided annotation values are treated case sensitive.

Value Description

String (512) constant value, parameter nam


element name

Consumption.derivation.lookupEntity Reads the result to ll the parameter.

Values: Description

entityRef

Consumption.derivation.resultElement Element of the entity/scalar export parameter of the proce

Values: Description

elementRef

Consumption.derivation.resultElementHigh Element of the intervall export parameter of the procedure

Values: Description

elementRef

Consumption.derivation.resultHierarchyNode.nodeTypeElement This annotation has to reference a eld in the lookup entity


Consumption.derivation either resultElement or

A chargeable node is a node with node type equal to the el

Example
1000/4711 is a costcenter which has further costcenter

There is the need to distinguish between the node (a set of

If the selected value for


Consumption.derivation.resultHierarch
then the leaf will be addressed.

If the value is equal to the element, for which it is u


there is no node with such a name, then the leaf is

Example
If the selected record from the lookup entity is equal to (n
costCenter) = (space, 1000, 4711) means always the leaf.
the node. If this does not exist, then it is interpreted as a

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 20/119
12/10/2019

Annotation Meaning

Values: Description

elementRef This is a eld in the lookup vie


describes the node type. The v
nodeType, have to be element n
view (@ObjectModel.dataC

Caution
Consumption.filter.de
an element name which desc

Consumption.derivation.resultHierarchyNode.mapping The view de ned in lookupEntity contains elds which can


hierarchy node view. The mapping of the elds is described
Consumption.derivation.resultHierarchyNode
and can be omitted, if the eldnames in the lookup entity c
view.

Array of: Description

hierarchyElement :
elementRef

lookupElement:
elementRef

Consumption.filter This annotation enables ltering elements of the underlyin


executing a query on the view.

Scope: #ELEMENT

Evaluation Runtime (Engine):

SADL - Translates the following CDS annotations in


annotations:

Consumption.filter.defaultValue

Consumption.filter.hidden

Consumption.filter.mandatory

Consumption.filter.multipleSele

Consumption.filter.selectionTyp

Analytic Manager supports additionally to the und


following annotations:

Consumption.filter.defaultValue

Consumption.filter.defaultHiera

Consumption.filter.hierarchyBin

Consumption.filter.hierarchyBin

Consumption.filter.hierarchyBin

Note
This element should be exposed by UIs. UIs based on Ana
variables.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 21/119
12/10/2019

Annotation Meaning

Consumption.filter.defaultValue This annotation can be used to provide a xed default valu


transparent for the CDS runtime, which means that the co
extending the - This annotation will be interpreted by the a

The default value is either proposed to the end user or imp


of the view whenever the end user doesn’t explicitly specify

Value Description

Expression Characteristic members need t


noncompounded format.

Consumption.filter.defaultValueHigh This annotation, together with Consumption.filter.d


default interval.

Value Description

Expression Characteristic members need t


noncompounded format.

Consumption.filter.defaultHierarchyNode.nodeType Consumption.filter.defaultHierarchyNode can


Consumption.filter.selectionType = #HIERAR

In Consumption.filter.hierarchyBinding, the hie

The nodeType-annotation references to elements in the h

Value Description

elementRef

Consumption.filter.defaultHierarchyNode.node The node - This-annotation references to elements in the h

Array of: Description

element :
elementRef

value : expression Elements with value initial can

Consumption.filter.hidden The lter will not be shown in the UIs. In combination with
at runtime without user interaction.

Value Description

Boolean (true, De nes whether the lter is hid


false)
Default: true

Consumption.filter.hierarchyBinding.type This annotation determines how the key element is lled (b


element or by a user input eld).

Value Description

#ELEMENT Name of an element, which has


value is used for this hierarchy

#PARAMETER Parameter name

#CONSTANT Constant

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 22/119
12/10/2019

Annotation Meaning

#USER_INPUT USER_INPUT is optional. It wil


query. It can contain a name. U
provided with the same user in
the list of all values in accordan
Consumption.filter.hie

Consumption.filter.hierarchyBinding.value This annotation contains, depending on the type, a literal v


$parameter), the element name and an identi er for the

Value Description

String(512)

Consumption.filter.hierarchyBinding.variableSequence This annotation allows you to specify the order of paramet


UIs.

Note
You can also use the annotation
AnalyticsDetails.query.hierarchyBinding.v

In case lters or parameters are not annotated, they are di


order of appearance in the CDS document.

Value Description

Integer This number de nes the positio


input eld.

Consumption.filter.mandatory To prompt the “Filter UI” to enforce a user entry for a (sem
default value exists (for example, de ned through a CASE e

Example
The user deletes the proposal for a mandatory lter in th
message "Please enter a value for lter ...". After the user
is then sent to the engine. Therefore, the Filter UI ensures
engine is never performed for mandatory lters.

Value Description

Boolean (true,
false)

Consumption.filter.multipleSelections This annotation indicates the lines that can be entered on


the following selectionType values:

Value Description

selectionType IN list
SINGLE and
multipleSelections
= true

selectionType Single interval


INTERVAL and
multipleSelections
= false

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 23/119
12/10/2019

Annotation Meaning

selectionType Several intervals


INTERVAL and
multipleSelections
= true

selectionType Several ranges (complete (ABA


RANGE and
multipleSelections
= true

selectionType Single node, several nodes


HIERARCHY_NODE and
multipleSelections
= true/false

Consumption.filter.selectionType This annotation determines how values can be entered.

Value Description

SINGLE Single value

INTERVAL Special case of a range with si


BT.

RANGE A range is a complete (ABAP lik


(including/excluding) and oper

HIERARCHY_NODE Hierarchy node (means everyth

Consumption.groupWithElement This annotation enables recognition of View/ Entity ele


on the values of other elements and can only be understoo

Scope: #ELEMENT

Evaluation Runtime (Engine): This annotation will be inter

Note
Whenever such elements are used for querying grouped
should also be included in the query's "group by" express

Value Description

elementRef

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 24/119
12/10/2019

Annotation Meaning

Consumption.hidden This annotation prevents elds from being exposed by ODa


elds from being available to the client. This is necessary f
parameters need to be lled by the runtime engine, but mu

Scope: #ELEMENT, #PARAMETER

Evaluation Runtime (Engine):

SADL - Prevents elds from being exposed by ODa

Analytic Manager - For #ELEMENT: In the Analytic


evaluated if the element represents a measure. Typ
measure, which serves as an intermediate result an
Query result.

Note
The eld will not be exposed to UIs.

Value Description

Boolean (true, De nes whether elds are avai


false)
Default: true

Consumption.labelElement This annotation enables consumer frameworks (such as U


which elements the explanatory texts for the "identi er" el

In cases where both the identifier elements and the te


identifier elements are annotated with the labelEle
element that contains the label text. A labelElement an
groupWithElement annotation of the "text" element po

Scope: #ELEMENT, #PARAMETER

Evaluation Runtime (Engine): SADL - The referenced elem


the annotated eld in OData exposure scenarios.

Note
We recommend to use ObjectModel.text.element
Consumption.labelElement annotation.

Value Description

elementRef

Consumption.semanticObject This annotation enables annotation of SAP-speci c busine


standardized business semantics covered by the @Semant

Consumers may leverage this enrichment for enhanced int

Example
SAP Fiori has introduced the concept of intent-based nav
combination of <semanticObject> <action>. A sem
SAP Fiori UIs to dynamically derive navigation targets for

Scope: #ELEMENT, #PARAMETER, #TABLE FUNCTION, #

Evaluation Runtime (Engine): SADL - Translates CDS anno


annotations.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 25/119
12/10/2019

Annotation Meaning

Value Description

String For more information Based on

Consumption.valueHelp This annotation enables referencing of the association to a


the value help object for the annotated element.

The ON condition of the referenced association speci es ho


retrieved for the element. Generic UI consumers have to id
and use the referenced association to retrieve the values.

Instead of de ning the "Value element" of the value help vi


association, you can also specify the "value element" in the
equal ON conditions for the "value element".

Scope: #ELEMENT, #PARAMETER

Evaluation Runtime (Engine):

SADL - Derives a default value help support from t

Analytic Manager

Value Description

elementRef

Examples
Example 1

The annotations Consumption.labelElement and Consumption.quickInfo are used to link the corresponding text and
ID elds:

Sample Code

DEFINE VIEW SalesOrder


AS SELECT FROM sepm_cds_sales_order AS so
{
key so.sales_order_id AS SalesOrderId,

@Consumption.labelElement: 'CompanyName'
@Consumption.quickInfoElement: 'CompanyDescription'
so.buyer_guid AS BuyerGuid,

so.company_name AS CompanyName,

so.description AS CompanyDescription
}

Example 2

The annotation Consumption.groupWithElement is used to de ne that the element CompanyName depends semantically
on the element BuyerGuid. In the case of an aggregated table, the elds can be displayed combined:

Sample Code

DEFINE VIEW SalesOrder with parameters


AS SELECT FROM sepm_cds_sales_order AS so
{

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 26/119
12/10/2019
key so.sales_order_key AS NodeKey,

so.buyer_guid AS BuyerGuid,

@Consumption.groupWithElement: 'BuyerGuid'
so.company_name AS CompanyName,

so.currency_code AS CurrencyCode,

@DefaultAggregation: #SUM
so.gross_amount AS GrossAmount
}

Example 3

The annotation Consumption.hidden is used to prevent elds from being exposed by OData. The annotation, therefore,
prevents elds from being available to the client. This is necessary for system parameters because these parameters need to be
lled by the runtime-engine, but must not be available to the client:

Sample Code

DEFINE VIEW SalesOrder


AS SELECT FROM sepm_cds_sales_order AS so
ASSOCIATION [0..1] TO sepm_cds_business_partner AS _Customer
on $projection.BuyerGuid = _Customer.business_partner_key
{

key so.sales_order_id AS SalesOrderId,

@Consumption.hidden: true
so.buyer_guid AS BuyerGuid,

_Customer.company_name AS CompanyName
}

Example 4

The annotation Consumption.defaultValue is used to specify default values for parameters. In this example, the currency
EUR is used:

Sample Code

DEFINE VIEW SalesOrder with parameters


@Consumption.defaultValue: 'EUR'
p_TargetCurrency : snwd_curr_code
AS SELECT FROM sepm_cds_sales_order AS so
{
key so.sales_order_key AS NodeKey,

$parameters.p_TargetCurrency AS CurrencyCode,

currency_conversion(
amount => so.gross_amount,
source_currency => so.currency_code,
target_currency => $parameters.p_TargetCurrency,
exchange_rate_date => CAST( '20150101' AS abap.dats )
) AS GrossAmount
}

Example 5

The annotation Consumption.valueHelp is used to expose an association as a value help. In this example, the CDS view
CurrencyCodeValueHelp is used for the eld CurrencyCode:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 27/119
12/10/2019

Sample Code

DEFINE VIEW CurrencyCodeValueHelp


AS SELECT FROM currency_code
{
key CurrencyCode,
CurrencyName,
CurrencyDescription
}

DEFINE VIEW SalesOrder


AS SELECT FROM sepm_cds_sales_order AS so
ASSOCIATION [0..1] TO CurrencyCodeValueHelp AS _Currency
on $projection.BuyerGuid = _Customer.business_partner_key
{
so.sales_order_id AS SalesOrderId,

@Consumption.valueHelp: '_Currency'
so.currency_code AS CurrencyCode,

so.gross_amount AS GrossAmount
}

Example 6

The association Consumption.semanticObject is used to assign semantic objects to CDS views or elements that can be
used in the UI for intent-based navigation.

Sample Code

@Consumption.semanticObject: 'SalesOrder'
DEFINE VIEW SalesOrder
AS SELECT FROM sepm_cds_sales_order AS so
{
so.sales_order_id AS SalesOrderId,

@Consumption.semanticObject: 'BusinessPartner'
so.buyer_guid AS BuyerGuid,
}

Example 7

The annotation Consumption.filter is used to enable lters for values. In this example, product_hierarchy is ltered
for several single values of calendar_day, and for one single interval of product.

Sample Code

@Analytics.query : true
DEFINE VIEW product_hierarchy
AS SELECT FROM sales
{
...
@Consumption.filter : { selectionType : #SINGLE, multipleSelections : true}
calendar_day, //several single values are allowed
@Consumption.filter : { selectionType : #INTERVAL, multipleSelections : false }
product, // single interval allowed
...
}

Example 8

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 28/119
12/10/2019
The annotation Consumption.filter is used to enable lters for values. In this example, costcenter_reporting is
ltered hierarchically for the constant CONTR_AREA_10 and for the parameter cost_center_hier_param.

Sample Code

@Analytics.query : true
DEFINE VIEW costcenter_reporting
with parameters cost_center_hier_param : String
AS SELECT FROM costcenters
{
...
@Consumption.filter : {
selectionType : #HIERARCHY_NODE,
multipleSelections : false,
hierarchyBinding :
[ { type : #CONSTANT, value : 'CONTR_AREA_10' },
{ type : #PARAMETER, value : 'cost_center_hier_param' } ]
}
costcenter, // hierarchy node filter

costs,
...
}

Example 9

This example shows how to specify hierarchy nodes as default value in the Consumption.filter annotation. A consumption
view should provide a prompt for a hierarchy node of a costcenter hierarchy with default 1000/ALL (HierarchyNode).

Sample Code

@Consumption.filter{ selectionType: #HIERARCHY_NODE ;


defaultHierarchyNode: { nodeType : ‘HierarchyNode’ ;
node: [ { element: ‘ControllingArea’ ; value:
{ element: ‘HierarchyNode’ ; value: ‘A
hierarchyBinding: [ … ] };
costCenter;

Example 10

This example shows how to enable the Consumption.derivation annotation to return hierarchy nodes. The annotation
Consumption.derivation.resultHierarchyNode is used to return hierarchy nodes. Given a view
CostcenterResponsible with elds eld1, eld2, eld3, eld4, and responsible. The query view should lter by the
costcenter nodes the given responsible (parameter) is responsible for.

Sample Code

@Consumption.filter: { selectionType: #HIERARCHY_NODE ;


hierarchyBinding: [ … ] };
@Consumption.derivation.resultHierarchyNode:
{ lookupEntity: ‘CostcenterResponsible’;
nodeTypeElement: ‘field1’;
mapping: [ { hierarchyElement : ‘ControllingArea’ ; lookupElement: ‘field2’ } ;
{ hierarchy Element: ‘CostCenter’ ; lookupElement: ‘field3’ };
{ hierarchyElement: ‘HierarchyNode’ ; lookupElement: ‘field4’ } ] };
@Consumption.hidden: true;
costCenter;

The hierarchy binding is derived from Consumption.filter.hierarchyBinding. Consumption.derivation can only


be used in combination with Consumption.filter. Futhermore Consumption.filter.selectionType:
#HIERARCHY_NODE has to be true.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 29/119
12/10/2019

DefaultAggregation Annotations
Speci es aggregation behavior on element level

Scope and De nition

@Scope:[#ELEMENT]
Annotation DefaultAggregation : String enum { NONE; SUM; MIN; MAX; AVG; COUNT; COUNT_DISTINCT; FORMULA

Usage

Annotation Meaning

DefaultAggregation When the DefaultAggregation annotation has been speci ed for an element, the corresponding
elements are used as so called measures (elements that can be aggregated) in analytical scenarios.
These measures are aggregated automatically with the default Aggregation. In SQL SELECT statements
you have to specify the aggregation behavior explicitly.

Scope: [ELEMENT]

Evaluation Runtime (Engine): This annotation will be interpreted by the analytic manager.

Values:

Value Description

SUM, MAX, MIN, AVG, All these values determine the default aggregation of the measure.
COUNT, COUNT_DISTINCT
Caution
The analytic manager doesn't support the following values: AVG,
COUNT, COUNT_DISTINCT.

FORMULA The value FORMULA indicates, that the element is a formula which
has to be calculated after the operands have been determined by
aggregation or calculation. It should never be aggregated.

Example: Margin : = Revenue / Cost. If in a report Margin should be


shown per OrgUnit, then rst the aggregates of Revenue and Cost
have to be determined per OrgUnit and then the Margin has to be
calculated per OrgUnit.

NONE This value indicates that the element is not a measure. Usually
these elements are used in lters and GROUP BY statements.

NOTE

If no DefaultAggregation annotation is assigned to an element, the engine assumes the aggregation behavior for values
FORMULA for formulas and NONE value (no aggregation takes place) for other select list entries. Since these are the default values
assumed when DefaultAggregation is absent, this annotation may be omitted altogether (Exception: addressing of
1ROWCOUNT - see example Counters and exception aggregation below).

Examples
Example 1

Counters and exception aggregation

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 30/119
12/10/2019
For CDS views representing master data reports (i.e. the FROM clause refers to a CDS view categoriezed as #DIMENSION), a
counter of the different dimension values can be de ned by combining the annotation DefaultAggregation: #SUM with a
select list entry containing constant value 1:

Sample Code

@EndUserText.label: 'CostCenters per ControllingArea'

@Analytics.query: true

define view ControllingAreaView

as SELECT from CostCenterDimension {

controllingArea,

@DefaultAggregation: #SUM

1 as costCenterCount // because of #SUM aggregation this will be mapped to measure 1ROWCOUNT ge

This way no exception aggregation is involved which leads to improved performance of the report.

Note
This pattern can be combined with CAST statements (for reusing texts of DDIC data types) and/or CASE statements (for
de ning restricted measures). But you must not use other constants than 1 or add annotation
AnalytcisDetails.query.formula.

Related Information
AnalyticsDetails Annotations

EnterpriseSearch Annotations
Note
These annotations are currently only available for SAP-internal projects and not released for customer projects.

Note that SAP might change the behavior of this annotation in future. Consequently, functionality might change. Therefore,
usage is on your own responsibility for customer projects. SAP recommends not to use these CDS annotations in customer
projects.

Scope and De nition

@Scope:[#VIEW, #TABLE_FUNCTION, #ENTITY]


Annotation EnterpriseSearch
{
enabled : Boolean default true;
};
@Scope:[#ELEMENT]
Annotation EnterpriseSearch
{
expand : Boolean default true;

filteringFacet : { default };
defaultValueSuggestElement : true;
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 31/119
12/10/2019
usageMode : array of String(20) enum
{
ADVANCED_SEARCH = 'AdvancedSearch';
AUTO_FACET = 'AutoFacet';
SUGGESTION = 'Suggestion';
};
presentationMode : array of String(20) enum
{
DETAIL = 'Detail';
HIDDEN = 'Hidden';
IMAGE = 'Image';
SUMMARY = 'Summary';
THUMBNAIL = 'Thumbnail';
TITLE = 'Title';
NONE = 'None';
};
commonAttributes : array of String(100);
snippets
{
enabled : Boolean default true;
beginTag : String(128) default '<b>';
endTag : String(128) default '<b>';
};
highlighted
{
enabled : Boolean default true;
beginTag : String(128) default '<b>';
endTag : String(128) default '<b>';
};
};

Usage

Annotation Meaning

EnterpriseSearch.enabled De nes if a CDS view is generally relevant for search scenarios based on SAP
HANA Enterprise Search.

Note
EnterpriseSearch annotations require the annotation
@Search.searchable for the same view.

Scope: #View

Evaluation Runtime (Engine): Interpreted by Enterprise Search

Values:

Value Description

Boolean (true, false) De nes whether a CDS view is relevant for


Enterprise Search or not. If it is set to true a
search connector is created in Enterprise Search
automatically.

Default: true

EnterpriseSearch.filteringFacet Speci es that the element is to be considered as a request eld which is used
for facetted search (also named interactive navigation or guided navigation).

Scope: #Element

Evaluation Runtime (Engine): Interpreted by Enterprise Search

Values:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 32/119
12/10/2019

Annotation Meaning

{ default } De nes weather the element is to be considered


as a request eld in facetted search.
Default: { default }

EnterpriseSearch.defaultValueSuggestElement Speci es that the element is to be considered for suggestions (also named
type-ahead or auto-completion function).

Scope: #Element

Evaluation Runtime (Engine): Interpreted by Enterprise Search

Values:

Value Description

Boolean (true, false) De nes weather the element is to be considered


for suggestions.

Default: true

Related Information
Search Annotations

Hierarchy Annotations
Enables an application developer to specify a parent-child hierarchy that s/he wants to make explicitly accessible in a data model,
together with the structure that de nes this hierarchy.

Scope and De nition

@Scope:[#VIEW]
Annotation Hierarchy
{
parentChild : array of
{
name : String(127);
label : String;
multipleParents : Boolean default true;
recurseBy : elementRef;
recurse
{
parent : array of elementRef;
child : array of elementRef;
};
siblingsOrder : array of
{
by : elementRef;
direction : String(4) enum { ASC = 'ASC'; DESC = 'DESC'; } default #ASC;
};
rootNode
{
visibility : String(25) enum { ADD_ROOT_NODE_IF_DEFINED; ADD_ROOT_NODE; DO_NOT_ADD_ROOT_NODE;
};
orphanedNode
{
handling : String(20) enum { ROOT_NODES; ERROR; IGNORE; STEPPARENT_NODE; } default #ROOT_NODE
stepParentNodeId : array of String;
};
directory : associationRef;
};
};

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 33/119
12/10/2019

Usage
The parent-child hierarchy is based directly on the master data entities. The hierarchy is time-dependent if the master data entity
is as well. The hierarchy is de ned either by one parent element (with Hierarchy.parentChild.recurseBy) or by multiple
parents (with Hierarchy.parentChild.recurse). A parent element describes a self-referencing relationship within the
master data entity and will usually be de ned via an association. Only one level needs to be assigned to a parent-child hierarchy,
because the levels in the hierarchy are taken from the parent-child relationships between members associated with the parent
element. One or more parent-child hierarchies can be de ned within the same master data entity.

Note
A simple example of a parent-child hierarchy is the “Employee” master data. A “Manager” is an “Employee” and almost every
“Employee” is assigned to a “Manager”.

On entity level the following metadata can be de ned:

Annotation Meaning

Hierarchy.parentChild.directory For external hierarchies, the view of hierarchy nodes often contains t
multiple alternative hierarchies. A user is supposed to choose a sing
for display, and his/her selection is used as a lter when selecting fr
hierarchy node view. The directory annotation identi es an assoc
hierarchy directory association, from the hierarchy node view to a v
called hierarchy directory), providing all available alternative hierarc
hierarchy node view.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager: The hierarchy dire


as user input help, and a chosen hierarchy directory entry is used to
nodes via the hierarchy directory association.

Value Description

associationRef Name of the hierarchy directory


to lter the nodes

Hierarchy.parentChild.label User-friendly name of the hierarchy.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager: This name can be


input help for Hierarchy.parentChild.name.

Values (optional):

Value Description

String Description of the hierarchy.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 34/119
12/10/2019

Annotation Meaning

Hierarchy.parentChild.multipleParents Indicates that multiple parents might occur in the hierarchy.

Note
In a geographic hierarchy for example, you might want to assign th
Turkey to the continents Europe and Asia.

Caution
We need to distinguish the above use case from the following one:
hierarchy YEAR, QUARTER, MONTH January under 2011 and Janua
2012 are not the same member with multiple parents. They are diff
Januaries.

Scope: #VIEW

Evaluation Runtime (Engine): The analytic manager can handle hie


multiple roots. This annotation is only relevant for engines that cann
multiple roots.

Value Description

Boolean (true, false) De nes whether multiple parent


the hierarchy or not.

Default: true

Hierarchy.parentChild.name Technical name of the hierarchy. Only relevant if the view de nes one
only, and Hierarchy.parentChild.directory is not used.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager: The hierarchy is ac


queries or in program logic later on via this name.

Value Description

String Technical name of the hierarchy.

Hierarchy.parentChild.orphanedNode.handling De nes how nodes without a parent (more precisely with a parent th
occur as a child) are processed.

Scope: #VIEW

Evaluation Runtime (Engine): Depending on the annotation value, th


manager will ignore orphaned nodes, treat them as root nodes, put t
step parent node or raise an error.

Value Description

ROOT_NODES Treat nodes as root nodes (defau

ERROR Stop processing and show an er

IGNORE Ignore nodes and remove them f


hierarchy.

STEPPARENT_NODE Put nodes under a step parent n

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 35/119
12/10/2019

Annotation Meaning

Hierarchy.parentChild.orphanedNode.stepParentNodeId De nes how nodes without a parent (more precisely with a parent th
occur as a child) are processed.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager:

With the annotation


Hierarchy.parentChild.orphanedNode.handling
STEPPARENT_NODE this annotation contains the node ID(s)
parent node(s).

With parent-child hierarchies, you need to de ne a step pare


for each component (each parent-child combination).

Value Description

stepParentNodeId node ID(s) of the step parent nod

Hierarchy.parentChild.recurse.child If the underlying view de nition does not contain an association de


parent-child relationship but only “normal” elements, this annotatio
used to de ne the children.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager

Value Description

array of elementRef; The element names de ne the k


of the “child”.

Hierarchy.parentChild.recurse.parent If the underlying view de nition does not contain an association de


parent-child relationship but only “normal” elements, this annotatio
used to de ne the parents.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager

Value Description

array of elementRef; The element names de ne the k


of the “parent”.

Hierarchy.parentChild.recurseBy De nes the parent-child relationship in a hierarchy based on an exist


association from hierarchy node to its parent node in the same view.

Scope: #VIEW

Evaluation Runtime (Engine): Analytic manager

Value Description

elementRef The name of the parent-child ass


needs to be speci ed here.

Hierarchy.parentChild.rootNode.visibility Using this annotation, you can de ne dedicated metadata for how to
node(s) in the hierarchy.

Scope: #VIEW

Evaluation Runtime (Engine): Depending on the annotation value, th


manager might add an extra root node to the hierarchy. The label of
the value of Hierarchy.parentChild.label.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 36/119
12/10/2019

Annotation Meaning

Value Description

ADD_ROOT_NODE_IF_DEFINED The system will add the root nod


hierarchy if it is explicitly de ned
system will not add an extra arti
node. This is the default.

ADD_ROOT_NODE The system will always add an a


single root node to the hierarchy
nodes are descendants of this no

DO_NOT_ADD_ROOT_NODE The system will not add an arti


root node to the hierarchy.

Hierarchy.parentChild.siblingsOrder.by Hierarchy.parentChild.siblingsOrder de nes the order o


the same parent.

Hierarchy.parentChild.siblingsOrder.by de nes the ele


which contains the values to be ordered.

Scope: #VIEW

Evaluation Runtime (Engine): The analytic manager sorts all childre


in the given order.

Value Description

elementRef element name

Hierarchy.parentChild.siblingsOrder.direction Hierarchy.parentChild.siblingsOrder de nes the order o


the same parent.

Hierarchy.parentChild.siblingsOrder.direction de n
order of values with the same parent is “ascending” or “descending”

Scope: #VIEW

Evaluation Runtime (Engine): The analytic manager sorts all childre


in the given order.

Value Description

ASC The sort order is ascending (defa

DESC The sort order is descending.

Examples
Example 1

Parent Child Hierarchy for Views with Associations:

Sample Code

@Analytics : { dataCategory : #DIMENSION, replicationEnabled }


@Hierarchy.parentChild : [ { name : ‘Organisation’, recurseBy : ‘Manager’} ]
entity Employee {
key ID : String(8);
Manager : Association to this;
...
};

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 37/119
12/10/2019
Example 2

Parent Child Hierarchy for Views without Associations:

Sample Code

@Analytics : { dataCategory : #DIMENSION, replicationEnabled }


@Hierarchy.parentChild : [ { name : ‘Organisation’,
recurse : { parent : [ ‘Manager’ ] ,
child : [ ‘ID’] }
} ]
entity Employee {
key ID : String(8);
Manager : String(8);
...
};

Example 3

Hierarchy Directory Association:

Sample Code

@Analytics : { dataCategory : #HIERARCHY }


@Hierarchy.parentChild : {
recurseBy : ‘ParentNode’,
directory: ‘CostCenterHierarchyDirectory’
}
entity CostCenterHierarchyNode {
key CostCenterHierarchyDirectory : Association to CostCenterHierarchyDirectory;
key HierarchyNode : CostCenterHierarchyNode;
ParentNode : Association to this;
...
};

ObjectModel Annotations
Provide de nitions of structural as well as transactional related aspects of the business data model

Scope and De nition

@Scope:[#VIEW]
Annotation ObjectModel
{
lifecycle
{
enqueue
{
expiryBehavior : String enum { RELATIVE_TO_ENQUEUE_START; RELATIVE_TO_LAST_CHANGE; } default
expiryInterval : String;
notificationBeforeExpiryInterval : String;
};
processing
{
expiryBehavior : String enum { RELATIVE_TO_PROCESSING_START; RELATIVE_TO_LAST_CHANGE; } defau
expiryInterval : String;
notificationBeforeExpiryInterval : String;
};
};
modelCategory : String enum { BUSINESS_OBJECT; };
dataCategory : String enum { TEXT; HIERARCHY; };
representativeKey : keyElementRef;
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 38/119
12/10/2019
semanticKey : array of elementRef;
compositionRoot : Boolean default true;
transactionalProcessingEnabled : Boolean default true;
transactionalProcessingDelegated : Boolean default true;
createEnabled : Boolean default true;
updateEnabled : Boolean default true;
deleteEnabled : Boolean default true;
writeDraftPersistence : String;
writeActivePersistence : String;
entityChangeStateId : elementRef;
};
@Scope:[#ELEMENT]
Annotation ObjectModel
{
association
{
type : array of String enum { TO_COMPOSITION_CHILD; TO_COMPOSITION_PARENT; TO_COMPOSITION_ROOT;
};
createEnabled : Boolean default true;

text
{
element : array of elementRef;
association : associationRef;
};
hierarchy
{
association : associationRef;
};
foreignKey
{
association : associationRef;
};
readOnly : Boolean default true;
mandatory : Boolean default true;
enabled : Boolean default true;
};

Usage

Annotation Meaning

ObjectModel.association.type[ ] De nes the association type that is used for de nin


view hierarchy.

Scope: [ELEMENT]

Evaluation Runtime (Engine):

SADL: In uences the scope of the OData au


(@OData.publish:true): All views that a
view hierarchy are automatically included in
service.

BOPF: In uences the scope of the BOPF Bu


generation
(@ObjectModel.transactionalProce
true): All views that are included in the view
automatically included in the same BOPF bu

Values:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 39/119
12/10/2019

Annotation Meaning

#TO_COMPOSITION_CHILD Within the compos


there must be a
#TO_COMPOSITIO
association leading
view of a given view

#TO_COMPOSITION_PARENT Views that do not r


the hierarchy must
to their compositio
annotated with
#TO_COMPOSITIO

#TO_COMPOSITION_ROOT Additionally, views


represent the root
#TO_COMPOSITIO
for performance re
authorization chec
restrictions) based
root views).

NOTE: In such a ca
the hierarchy must
@ObjectModel.c
true .

ObjectModel.compositionRoot De nes the root of a compositional hierarchy

Scope: [VIEW]

ObjectModel.createEnabled If this annotation has value true, it is allowed to cre

Scope: [VIEW]

Evaluation Runtime (Engine):

SADL: Exposes this information

BOPF: Rejects create requests that do not p


for this eld (in case of static eld control).
'EXTERNAL_CALCULATION', the create p
in a BOPF property determination (dynamic

ObjectModel.dataCategory De nes the category of data that is represented by


values.

Scope: [VIEW]

Evaluation Runtime (Engine): In ABQL joins betwee


entity without explicit language key handling will be
(0,1) association, where the language key is defaulte
language.

Values:

Value Description

#TEXT Indicates that the


represents texts. U
element is of type

NOTE: Within the V


always language-d

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 40/119
12/10/2019

Annotation Meaning

#HIERARCHY Indicates that the


hierarchy-related d
header informatio
information.

ObjectModel.deleteEnabled If this annotation has value true, it is allowed to de


instances.

Scope: [VIEW]

Evaluation Runtime (Engine):

SADL: Exposes this information

BOPF: Rejects delete requests that do not p


for this eld (in case of static eld control).
'EXTERNAL_CALCULATION', the delete p
in a BOPF property determination (dynamic

ObjectModel.enabled If this annotation has the value true, the correspon


or association) is supported at runtime.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Exposes this i

ObjectModel.entityChangeStateId This annotation is related to a single eld that conta


of an active document. The change state is always u
the document is changed. Usually, elds like last ch
hash values, or version counters are used as Entit

Scope: [VIEW]

ObjectModel.foreignKey.association De nes association to a view that represents a valu


the annotated led. The annotated eld must be va
annotated representative key eld of the target view
target cardinality of the association has to be 1.

Scope: [ELEMENT]

Evaluation Runtime (Engine):

Analytic Manager: Uses associated view as


the annotated eld.

SADL: Derives a default value help support


relationship.

ObjectModel.hierarchy.association This annotation can be added to the key eld that s


association to a hierarchy view. The hierarchy view d
hierarchy for the instances of the current view and i
@ObjectModel.dataCategory: #HIERARCHY

Scope: [ELEMENT]

Evaluation Runtime (Engine):

Analytic Manager: Uses associated view for hierarc

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 41/119
12/10/2019

Annotation Meaning

ObjectModel.lifecle.enqueue.expiryBehavior The creation of an exclusive draft related to an exist


causes an exclusive durable lock of the active docum
lifecycle.enqueue.* annotations allow to ove
defaults for the durable lock expiration handling. Af
time, the durable exclusive lock on the active docum
released. This period of time is de ned by the expira

Enqueue Expiration Behavior:

RELATIVE_TO_ENQUEUE_START - The pe
from the point in time the exclusive durable
initially acquired.

RELATIVE_TO_LAST_CHANGE - The interv


period of inactivity (no modifying roundtrips
document), after that the exclusive durable
removed

Scope: [VIEW]

Evaluation Runtime (Engine): The lifecycle services


unlock active documents accordingly to the de ned
behavior.

ObjectModel.lifecle.enqueue.expiryInterval Using this annotation, you can specify an interval to


duration.
The value must be compliant to the dayTimeDura
(http://www.w3.org/TR/xmlschema11-2/#dayTime

Scope: [VIEW]

ObjectModel.lifecle.enqueue.notificationBeforeExpiryInterval To notify the draft processor in advance before the e


place, a noti cation will be send. The default warnin
overruled by the help of annotation
notificationBeforeExpiryInterval using t
dayTimeDuration format (http://www.w3.org/TR
2/#dayTimeDuration).

Scope: [VIEW]

ObjectModel.lifecle.processing.expiryBehavior After the durable lock expiration phase has been pro
exclusive draft, the durable lock of its active docum
However for draft-aware applications it is still not al
draft related to the same active document until the
existing draft is expired.

The lifecycle.processing.* annotations allo


global defaults for the draft processing expiration h
certain period of time, the processor is removed fro
and a different user is allowed to create a new draft
active document. In that case, the rst draft is delet
editing for the rst draft can be continued at a later

The default processing expiration settings can be ov


lifecycle.enqueue.* annotations by the help o
duration interval and noti cation interval.

Scope: [VIEW]

Evaluation Runtime (Engine): The lifecycle services


the processing status of a draft accordingly to the d
expiration behavior.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 42/119
12/10/2019

Annotation Meaning

ObjectModel.lifecle.processing.expiryInterval Using this annotation, you can specify an interval to


duration interval.

Scope: [VIEW]

ObjectModel.lifecle.processing.notificationBeforeExpiryInterval Using this annotation, you can specify an interval to


noti cation interval.

Scope: [VIEW]

ObjectModel.mandatory If this annotation has value true, the eld must be


consumer when executing a modi cation.

Scope: [ELEMENT]

Evaluation Runtime (Engine):

SADL: Exposes this information

BOPF: Rejects modi cations that do not pro


this eld (in case of static eld control). Wit
'EXTERNAL_CALCULATION', the mandato
calculated in a BOPF property determinatio
control).

ObjectModel.modelCategory Each business object can semantically be categoriz


model setting

Scope: [VIEW]

Evaluation Runtime (Engine): The model category


runtime effect but is used for a semantic grouping, f
browsers.

Values:

Value Description

#BUSINESS_OBJECT View that represen


object

ObjectModel.readOnly If this annotation has the value true, the eld must
the consumer.

Scope: [ELEMENT]

Evaluation Runtime (Engine):

SADL: Exposes this information

BOPF: Rejects modi cations when updating


de ned as @ObjectModel.readOnly: t
static eld control). With the value
'EXTERNAL_CALCULATION', the readonly
calculated in a BOPF property determinatio
control).

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 43/119
12/10/2019

Annotation Meaning

ObjectModel.representativeKey Most speci c element ( eld or managed associatio


(indicated by the keyword KEY) that represents the
is based on. This element shall be used as the ancho
key relationships (except for text views): The foreign
corresponding to the representative key represents
can be called representative foreign key element. Th
association is de ned on the representative foreign
name of the representative key typically equals the
represented by the view.

For non-text views it is the key element for which th


value list/check table. For text views
(@ObjectModel.dataCategory: #TEXT) it ide
element to which the text elds relate to.

The representative key element has to be modelled


there is only one primary key eld (no implicit deriv

A view may only become a target of a foreign key as


representative key element (exception: language de
may not be used as targets of foreign key relationsh

Scope: [VIEW]

Evaluation Runtime (Engine): Analytic Manager: In


grouping by the entity and the hierarchical represen
are handled using the representative foreign key e

ObjectModel.semanticKey[ ] Identi es an instance of an entity from business per


human-readable eld values. It does neither contain
dependent nor other technical components (for exa
indicator). Thus it may be ambiguous resulting in m
records/instances of a view that may need to be lt
information (for example: current date, preferred la

For a given entity, only a single semantic key is de n

Scope: [VIEW]

Evaluation Runtime (Engine): UI: Uses semantic ke


and navigation.

ObjectModel.text.association De nes the associated view (annotated with


@ObjectModel.dataCategory: #TEXT), which
descriptions for the annotated eld.

NOTE: The usage of this annotation excludes the us


@ObjectModel.text.element.

Scope: [ELEMENT]

Evaluation Runtime (Engine):

SADL - Enriches the OData entity type of th


textual description of the target view applyi
language ltering. The name of the auto-gen
will be composed out of the annotated eld
constant suffix _Text. This OData property is
rst text eld of the associated target CDS v
@Semantics.text:true.

Analytic Manager - Uses the associated vie


annotated eld.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 44/119
12/10/2019

Annotation Meaning

ObjectModel.text.element[ ] Establishes the conjunction of a eld with its descri


independent texts.
NOTE: The usage of this annotation excludes the us
@ObjectModel.text.association.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL - First text eld


annotation array will be handled as descriptive text
in OData exposure scenarios.

ObjectModel.transactionalProcessingEnabled Enables the transactional runtime support. It may o


root view level (@ObjectModel.compositionRo

Scope: [VIEW]

Evaluation Runtime (Engine):

BOPF: Depending on the speci ed @Objec


>Persistence information, we can disting
scenarios:

a) writeActivePersistence: Active da
CDS view) is directly modi ed by the transa
(without having any kind of draft).

b) writeDraftPersistence: Active data


CDS view) is only indirectly modi ed by a dr

c) writeActivePersistence & writeD


Both the draft and the active data are writte
transactional runtime.

ObjectModel.transactionalProcessingDelegated Indicates that transactional accesses to the view ar


transactional runtime of the underlying view (which
@ObjectModel.transactionalProcessingE
may only be de ned on root view level
(@ObjectModel.compositionRoot:true).

Scope: [VIEW]

Evaluation Runtime (Engine):

SADL: Uses the information to delegate req


transactional runtime

ObjectModel.updateEnabled If this annotation has value true, it is allowed to up


instances.

Scope: [VIEW]

Evaluation Runtime (Engine):

SADL: Exposes this information

BOPF: Rejects modi cation requests that d


true for this eld (in case of static eld con
'EXTERNAL_CALCULATION', the update p
in a BOPF property determination (dynamic

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 45/119
12/10/2019

Annotation Meaning

ObjectModel.writeActivePersistence De nes the DDIC database table name of the active


@ObjectModel.transactionalProcessingE

Scope: [VIEW]

ObjectModel.writeDraftPersistence De nes the DDIC database table name of the draft d


@ObjectModel.transactionalProcessingE

Scope: [VIEW]

ObjectModel.writeEnabled - Deprecated! Enables the transactional runtime support. It may o


root view level (@ObjectModel.compositionRo

Caution
Do not use this annotation an more! It is replaced
ObjectModel.transactionalProcessingE

Scope: [VIEW]

Evaluation Runtime (Engine):

BOPF - Depending on the speci ed persistence info


distinguish between the folllowing scenarios:

a) writeActivePersistence: Active data (de n


is directly modi ed by the transactional runtime (w
kind of draft).

b) writeDraftPersistence: Active data (de ne


is only indirectly modi ed by a draft.

c) writeActivePersistence & writeDraftPe


the draft and the active data are written by the trans

Examples
Example 1

This example demonstrates how you can de ne a compositional hierarchy.

Sample Code

@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
define view I_SalesOrder
association [0..*] to I_SalesOrderItem as _Item ... {
@ObjectModel.association.type: #TO_COMPOSITION_CHILD
_Item, ...
}

define view I_SalesOrderItem


association [1..1] to I_SalesOrder as _SalesOrder ... {
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT,
#TO_COMPOSITION_PARENT]
_SalesOrder, ...
}

Example 2

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 46/119
12/10/2019
This example demonstrates how you can de ne foreign key relationship.

Sample Code

define view I_SalesOrderItem


association [0..1] to I_Material as _Material
on $projection.Material = _Material.Material ... {
@ObjectModel.foreignKey.association: ’_Material’
Material,
_Material, ...
}

@ObjectModel.representativeKey: ’Material’
define view I_Material ... {
key Material, ...
}

Example 3

This example demonstrates how you can de ne language-dependent texts

Sample Code

define view I_Material


association [0..*] to I_MaterialText as _Text ... {
@ObjectModel.text.association: ’_Text’
key Material,
_Text, ...
}

@ObjectModel.dataCategory: #TEXT
@ObjectModel.representativeKey: ’Material’
define view I_MaterialText ... {
key Material,
@Semantics.language: true
key Language,
@Semantics.text: true
MaterialName,
@Semantics.text: true
MaterialDescription, ...
}

Example 4

This example demonstrates how you can de ne language-independent texts

Sample Code

define view I_Plant ... {


@ObjectModel.text.element: [’PlantName’]
key Plant,
@Semantics.text: true
PlantName, ...
}

Example 5

This example demonstrates how you can de ne the transactional behavior

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 47/119
12/10/2019

Sample Code

@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeDraftPersistence: ‘<DraftDDICTable>’
define view I_MaterialWithDraft ... {
...
}

OData Annotations
Capture OData-related aspects to expose data gained from a CDS entity in an OData service.

Scope and De nition

@Scope:[#VIEW, #TABLE_FUNCTION]
Annotation OData
{
publish : Boolean default true;
};

Usage

Annotation Meaning

OData.publish OData.publish is intended for generating an OData service.

Scope: [VIEW, TABLE_FUNCTION]

Evaluation Runtime (Engine): SADL

Values:

Value Description

true Has to be set to generate an OData service

false De nes that this CDS entity cannot be exposed for an OData service

Note
When the CDS entity is activated, the OData service is generated automatically. After activation, it can be opened from the
ABAP Element Information popup of the corresponding database table.

Subsequently, the OData service also needs to be activated in the transaction /IWFND/MAINT_SERVICE manually.

Examples
This example demonstrates how you can de ne the SEPM_I_SalesOrder CDS entity that exposes data to an OData service.

Here, an OData service is generated for the CDS entity. The data is provided from the database table snwd_so.

Sample Code

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 48/119
12/10/2019

@OData.publish:true
define view SEPM_I_SalesOrder as select from snwd_so {
...
}

Related Information
Expose CDS View as an OData Service

Search Annotations
This annotation marks a view as searchable. You de ne the fuzziness threshold as well as the speci cs of term mappings at
element level.

Scope and De nition

@Scope:[#VIEW, #TABLE_FUNCTION]
Annotation Search
{
searchable : Boolean default true;
};
@Scope:[#ELEMENT]
Annotation Search
{
defaultSearchElement : Boolean default true;
ranking : String(6) enum { HIGH = 'high'; MEDIUM = 'medium'; LOW = 'low'; } default #MEDIUM;
fuzzinessThreshold : Decimal(3,2);
termMappingDictionary : String(128);
termMappingListID : String(32);
};

Usage

Annotation Meaning

Search.searchable De nes if a CDS view or entity is generally relevant for search scenarios. This annotation must be
set in case other search-related annotations are being de ned for elements of the respective CDS
view or entity. The annotation offers a general switch and a means to quickly detect whether a
view is relevant or not.

Scope: #View

Evaluation Runtime (Engine): Interpreted by Enterprise Search and SADL

Values:

Value Description

Boolean (true, false) De nes whether a view is relevant for search or not.

Default: true

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 49/119
12/10/2019

Annotation Meaning

Search.defaultSearchElement Speci es that the element is to be considered in a freestyle search (for example a SELECT…)
where no columns are speci ed.

Usually, such a search must not operate on all elements – for performance reasons, and because
not all elements (e.g. internal keys) do qualify for this kind of access.

Scope: #Element

Evaluation Runtime (Engine): Interpreted by Enterprise Search and SADL

Values:

Value Description

Boolean (true, false) De nes weather the element is to be considered in a freestyle


search.
Default: true

Search.ranking Speci es how relevant the values of an element are for ranking, if the freestyle search terms
match the element value.

Scope: #Element

Evaluation Runtime (Engine) : Interpreted by Enterprise Search

Values:

Value Description

HIGH The element is of high relevancy; this holds usually for ID and
their descriptions.

MEDIUM The element is of medium relevancy; this holds usually for other,
important element. This is the default.

LOW Although the element is relevant for freestyle search, a hit in this
element has no real signi cance for a result item's ranking.

Search.fuzzinessThreshold Speci es the least level of fuzziness (with regard to some comparison criteria passed at runtime)
the element has to have to be considered in a fuzzy search at all.

Note
A fuzzy search enables a certain degree of error tolerance and returns records even if the
search term contains additional or missing characters or other types of spelling errors.

Note
To perform a fuzzy search you have to set the search mode to fuzzy in the customizing
settings of your ABAP system. Find the customizing node under SAP NetWeaver
Implementation Guide Search and Operational Analytics Enterprise Search Search
Con guration Set Parameters for Federated Search .

If in the customizing a value for Fuzzy Similarity is present, the value of the parameter
Search.fuzzinessThreshold will become void.

Scope: #Element

Evaluation Runtime (Engine): Interpreted by SADL

Values:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 50/119
12/10/2019

Annotation Meaning

Decimal (3,2) The least level of fuzziness the element has to have to be
considered in a fuzzy search at all, e.g. 0.7.

The value can be between 0 and 1.

We recommend using the default value 0.7 to start with. Later


on, you can ne-tune the search settings based on your
experiences with the search. You can also ne-tune the search
using feedback collected from your users. A value between 0.7
and 0.99 would be most useful. Use 1 for exact matches.

Search.termMappingDictionary Speci es the table that holds the term mappings (synonyms) to be considered in the context of a
search on this view.

Scope: #Element

Evaluation Runtime (Engine): No engine usage right now. Reserved for future usage.

Values:

Value Description

String(128) De nes the term mapping dictionary, e.g. a table or entity.

Search.termMappingListID Speci es one or multiple list IDs within the term mapping dictionary mentioned before.

The list is implemented as a column of the term mapping table, with the list ID as content of this
column. This concept has the aim to enable overarching term mapping dictionaries while being
able to separate domain-speci c content at the same time.

Scope: #Element

Evaluation Runtime (Engine): No engine usage right now. Reserved for future usage.

Values:

Value Description

Array of String(32) De nes one or more columns of the term mapping dictionary.

Semantics Annotations
Used by the core engines for data processing, analytics, and data consumption

Scope and De nition

@Scope:[#ELEMENT, #PARAMETER]
Annotation Semantics
{
telephone
{
type : array of String enum { HOME; CELL; WORK; FAX; PREF; TEXT; VOICE; VIDEO; PAGER; TEXT_PHONE
};
eMail
{
type : array of String enum { HOME; WORK; PREF; OTHER; } default #PREF;
address : Boolean default true;
from : Boolean default true;
sender : Boolean default true;
to : Boolean default true;
cc : Boolean default true;
bcc : Boolean default true;
subject : Boolean default true;
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 51/119
12/10/2019
body : Boolean default true;
keywords : Boolean default true;
received : Boolean default true;
};
name
{
fullName : Boolean default true;
givenName : Boolean default true;
additionalName : Boolean default true;
familyName : Boolean default true;
nickName : Boolean default true;
suffix : Boolean default true;
prefix : Boolean default true;
jobTitle : Boolean default true;
};
address
{
type : array of String enum { HOME; WORK; PREF; OTHER; } default #PREF;
city : Boolean default true;
street : Boolean default true;
streetNoNumber : Boolean default true;
number : Boolean default true;
country : Boolean default true;
region : Boolean default true;
subRegion : Boolean default true;
zipCode : Boolean default true;
postBox : Boolean default true;
label : Boolean default true;
};
organization
{
name : Boolean default true;
unit : Boolean default true;
role : Boolean default true;
};
calendarItem
{
summary : Boolean default true;
description : Boolean default true;
categories : Boolean default true;
dtStart : Boolean default true;
dtEnd : Boolean default true;
duration : Boolean default true;
due : Boolean default true;
completed : Boolean default true;
priority : Boolean default true;
class : Boolean default true;
status : Boolean default true;
percentComplete : Boolean default true;
contact : Boolean default true;
location : Boolean default true;
transparent : Boolean default true;
fbType : Boolean default true;
wholeDay : Boolean default true;
};
businessDate
{
at : Boolean default true;
from : Boolean default true;
to : Boolean default true;
createdAt : Boolean default true;
lastChangedAt : Boolean default true;
};
systemDate
{
createdAt : Boolean default true;
lastChangedAt : Boolean default true;
};
time : Boolean default true;
calendar
{
dayOfMonth : Boolean default true;
dayOfYear : Boolean default true;
week : Boolean default true;

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 52/119
12/10/2019
month : Boolean default true;
quarter : Boolean default true;
year : Boolean default true;
yearWeek : Boolean default true;
yearMonth : Boolean default true;
yearQuarter : Boolean default true;
};
fiscal
{
yearVariant : Boolean default true;
period : Boolean default true;
year : Boolean default true;
yearPeriod : Boolean default true;
};
geoLocation
{
longitude : Boolean default true;
latitude : Boolean default true;
cartoId : Boolean default true;
normalizedName : Boolean default true;
};
url
{
mimeType : elementRef;
};
contact
{
type : String enum {PERSON; ORGANIZATION; };
note : Boolean default true;
photo : Boolean default true;
birthDate : Boolean default true;
};
user
{
id : Boolean default true;
createdBy : Boolean default true;
lastChangedBy : Boolean default true;
responsible : Boolean default true;
};
mimeType : Boolean default true;
text : Boolean default true;
language : Boolean default true;
languageReference : elementRef;
};
@Scope:[#ELEMENT]
Annotation Semantics
{
amount
{
currencyCode : elementRef;
};
quantity
{
unitOfMeasure : elementRef;
};
currencyCode : Boolean default true;
unitOfMeasure : Boolean default true;
};

Usage
Semantic annotations are used to inform the client as to which of the elements contain a phone number, a part of a name or
address, or something relating to a calendar event. They must not be bound, for example, to a dedicated consumption channel.
They need to be available for consumption through OData, (S)QL, and so on.

Semantic annotations complement the concept of semantic data types, while semantic data types always introduce speci c
behavior in the provider/core infrastructure (through dedicated operations or conversion functions).

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 53/119
12/10/2019
Semantic annotations allow the standardizing of semantics that only have an impact on the consumption side (such as telephone
number, mail address, city, and so on).

Annotation Meaning

Annotations belonging to Semantics.address follow the vCard standard (RFC6350 )

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations (Exception: Semantics.address.n

Values:

Semantics.address.type[ ] Description

Values:

String(10)

The following enumerations are provided:

Value Description

HOME Home address

WORK Work address

PREF Preferred address


Default

OTHER Other address

Semantics.address.city Boolean default The annotated eld contains a plain-text string that contains the name of a city
true
Semantics.address.country The annotated eld contains a plain-text string that contains the name of a cou

Semantics.address.label The annotated eld contains a plain-text string representing the formatted add

Semantics.address.number The annotated eld contains a street number separated from a street name.

Semantics.address.postBox The annotated eld contains information about a post office box.

Semantics.address.region The annotated eld contains a plain-text string that contains the name of a reg

Semantics.address.subRegion The annotated eld contains a plain-text string that contains the name of a sub

Semantics.address.street The annotated eld contains a street name and a street number.

Semantics.address.streetNoNumber The annotated eld contains a street name separated from a street number.

Semantics.address.zipCode The annotated eld contains a numeric string that contains the ZIP code (type

Annotations belonging to Semantics.amount contain a monetary amount, and the corresponding currency code is contained in the reference

Scope: [ELEMENT]

Evaluation Runtime (Engine): Interpreted by ABAP Runtime Environment

Values:

Semantics.amount.currencyCode elementRef The annotated eld contains a monetary amount, and the corresponding curre

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 54/119
12/10/2019

Annotation Meaning

Annotations belonging to Semantics.businessDate contain information about changes of database table records.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): *Business data often carries time validities. When accessing data, one usually intends to get the most current o
mandatory for the engine to know the semantics in order to carry out a generic validity evaluation.

Note
Many objects used in the Business Suite store data in a way that requires an algorithm to derive the actual data for a validity state. The anno
would yield incorrect results.

Values:

Semantics.businessDate.at* Boolean default The annotated eld indicates that the column contains the key dates and not i
true
Semantics.businessDate.createdAt* The annotated eld is the date (and time) when the database table record was

Semantics.businessDate.from* The annotated eld is the date timestamp or interval that de nes the validity o
business point of view.
Technical validity: The from date is different from the point in time when the
Semantics.businessDate.to*
confused with dates contained in the data part.

Semantics.businessDate.lastChangedAt The annotated eld is the date/time when the database table record was mod
It is usually identical to the creation date/time of the insertion, if the record ha

Evaluation Runtime (Engine): This is required to answer queries like "all chang
relevant, for example, for the ranking of a search result.

Annotations belonging to Semantics.calendar follow the iCalendar standard (RFC5545 )

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: Boolean default true

Semantics.calendar.dayOfMonth Boolean default The value of the annotated eld is a day number relative to a calendar month.
true
Example
1 - 31

Semantics.calendar.dayOfYear The value of the annotated eld is a day number relative to a calendar year.

Example
1 - 366

Semantics.calendar.month The value of the annotated eld encodes a calendar month number as a string
digits.

Example
The string matches the regex pattern 0[1-9]|1[0-2]

Semantics.calendar.quarter The value of the annotated eld encodes a calendar quarter number as a string
digit.

Example
The string matches the regex pattern [1-4]

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 55/119
12/10/2019

Annotation Meaning

Semantics.calendar.week The value of the annotated eld encodes a calendar week number as a string f
digits.

Example
The string matches the regex pattern 0[1-9]|[1-4][0-9]|5[2-3]

Semantics.calendar.year The value of the annotated eld encodes a year number as a string following th
optional minus sign for years B.C., followed by at least four digits.

Example
The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})

Semantics.calendar.yearMonth The value of the annotated eld encodes a calendar year and month as a string
consisting of an optional minus sign for years B.C., followed by at least six digit
January to December.

Example
The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})

Semantics.calendar.yearQuarter The value of the annotated eld encodes a calendar year and quarter as a strin
consisting of an optional minus sign for years B.C., followed by at least ve dig

Example
The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})

Semantics.calendar.yearWeek The value of the annotated eld encodes a calendar year and week as a string
consisting of an optional minus sign for years B.C., followed by at least six digit
in the year.

Example
The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})

Annotations belonging to Semantics.calendarItem follow the iCalendar standard (RFC5545 ) for representing and exchanging calendaring a
journal entries, and free or busy information, independent of any particular calendar service or protocol

Scope: [ELEMENT, PARAMETER]

Values:

Semantics.calendarItem.categories Boolean default The value of the annotated eld is used to specify categories or subtypes of th
true searching for a calendar item of a particular type and category.

Semantics.calendarItem.class The value of the annotated eld provides a method of capturing the scope of th
information within an individual calendar entry.
The default value is PUBLIC. Other values are PRIVATE, CONFIDENTIAL, iana
name (experimental, non-standard parameter).

Note
Applications must treat x-name and iana-token values they do not recognize

Semantics.calendarItem.completed The value of the annotated eld de nes the date and time that a to-do was act

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 56/119
12/10/2019

Annotation Meaning

Semantics.calendarItem.contact The value of the annotated eld is used to represent contact information or alt
associated with the calendar item.

Semantics.calendarItem.description The value of the annotated eld provides a description of the calendar item.

Semantics.calendarItem.due The value of the annotated eld de nes the date and time that a to-do is expec

Semantics.calendarItem.duration The value of the annotated eld is used to identify properties that contain a du

Semantics.calendarItem.dtEnd The value of the annotated eld speci es the date and time that a calendar ite

Semantics.calendarItem.dtStart The value of the annotated eld speci es the date and time that a calendar ite

Semantics.calendarItem.fbType The value of the annotated eld speci es the free or busy time type.

Semantics.calendarItem.location The value of the annotated eld de nes a location related to a calendar compo

Example
LOCATION:Conference Room - F123\, Bldg. 002
LOCATION;ALTREP="http://xyzcorp.com/conf-rooms/f123.vcf

Semantics.calendarItem.percentCompl. The value of the annotated eld is used by an assignee or delegatee of a to-do
"organizer".

Semantics.calendarItem.priority The value of the annotated eld de nes the relative priority for a calendar item

Semantics.calendarItem.status The value of the annotated eld de nes the overall status or con rmation for t

Semantics.calendarItem.summary The value of the annotated eld de nes a short summary or subject for the ca

Semantics.calendarItem.transparent The value of the annotated eld de nes whether or not an event is transparent

Semantics.calendarItem.wholeDay The value of the annotated eld de nes whether or not an event covers whole

Annotations belonging to Semantics.contact follow the vCard standard (RFC6350 )

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

Semantics.contact.type Value: String

The following enumerations are provided:

Value Description

PERSON Content relates to an individual

ORGANIZATION Content relates to an organization, company, etc.

Semantics.contact.birthDate Boolean default This annotated eld contains the birth date of the individual.
true
Semantics.contact.note This annotated eld speci es supplemental information or a comment that is

Semantics.contact.photo This annotated eld contains an image or photograph related to the contact.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 57/119
12/10/2019

Annotation Meaning

Semantics.currencyCode This annotation tags a eld containing a currency code

This can be either an ISO code or an SAP currency code (data type CUKY).

Scope: [ELEMENT]

Evaluation Runtime (Engine): Interpreted by ABAP Runtime Environment

Value: Boolean default true

Annotations belonging to Semantics.email follow RFC5322 ).

Note
The attribute address should be used in case a mail address is included – independent from the specialized semantics from, sender, to,

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Semantics.email.type Description

Values: String

The following enumerations are provided:

Value Description

HOME Private email address

WORK Business email address

PREF Preferred email address

OTHER Other email address

Semantics.email.address Boolean default The value of the annotation contains the addresses of the sender and the recip
true mailbox or a group of mailboxes.

Semantics.email.bcc The value of the annotation contains the recipient list that receive an email, bu
recipients of the same email.

Semantics.email.body The value of the annotation contains lines of US-ASCII characters.

Semantics.email.cc The value of the annotation contains the recipient list that receive an email tha

Semantics.email.from The value of the annotation speci es the author(s) of a message. This can be a

Semantics.email.keywords The value of the annotated eld contains a comma-separated list of one or mo

Semantics.email.received The value of the annotated eld contains a trace information at the beginning o
receives a message for delivery or further processing.

Semantics.email.sender The value of the annotated eld speci es the mailbox of the agent responsible
example, if a secretary were to send a message for another person, the mailbo

Semantics.email.subject The value of the annotated eld contains the topic of the message.

Semantics.email.to The value of the annotation contains the recipient list that receive an email tha

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 58/119
12/10/2019

Annotation Meaning

Annotations belonging to Semantics. scal are required for time-based calculations in analytical use cases.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): Some attributes contain the respective information (as plain integers), and the processor needs the semantics

Values (optional): Boolean default true

Semantics. scal.period Boolean default A scal period is covered by nancial reports, for example, an annual report co
true report includes accounting data for three months.
The value of the annotated eld encodes a scal period as a string following th
scal period usually is a quarter of a year.

Example
The string matches the regex pattern [0-9]{3}

Semantics. scal.year The value of the annotated eld encodes a scal year number as a string follow
digits.

Example
The string matches the regex pattern [1-9][0-9]{3}

Semantics. scal.yearPeriod The value of the annotated eld encodes a scal year and period as a string fol
seven digits. The last three digits represent the scal period in the year.

Example
The string matches the regex pattern ([1-9][0-9]{3})([0-9]{3})

Semantics. scal.yearVariant The value of the annotated eld encodes a scal year variant, which describes
match the calendar year.

Annotations belong to Semantics.geoLocation contain geo-coordinates for depicting data on a map.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Values:

Semantics.geoLocation.cartoId Boolean default


true
Semantics.geoLocation.latitude The value of the annotated eld speci es the latitude of the location such as a

Semantics.geoLocation.longitude The value of the annotated eld speci es the longitude of the location such as

Semantics.geoLocation.normalizedName The value of the annotated eld contains the readable name of the location.

Semantics.language This annotation identi es a language.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData a

Values (optional): Boolean default true

Semantics.languageReference This annotation references a eld that identi es languages. You can use this annotation if you can

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Values (optional): elementRef

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 59/119
12/10/2019

Annotation Meaning

Semantics.mimeType This annotation describes the mime type of a resource (identi ed by a URL or directly available as

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

This is required when accessing the document content, for example, in a content crawl, during tex
viewing.

In UIs, documents are usually presented with an icon that symbolizes their mime type.

Values: Boolean default true

Annotations belonging to Semantics.name follow the vCard standard (RFC6350 ).

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

Semantics.name.additionalName Boolean default The value of the annotation contains the second rst name of an individual.
true
Semantics.name.familyName The value of the annotation contains the surname of an individual.

Semantics.name.fullName The value of the annotation contains the full name of an individual.

Semantics.name.givenName The value of the annotation contains the rst name of an individual.

Semantics.name.jobTitle The value of the annotation contains the job title of an individual.

Semantics.name.nickName The value of the annotation contains the nickname of an individual.

Semantics.name.pre x The value of the annotation contains the honori c pre x of an individual.

Semantics.name.suffix The value of the annotation contains the honori c suffix of an individual.

Annotations belonging to Semantics.organization follow the vCard standard (RFC6350 ).

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

Semantics.organization.name Boolean default The value of the annotated eld contains the organization name.
true
Semantics.organization.role The value of the annotated eld specify the function or part played in a particu

Example
ROLE:Project Leader

Semantics.organization.unit The value of the annotated eld contains the name of the organization unit.

Annotations belonging to Semantics.quantity contain a measured quantity, and the corresponding unit of measure is contained in the referen

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

Semantics.quantity.unitOfMeasure elementRef The value of the annotated eld speci es a unit of measure related to a measu

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 60/119
12/10/2019

Annotation Meaning

Annotations belonging to Semantics.systemDate specify the date/time that is recorded by the technical infrastructure/database.

Note
The sub-annotations have the same semantics as the equally named attributes of the businessDate annotation. The difference is that val
and are recorded by the database.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Values:

Semantics.systemDate.createdAt Boolean default Timestamp when database record was created.


true
Semantics.systemDate.lastChangedAt Timestamp when database record was last changed.

Annotations belonging to Semantics.telephone follow the vCard standard RFC5322 )

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: String(10)

Semantics.telephone.type Values: default #PREF

The following enumerations are provided:

Value Description

CELL Cell phone

FAX Fax

HOME Private phone

PAGER Pager

PREF Preferred phone

TEXT Phone that supports text messages (SMS)

TEXT_PHONE Telecommunication device for people with hearing or speech difficulties

VIDEO Video conferencing phone

VOICE Voice phone

WORK Business phone

Semantics.text This annotation identi es a human-readable text that is not necessarily language-dependent.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData a

Values: Boolean default true

Semantics.time This annotation is used to indicate a date semantic for the NVARCHAR-based ABAP type TIMS.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Value : Boolean default true

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 61/119
12/10/2019

Annotation Meaning

Semantics.unitOfMeasure This annotation tags a eld as containing a unit of measure.

Note
There seems to be currently no internationally recognized standard list for units of measure ava

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Values: Boolean default true

Annotations belonging to Semantics.url contain a URL, and its mime type is contained in the referenced second eld.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

Semantics.url.mimeType elementRef This annotated eld is required when opening a document for viewing, or when
In UIs, documents are usually presented with an icon that symbolizes their mim

Annotations belonging to Semantics.user de ne the ID of the user related to the data record.

The attribute id should be used if the user ID without additional semantics is included. If the dedicated semantics of the user ID are known, th
responsible should be used.

Scope: [ELEMENT, PARAMETER]

Evaluation Runtime (Engine):

Values:

Semantics.user.createdBy Boolean default The value of the annotated eld speci es who created a data record.
true
Semantics.user.id The value of the annotated eld contains the ID of a user.

Semantics.user.lastChangedBy The value of the annotated eld speci es who changed a data record at last.

Semantics.user.responsible The value of the annotated eld speci es who is the person responsible for a d

Examples
Example 1

The following CDS view fetches the contact data. Here, the annotations assign to the corresponding elds the relevant semantic
information, such as rst name, last name, and so on.

Sample Code

DEFINE VIEW ContactPerson ...


ASSOCIATION [1..1] TO FormattedName AS _FormattedName ON ...
{
...
@Semantics.name.givenName
FirstName,

@Semantics.name.additionalName
MiddleName,

@Semantics.name.familyName
LastName,

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 62/119
12/10/2019
@Semantics.user.id
SystemUser,

Initials,

GenderCode,

AddressUUID,

@Semantics.telephone.type: [#WORK, #PREF]


PhoneNumber,

@Semantics.telephone.type: [#FAX]
FaxNumber,

@Semantics.telephone.type: [#CELL]
MobilePhoneNumber,

@Semantics.eMail.address
EmailAddress,

PreferredLanguage,

@Semantics.contact.birthDate
BirthDate,

@Semantics.name.fullName
_FormattedName.FormattedContactName,
...
}

Example 2

The following CDS view fetches sales order items. Here, the annotations assign the units and currencies to the corresponding
elds.

Sample Code

DEFINE VIEW SalesOrderItem as select from ...


{
...

@Semantics.currencyCode
currency_code as CurrencyCode,

@Semantics.amount.currencyCode: 'CurrencyCode'
gross_amount as GrossAmount,

@Semantics.unitOfMeasure
unit_of_measure as UnitOfMeasure,

@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
quantity as Quantity,

...
}

Example 3

The following CDS view fetches geographic data of cities annotating the corresponding location elds according to a standardized
format:

Sample Code

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 63/119
12/10/2019

DEFINE VIEW myGeoAttributeView as select from ...


{
@Semantics.address.city
cartoid,

@Semantics.geoLocation.longitude
Longitude,

@Semantics.geoLocation.latitude
latitude,

@Semantics.geoLocation.normalizedName
name
}

Example 4

The following CDS view fetches language-dependant data annotating the corresponding language elds and text elds:

Sample Code

DEFINE VIEW chartOfAccountsTexts AS SELECT FROM ...


{
key ktopl AS chartOfAccounts,

@Semantics.language: true
key spras AS language,

@Semantics.text: true
ktplt AS chartOfAccountsName
}

UI Annotations
Represent semantic views on business data through the use of speci c patterns that are completely independent of UI
technologies.

Scope and De nition

@Scope:[#VIEW, #TABLE_FUNCTION, #ENTITY]


Annotation UI
{
headerInfo
{
typeName : String(40);
typeNamePlural : String(40);
typeImageUrl : String;
imageUrl : elementRef;
title
{
type : String enum
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 64/119
12/10/2019
url : elementRef;
};
description
{
type : String enum
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
};
badge
{
headLine
{
type : String enum
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
title
{
type : String enum
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
typeImageUrl : String;
imageUrl : elementRef;
mainInfo
{
type : String enum
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
secondaryInfo
{
type : String enum

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 65/119
12/10/2019
{
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
};
chart : array of
{
qualifier : String(120);
title : String(40);
description : String(80);
chartType : String enum
{
COLUMN;
COLUMN_STACKED;
COLUMN_STACKED_100;
COLUMN_DUAL;
COLUMN_STACKED_DUAL;
COLUMN_STACKED_DUAL_100;
BAR;
BAR_STACKED;
BAR_STACKED_100;
BAR_DUAL;
BAR_STACKED_DUAL;
BAR_STACKED_DUAL_100;
AREA;
AREA_STACKED;
AREA_STACKED_100;
HORIZONTAL_AREA;
HORIZONTAL_AREA_STACKED;
HORIZONTAL_AREA_STACKED_100;
LINE;
LINE_DUAL;
COMBINATION;
COMBINATION_STACKED;
COMBINATION_STACKED_DUAL;
HORIZONTAL_COMBINATION_STACKED;
HORIZONTAL_COMBINATION_STACKED_DUAL;
PIE;
DONUT;
SCATTER;
BUBBLE;
RADAR;
HEAT_MAP;
TREE_MAP;
WATERFALL;
BULLET;
VERTICAL_BULLET;
};
dimensions : array of elementRef;
measures : array of elementRef;
dimensionAttributes : array of
{
dimension : elementRef;
role : String(10) enum
{
CATEGORY;
SERIES;
};
};
measureAttributes : array of
{
measure : elementRef;
role : String(10) enum
{
AXIS_1;

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 66/119
12/10/2019
AXIS_2;
AXIS_3;
};
asDataPoint : Boolean default true;
};
actions : array of
{
type : String enum
{
FOR_ACTION;
FOR_INTENT_BASED_NAVIGATION;
};
label : String(40);
dataAction : String;
invocationGrouping : String enum
{
ISOLATED;
CHANGE_SET;
} default #ISOLATED;
semanticObjectAction : String;
};
};
textArrangement : String enum
{
TEXT_FIRST;
TEXT_LAST;
TEXT_ONLY;
TEXT_SEPARATE;
};
};
@Scope:[#ELEMENT]
Annotation UI
{
hidden : Boolean default true;
masked : Boolean default true;
multiLineText : Boolean default true;
lineItem : array of
{
qualifier : String(120);
position : Integer;
exclude : Boolean default true;
importance : String enum { HIGH; MEDIUM; LOW; };
type : String enum
{
FOR_ACTION;
AS_ADDRESS;
AS_DATAPOINT;
AS_CONTACT;
AS_CHART;
FOR_INTENT_BASED_NAVIGATION;
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
dataAction : String;
invocationGrouping : String enum { ISOLATED; CHANGE_SET; } default #ISOLATED;
semanticObjectAction : String;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
identification : array of
{
position : Integer;
exclude : Boolean default true;
importance : String enum { HIGH; MEDIUM; LOW; };
type : String enum
{
FOR_ACTION;
AS_ADDRESS;

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 67/119
12/10/2019
AS_DATAPOINT;
AS_CONTACT;
AS_CHART;
FOR_INTENT_BASED_NAVIGATION;
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
dataAction : String;
invocationGrouping : String enum { ISOLATED; CHANGE_SET; } default #ISOLATED;
semanticObjectAction : String;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
statusInfo : array of
{
position : Integer;
exclude : Boolean default true;
importance : String enum { HIGH; MEDIUM; LOW; };
type : String enum
{
FOR_ACTION;
AS_ADDRESS;
AS_DATAPOINT;
AS_CONTACT;
AS_CHART;
FOR_INTENT_BASED_NAVIGATION;
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
dataAction : String;
invocationGrouping : String enum { ISOLATED; CHANGE_SET; } default #ISOLATED;
semanticObjectAction : String;
value : elementRef;
targetElement : elementRef;
url : elementRef;
};
fieldGroup : array of
{
qualifier : String(120);
groupLabel : String(40);
position : Integer;
exclude : Boolean default true;
importance : String enum { HIGH; MEDIUM; LOW; };
type : String enum
{
FOR_ACTION;
AS_ADDRESS;
AS_DATAPOINT;
AS_CONTACT;
AS_CHART;
FOR_INTENT_BASED_NAVIGATION;
STANDARD;
WITH_INTENT_BASED_NAVIGATION;
WITH_NAVIGATION_PATH;
WITH_URL;
} default #STANDARD;
label : String(40);
iconUrl : String;
criticality : elementRef;
dataAction : String;
invocationGrouping : String enum { ISOLATED; CHANGE_SET; } default #ISOLATED;
semanticObjectAction : String;
value : elementRef;

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 68/119
12/10/2019
targetElement : elementRef;
url : elementRef;
};
dataPoint
{
title : String(40);
description : String(80);
longDescription : String(190);
forecastValue : elementRef;
minimumValue : Integer;
maximumValue : Integer;
valueFormat
{
scaleFactor : Integer;
numberOfFractionalDigits : Integer;
};
referencePeriod
{
description : String(80);
start : elementRef;
end : elementRef;
};
criticality : elementRef;
criticalityCalculation
{
improvementDirection : String enum { MINIMIZE; TARGET; MAXIMIZE; };
toleranceRangeLowValue : Integer;
toleranceRangeLowValueElement : elementRef;
toleranceRangeHighValue : Integer;
toleranceRangeHighValueElement : elementRef;
deviationRangeLowValue : Integer;
deviationRangeLowValueElement : elementRef;
deviationRangeHighValue : Integer;
deviationRangeHighValueElement : elementRef;
};
trend : elementRef;
trendCalculation
{
referenceValue : elementRef;
isRelativeDifference : Boolean default false;
upDifference : Integer;
upDifferenceElement : elementRef;
strongUpDifference : Integer;
strongUpDifferenceElement : elementRef;
downDifference : Integer;
downDifferenceElement : elementRef;
strongDownDifference : Integer;
strongDownDifferenceElement : elementRef;
};
responsible : elementRef;
responsibleName : String(120);
};
selectionField : array of
{
qualifier : String(120);
position : Integer;
exclude : Boolean default true;
element : elementRef;
};
};

Usage
The focus of OData UI vocabulary developed by SAP is on usage patterns of data in UIs, not on UI patterns. The vocabulary is
completely independent of the UI technologies or devices that consume the data. The usage patterns of data used by the OData
UI vocabulary represent certain semantic views on business data. Some of them are very generic, others are based on the concept
of an entity, something tangible to end-users. Examples for entities are semantic object instances or business object instances.
Looking at different UI patterns, these data usage patterns reoccur again and again. To generate OData annotations from CDS
views, CDS annotations are reused from different domains, for example Consumption, Communication, Semantics, EndUserText.
The CDS annotations that are additionally required in a UI domain are listed in the following table.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 69/119
12/10/2019

Annotation Meaning

Annotations belonging to UI.badge represent a business card view.

Scope: [VIEW, TABLE_FUNCTION, ENTITY]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

UI.badge.headLine Annotations belonging to UI.badge.headLine represent a property of ty


types STANDARD, WITH_NAVIGATION_PATH, and WITH_URL.

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

UI.badge.headLine.criticality elementRef This annotation can be speci


STANDARD. This annotation re
values 0, 1, 2, or 3. The critical
value 0, the criticality value Ne
criticality value Critical is r
value Positive is re ected b

For more information, see Crit

UI.badge.headLine.iconURL String This annotation contains the U


optional.

UI.badge.headLine.label String (60) This annotation contains a lan


label of the annotated element
via the value is used. The elem

UI.badge.headLine.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.badge.headLine.targetElem
UI.badge.headLine.type of type
for example, provide backgrou
on the object view oorplan.

UI.badge.headLine.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 70/119
12/10/2019

Annotation Meaning

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

UI.badge.headLine.url elementRef This annotation represents the


contains a navigation URL. You
when you use the annotation U
WITH_URL.

UI.badge.headLine.value elementRef This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

UI.badge.imageUrl elementRef This annotation represents a p


an image representing the ent

Example
When users open a badge, th
badge.

UI.badge.mainInfo The content of UI.badge.mainInfo annotations is highlighted on the ba


property of type UI.DataFieldAbstract restricted to the types STANDAR
WITH_URL.

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 71/119
12/10/2019

Annotation Meaning

UI.badge.mainInfo.criticality elementRef This annotation can be speci


STANDARD. This annotation re
values 0, 1, 2, or 3. The critical
value 0, the criticality value Ne
criticality value Critical is r
value Positive is re ected b

For more information, see Crit

UI.badge.mainInfo.iconURL String This annotation contains the U


optional.

UI.badge.mainInfo.label String (60) This annotation contains a lan


for main information on badge
If omitted, the label of the ann
element referenced via the val

UI.badge.mainInfo.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.badge.mainInfo.targetElem
UI.badge.mainInfo.type of type
for example, provide backgrou
on the object view oorplan.

UI.badge.mainInfo.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 72/119
12/10/2019

Annotation Meaning

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

UI.badge.mainInfo.url elementRef This annotation represents the


contains a navigation URL. You
when you use the annotation U

UI.badge.mainInfo.value elementRef This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

UI.badge.secondaryInfo The content of UI.badge.secondaryInfo annotations is subordinate to t


annotations. This annotation represents a property of type UI.DataFiel
STANDARD, WITH_NAVIGATION_PATH, and WITH_URL.

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

UI.badge.secondaryInfo.criticality elementRef This annotation can be speci


is STANDARD. This annotation
the values 0, 1, 2, or 3. The crit
value 0, the criticality value Ne
criticality value Critical is r
value Positive is re ected b

For more information, see Crit

UI.badge.secondaryInfo.iconURL String This annotation contains the U


optional.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 73/119
12/10/2019

Annotation Meaning

UI.badge.secondaryInfo.label String (60) This annotation contains a lan


for secondary information on b
If omitted, the label of the ann
element referenced via the val

UI.badge.secondaryInfo.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.badge.secondaryInfo.target
UI.badge.secondaryInfo.type o
might, for example, provide ba
opened on the object view oo

UI.badge.secondaryInfo.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 74/119
12/10/2019

Annotation Meaning

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

UI.badge.secondaryInfo.url elementRef This annotation represents the


contains a navigation URL. You
UI.badge.secondaryInfo.url wh
UI.badge.secondaryInfo.type o

UI.badge.secondaryInfo.value elementRef This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

UI.badge.title Annotations belonging to UI.badge.titlerepresent a property of type UI


STANDARD, WITH_NAVIGATION_PATH, and WITH_URL. UI.badge.title

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

UI.badge.title.criticality elementRef This annotation can be speci


This annotation references to
2, or 3. The criticality value Ne
criticality value Negative is r
Critical is re ected by the v
Positive is re ected by the v

For more information, see Crit

UI.badge.title.iconURL String This annotation contains the U


optional.

UI.badge.title.label String (60) This annotation contains a lan


for titles on badges.
If omitted, the label of the ann
element referenced via the val

UI.badge.title.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.badge.title.targetElement w
UI.badge.title.type of type WIT
example, provide background
the object view oorplan.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 75/119
12/10/2019

Annotation Meaning

UI.badge.title.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 76/119
12/10/2019

Annotation Meaning

UI.badge.title.url elementRef This annotation represents the


contains a navigation URL. You
you use the annotation UI.bad

UI.badge.title.value elementRef This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

UI.badge.typeImageUrl String This annotation contains the U


The element is is optional.

Example
When users open an overview
related to the entity type to w
belong to.

Annotations belonging to UI.chart are used to show a visual representation of aggregated data.

Scope: [VIEW, TABLE_FUNCTION, ENTITY]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

UI.chart.actions Annotations belonging to UI.chart.actions are used to add actions to c

Values: array of

UI.chart.actions.dataAction String This annotation can be used if


annotation references the tech
Object Processing Framework
string pattern is BOPF:<tech

UI.chart.actions.invocationGrouping Description: This annotation expresses how multiple invocations of th


grouped. This annotation is optional. This annotation needs to be spec
type FOR_ACTION.

Values:

String

The following enumerations are provided:

Value Description

ISOLATED Default
Describes the error handling w
selected instances:

The action is executed


which the action canno

Example
A user selects ve ite
One item cannot be c
other four items are

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 77/119
12/10/2019

Annotation Meaning

CHANGE_SET Describes the error handling w


selected instances:

If an action cannot be
instances, the action is
instances.

Example
A user selects ve ite
One item cannot be c
copied.

UI.chart.actions.label String(40) This annotation contains a lan


for charts.
If omitted, the label of the ann
element referenced via the val

UI.chart.actions.semanticObjectAction String This annotation can be used in


FOR_INTENT_BASED_NAVIGA
of an action on the semantic o
@Consumption.semanticObje
de ning view.

UI.chart.actions.type Description: This annotation is used to de ne the type of an action tha

Values:

String

The following enumerations are provided:

Value Description

FOR_ACTION Maps to DataFieldForAction.

DataFieldForAction is based on
action. For example, a button i
label.

For more information, see Acti

When you use this type, you ca

label

invocationGrouping

When you use this type, you m

dataAction

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 78/119
12/10/2019

Annotation Meaning

FOR_INTENT_BASED_NAVIGATION Maps to DataFieldForIntentBa

DataFieldForIntentBasedNavig
semantic object.

For more information, see Bas

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

UI.chart.chartType Description: This enumeration annotation speci es the type of graphi


appropriate for the data in the annotated view or entity. The element is

Values:

String

The following enumerations are provided:

Value Description

COLUMN This annotation represents on


more measures on the y-axis (

COLUMN_STACKED This annotation represents a s

COLUMN_STACKED_100 This annotation represents a 1

BAR This annotation represents on


more measures on the x-axis (

BAR_STACKED This annotation represents a s

BAR_STACKED_100 This annotation represents a 1

AREA This annotation represents on


more measures on the y-axis (

AREA_STACKED This annotation represents a s

AREA_100 This annotation represents a 1

HORIZONTAL_AREA This annotation represents on


more measures on the x-axis (

HORIZONTAL_AREA_STACKED This annotation represents a s

HORIZONTAL_AREA_100 This annotation represents a 1

LINE This annotation represents on


more measures on the y-axis (

PIE This annotation represents on


measure for the size of a segm
DONUT

SCATTER This annotation represents tw


A third and fourth dimension f

BUBBLE This annotation represents tw


and one measure for the size o

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 79/119
12/10/2019

Annotation Meaning

RADAR This annotation represents thr


spider web.

HEAT_MAP This annotation represents tw


and one measure that is mapp

TREE_MAP This annotation represents on


measure for the rectangle size
mapped to a color code.

WATERFALL This annotation represents on


measure for the y-axis.

BULLET This annotation represents an


semantic color on the top of th
scaling factor, along with the t
displayed vertically.

VERTICAL_BULLET This annotation represents an


color on the top of the backgro
factor, along with the threshold
horizontally.

UI.chart.description String (120) This annotation contains a lan


@EndUserText.quickInfo of the
element is optional.

UI.chart.dimensions array of elementRef This annotation is an array of o


discrete axes of a chart. The ex

UI.chart.dimensionsAttributes Annotations belonging to UI.chart.dimensionsAttributes are used to sp

Values: array of

UI.chart.dimensionsAttributes.dimension elementRef This annotation de nes the dim


must reference an element tha

UI.chart.dimensionsAttributes.role Description: This annotation de nes the manner in which a dimension


differently for each chart type.

Values:

String

The following enumerations are provided:

Value Description

CATEGORY This annotation determines th

Example
Line chart: Dimensions for w
up the X-axis (category axis)
role, the rst dimension is us

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 80/119
12/10/2019

Annotation Meaning

SERIES This annotation determines th

Example
Line chart: Dimensions for w
the line segments of the cha
dimension value. If multiple d
values of all such dimensions
dimension and a color is assi

UI.chart.measures array of elementRef This annotation is an array of z


numeric axes of a chart. The e

UI.chart.measureAttributes Annotations belonging to UI.chart.measureAttributes are used to spec

Values: array of

UI.chart.measureAttributes.asDataPoint Boolean default true This annotation de nes wheth


points in addition to a chart. T
annotation needs to have an a

UI.chart.measureAttributes.measure elementRef This annotation de nes the me


must reference an element tha
has a UI.dataPoint annotation.

UI.chart.measureAttributes.role Description: This annotation de nes the manner in which a measure is


differently for each chart type.

Values:

String

The following enumerations are provided:

Value Description

AXIS_1 This annotation determines th

Example
Bubble chart: The rst meas
if none exists, the rst measu
if none exists, the rst measu
assigned to the feed UID valu

AXIS_2 This annotation determines th

Note
For an example, see the desc

AXIS_3 This annotation determines th

Note
For an example, see the desc

UI.chart.title String (60) This annotation contains a lan


@EndUserText.label of the ann
is optional.

UI.chart.quali er String (120) This annotation is used to grou


need to specify a quali er as n
chart can be referenced by the

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 81/119
12/10/2019

Annotation Meaning

Annotations belonging to UI.dataPoint are used to visualize a single point of data that typically is a number but may also be text, for example,
Data Points.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

UI.dataPoint.criticality elementRef This annotation can be speci


This annotation references to
2, or 3. The criticality value Ne
criticality value Negative is r
Critical is re ected by the v
Positive is re ected by the v

For more information, see Crit

UI.dataPoint.criticalityCalculation Annotations belonging to UI.dataPoint.criticalityCalculation can be use


criticality in the criticality element. The criticality can be calculated ba
criticalityCalculation annotations.

UI.dataPoint.criticalityCalculation.improvementDirection Description: This annotation calculates the criticality based on a spec


information, see Trend-Criticality Calculation.

Values:

String

The following enumerations are provided:

Value Description

MINIMIZE
Values under tolerance
(positive)

Values between tolera


deviationRangeHighVa

Values beyond deviatio


(negative)

TARGET
Values under deviation
(negative)

Values between deviat


toleranceRangeLowVa

Values between tolera


toleranceRangeHighVa

Values between tolera


deviationRangeHighVa

Values beyond deviatio


(negative)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 82/119
12/10/2019

Annotation Meaning

MAXIMIZE
Values under deviation
(negative)

Values between deviat


toleranceRangeLowVa

Values beyond toleran


(positive)

UI.dataPoint.criticalityCalculation.deviationRangeHighValue DecimalFloat This annotation contains a con


deviation value before the criti

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.deviationRangeHighValueElement elementRef This annotation contains a refe


deviation value before the criti

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.deviationRangeLowValue DecimalFloat This annotation contains a con


deviation value before the criti

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.deviationRangeLowValueElement elementRef This annotation contains a refe


deviation value before the criti

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.toleranceRangeHighValue DecimalFloat This annotation contains a con


value of the tolerance range.

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.toleranceRangeHighValueElement elementRef This annotation contains a refe


value of the tolerance range.

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 83/119
12/10/2019

Annotation Meaning

UI.dataPoint.criticalityCalculation.toleranceRangeLowValue DecimalFloat This annotation contains a con


of the tolerance range.

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.criticalityCalculation.toleranceRangeLowValueElement elementRef This annotation contains a refe


value of the tolerance range.

Note
If you use This annotation, yo
UI.dataPoint.criticalityCalcul

UI.dataPoint.description String (120) This annotation contains a des


@EndUserText.quickinfo is use

Example
You can display a KPI using t
description of this KPI can be
UI.dataPoint.description ann

UI.dataPoint.forecastValue elementRef This annotation references a v


quarterly results, for example.

UI.dataPoint.longDescription String (250) This annotation contains a det


element is optional.

Example
You can display a KPI using t
hovering over this KPI can be
UI.dataPoint.longDescription

UI.dataPoint.maximumValue Integer This annotation speci es the m

UI.dataPoint.minimumValue Integer This annotation speci es the m

UI.dataPoint.referencePeriod All UI.dataPoint.referencePeriod annotations are optional. You either u


UI.dataPoint.referencePeriod.description, or UI.dataPoint.referencePe
UI.dataPoint.referencePeriod.end.

UI.dataPoint.referencePeriod.description String (120) This annotation describes the


example "Oct 2012". Typical pa

UI.dataPoint.referencePeriod.end elementRef This annotation contains a refe


period.

UI.dataPoint.referencePeriod.start This annotation contains a refe


period.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 84/119
12/10/2019

Annotation Meaning

UI.dataPoint.responsible elementRef This annotation contains an as


with @Semantics.name, @Sem
@Semantics.address, or @Sem

For more information, see Pers

For an overview of @Semantic


Annotations.

Note
If you use This annotation, yo
UI.dataPoint.responsibleNam

UI.dataPoint.responsibleName String (120) This annotation can be used a


element. Only the name of the

Note
If you use This annotation, yo
UI.dataPoint.responsible.

UI.dataPoint.targetValue DecimalFloat This annotation speci es the t


element.

Example
You create a KPI in which you
be reached at the end of a sp
UI.dataPoint.targetValue tha

Note
If you use This annotation, do
UI.dataPoint.targetValueElem

UI.dataPoint.targetValueElement elementRef This annotation speci es the t


reference to an element.

Example
You create a KPI that referen
regions that need to be reach
region. This is the UI.dataPoi
value depending on the regio

Note
If you use This annotation, do
UI.dataPoint.targetValue.

UI.dataPoint.title String (60) This annotation contains the t


omitted only if the @EndUserT
mandatory.

Example
You can display a KPI using t
KPI can be displayed using th

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 85/119
12/10/2019

Annotation Meaning

UI.dataPoint.trend elementRef reference to an element; valid

1 = StrongUp (arrow

2 = Up (arrow diagonic

3 = Sideways (horizo

4 = Down (arrow diago

5 = StrongDown (arro

For more information, see Tren

UI.dataPoint.trendCalculation Annotations belonging to UI.dataPoint.trendCalculation can be used a


the trend element. The trend can be calculated based on the values of

UI.dataPoint.trendCalculation.downDifference DecimalFloat This annotation contains a con


results in a down-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.downDifferenceElement elementRef This annotation contains a refe


results in a down-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.isRelativeDifference Boolean default false This annotation expresses if th


differences or relative differenc

Example
Your reference value is 10, an
difference of these two value
these two values is 1.2.

UI.dataPoint.trendCalculation.referenceValue elementRef This annotation speci es the r


a reference to an element.

UI.dataPoint.trendCalculation.strongDownDifference DecimalFloat This annotation contains a con


results in a strong down-trend

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.strongDownDifferenceElement elementRef This annotation contains a refe


results in a strong down-trend

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 86/119
12/10/2019

Annotation Meaning

UI.dataPoint.trendCalculation.strongUpDifference DecimalFloat This annotation contains a con


results in a strong up-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.strongUpDifferenceElement elementRef This annotation contains a refe


results in a strong up-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.upDifference DecimalFloat This annotation contains a con


results in an up-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.trendCalculation.upDifferenceElement elementRef This annotation contains a refe


results in an up-trend.

Note
If you use This annotation, yo
UI.dataPoint.trendCalculatio

UI.dataPoint.valueFormat All UI.dataPoint.valueFormat annotations are optional. For more inform


Responsible and Reference Period.

UI.dataPoint.valueFormat.numberOfFractionalDigits Integer This annotation contains the n

Example
If the element value is 1, one
34.5.

UI.dataPoint.valueFormat.scaleFactor DecimalFloat This annotation contains the s

Example
A value 1000 displayed with

Annotations belonging to UI. eldGroup is an ordered collection of data elds with a label for the group. UI. eldGroup annotations are used to
in a form.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 87/119
12/10/2019

Annotation Meaning

UI. eldGroup.criticality elementRef This annotation can be speci


This annotation references to
2, or 3. The criticality value Ne
criticality value Negative is r
Critical is re ected by the v
Positive is re ected by the v

For more information, see Crit

UI. eldGroup.dataAction String This annotation can be used if


element references the technia
Object Processing Framework
<technical name of act

UI. eldGroup.exclude Boolean default true This annotation allows excludi


annotation on the derived view
optional.

For more information, see Inhe

UI. eldGroup.groupLabel String (60) This annotation contains langu


for the eld group. The rst oc
occurrences for the same qua
optional.

UI. eldGroup.iconURL String This annotation contains the U


optional.

UI. eldGroup.importance This annotation expresses the importance of dataFields or other anno
example, in dynamic rendering approaches with responsive design pat

Example
You de ned several eld groups for an item's object view oorplan. T
displayed always, get importance HIGH. This ensures that these eld
when the page is rendered on a small display.

If no importance is de ned, the eld group item is treated like having i

Values:

String

The following enumerations are provided:

Value Description

HIGH -

MEDIUM -

LOW -

UI. eldGroup.invocationGrouping This annotation expresses how multiple invocations of the same action
annotation is optional. This annotation needs to be speci ed if you use

Values:

String enum

The following enumerations are provided:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 88/119
12/10/2019

Annotation Meaning

ISOLATED Default
Describes the error handling w
selected instances:

The action is executed


which the action canno

Example
A user selects ve ite
One item cannot be c
other four items are

CHANGE_SET Describes the error handling w


selected instances:

If an action cannot be
instances, the action is
instances.

Example
A user selects ve ite
One item cannot be c
copied.

UI. eldGroup.label String (60) This annotation contains a lan


for labeling a group of elds.
If omitted, the label of the ann
element referenced via the val

UI. eldGroup.position DecimalFloat With This annotation you spec


annotation is mandatory.

Example
You can specify the sequenc
an item's object view oorpla

UI. eldGroup.quali er String (120) This annotation is used to grou


need to specify a quali er as n
correct eld group can be refe

UI. eldGroup.semanticObjectAction String This annotation can be used in


FOR_INTENT_BASED_NAVIGA
WITH_INTENT_BASED_NAVIG
name of an action on the sema
from @Consumption.semantic
the de ning view.

UI. eldGroup.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI. eldGroup.targetElement w
UI. eldGroup.type of type WIT
example, provide background
the object view oorplan.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 89/119
12/10/2019

Annotation Meaning

UI. eldGroup.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

FOR_ACTION Maps to DataFieldForAction.

DataFieldForAction is based on
action. For example, a button i
label.

For more information, see Acti

When you use this type, you ca

label

invocationGrouping

When you use this type, you m

dataAction

AS_ADDRESS Maps to DataFieldForAnnotati

DataFieldForAnnotation is use
Edm.AnnotationPath abstract
vCard.Address or UI.DataPoint

When you use this type, you ca

label

value

AS_DATAPOINT Maps to DataFieldForAnnotati

For more information, see Data

When you use this type, you ca

label

value

FOR_INTENT_BASED_NAVIGATION Maps to DataFieldForIntentBa

DataFieldForIntentBasedNavig
semantic object.

For more information, see Bas

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 90/119
12/10/2019

Annotation Meaning

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 91/119
12/10/2019

Annotation Meaning

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink.

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

value

When you use this type, you m

semanticObjectAction

UI. eldGroup.url elementRef This annotation represents the


contains a navigation URL. You
you use the annotation UI. eld

UI. eldGroup.value elementRef This annotation refers to a valu


Type AS_ADDRESS:

Value element must no


annotated. Use instead
@com.sap.vocabularie
alias-quali ed name) a

Value element must be


CDS view is annotated
@Semantics.address o

If you want to referenc


indirectly associated, u

All other types:

Value element must no


in this case the annota

Value element must be


The value is a path to a

Annotations belonging to UI.headerInfo describe an entity, its title, and an optional short description, the name of its entity in singular and plu
individual entity.

Scope: [VIEW, TABLE_FUNCTION, ENTITY]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values:

UI.headerInfo.description Annotations belonging to UI.headerInfo.description represent a prope


to the types STANDARD, WITH_NAVIGATION_PATH, and WITH_URL. U
optional.

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 92/119
12/10/2019

Annotation Meaning

UI.headerInfo.description.criticality elementRef This annotation can be speci


description is STANDARD.This
element that has the values 0,
re ected by the value 0, the cr
the value 1, the criticality value
and the criticality value Posit

For more information, see Crit

UI.headerInfo.description.iconURL String This annotation contains the U


optional.

UI.headerInfo.description.label String (60) This annotation contains a lan


for descriptions in page heade
oorplans are SAP Fiori oorp
If omitted, the label of the ann
element referenced via the val

UI.headerInfo.description.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.headerInfo.description.targ
UI.headerInfo.description.type
might, for example, provide ba
opened on the object view oo

UI.headerInfo.description.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 93/119
12/10/2019

Annotation Meaning

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

value

UI.headerInfo.description.url elementRef This annotation represents the


contains a navigation URL. You
UI.headerInfo.description.url w
UI.headerInfo.description.type

UI.headerInfo.description.value This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 94/119
12/10/2019

Annotation Meaning

UI.headerInfo.imageUrl elementRef This annotation represents a p


an image representing the ent

Example
When users open an item fro
related to that item as part o

UI.headerInfo.title Annotations belonging to UI.headerInfo.title represent a property of ty


types STANDARD, WITH_NAVIGATION_PATH, WITH_URL, and WITH_I
@UI.headerInfo.title annotations are mandatory and are usually used t
header of an item's object page..

The OData annotations DataFieldAbstract are the basis for all DataFie
optional labels that can trigger navigation to related data, or execute a

UI.headerInfo.title.criticality elementRef This annotation can be speci


STANDARD. This annotation is
view oorplan. This annotation
the values 0, 1, 2, or 3. The crit
value 0, the criticality value Ne
criticality value Critical is r
value Positive is re ected b

For more information, see Crit

UI.headerInfo.title.iconURL String This annotation contains the U


optional.

UI.headerInfo.title.label String (60) This annotation contains a lan


for titles in page headers of ob
oorplans are SAP Fiori oorp
If omitted, the label of the ann
element referenced via the val

UI.headerInfo.title.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.headerInfo.title.targetEleme
UI.headerInfo.title.type of type
example, provide background
the object view oorplan.

UI.headerInfo.title.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 95/119
12/10/2019

Annotation Meaning

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 96/119
12/10/2019

Annotation Meaning

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink.

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

value

UI.headerInfo.title.url elementRef This annotation represents the


contains a navigation URL. You
when you use the annotation U

UI.headerInfo.title.value This annotation refers to a valu


same view, specify the elemen
to a value, specify the path to t

UI.headerInfo.typeImageUrl String This annotation contains the U


The element is is optional.

Example
When users open a SAP Fior
related to the entity type to w
belong to.

UI.headerInfo.typeName String(60) This annotation represents the


element is required and can be
@EndUserText.label is speci e

UI.headerInfo.typeNamePlural This annotation represents a li


mandatory.

UI.hidden This annotation allows to show or hide data elds based on the state o
see Field Hiding.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into

Value: Boolean default true

Annotation belonging to UI.identi cation represent an ordered collection of speci c data elds that together with headerInfo identi es an ent

Example
This annotation is displayed in the General Information section in the body of the object view oorplan of an item, for example.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 97/119
12/10/2019

Annotation Meaning

UI.identi cation.criticality elementRef This annotation can be speci


STANDARD.This annotation re
values 0, 1, 2, or 3. The critical
value 0, the criticality value Ne
criticality value Critical is r
value Positive is re ected b

For more information, see Crit

UI.identi cation.dataAction String This annotation can be used if


The element references the te
Object Processing Framework
<technical name of act

UI.identi cation.exclude Boolean default true This annotation allows excludi


annotation on the derived view
optional.

For more information, see Inhe

UI.identi cation.iconURL String This annotation contains the U


optional. This could be a telep

UI.identi cation.importance This annotation expresses the importance of dataFields or other anno
example, in dynamic rendering approaches with responsive design pat

Example
You de ned several entries for the General Information section for a
entries that need to be displayed always, get importance HIGH. This
in the section when this section is rendered on a small display.

If no importance is de ned, the identi cation item is treated like havin

Values:

String

The following enumerations are provided:

Value Description

HIGH -

MEDIUM -

LOW -

UI.identi cation.invocationGrouping This annotation expresses how multiple invocations of the same action
annotation is optional. This annotation needs to be speci ed if you use
FOR_ACTION.

Values:

String enum

The following enumerations are provided:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 98/119
12/10/2019

Annotation Meaning

ISOLATED Default
Describes the error handling w
selected instances:

The action is executed


which the action canno

Example
A user selects ve ite
One item cannot be c
other four items are

CHANGE_SET Describes the error handling w


selected instances:

If an action cannot be
instances, the action is
instances.

Example
A user selects ve ite
One item cannot be c
copied.

UI.identi cation.label String (60) This annotation contains a lan


the body section of an item's o
If omitted, the label of the ann
element referenced via the val

UI.identi cation.position DecimalFloat With This annotation you spec


oorplan. This annotation is m

Example
When users open the object
General Information section
general information about th

UI.identi cation.semanticObjectAction String This annotation can be used in


FOR_INTENT_BASED_NAVIGA
WITH_INTENT_BASED_NAVIG
name of an action on the sema
from @Consumption.semantic
the de ning view.

UI.identi cation.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.identi cation.targetElemen
UI.identi cation.type of type W
example, provide background
the object view oorplan.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade9677… 99/119
12/10/2019

Annotation Meaning

UI.identi cation.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

FOR_ACTION Maps to DataFieldForAction.

DataFieldForAction is based on
action. For example, a button i
label.

For more information, see Acti

When you use this type, you ca

label

invocationGrouping

When you use this type, you m

dataAction

AS_ADDRESS Maps to DataFieldForAnnotati

DataFieldForAnnotation is use
Edm.AnnotationPath abstract
vCard.Address or UI.DataPoint

When you use this type, you ca

label

value

AS_DATAPOINT Maps to DataFieldForAnnotati

For more information, see Data

When you use this type, you ca

label

value

FOR_INTENT_BASED_NAVIGATION Maps to DataFieldForIntentBa

DataFieldForIntentBasedNavig
semantic object.

For more information, see Bas

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 100/119
12/10/2019

Annotation Meaning

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 101/119
12/10/2019

Annotation Meaning

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink.

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

value

When you use this type, you m

semanticObjectAction

UI.identi cation.url elementRef This annotation represents the


contains a navigation URL. You
you use the annotation UI.iden

UI.identi cation.value elementRef This annotation refers to a valu


Type AS_ADDRESS:

Value element must no


annotated. Use instead
@com.sap.vocabularie
alias-quali ed name) a

Value element must be


CDS view is annotated
@Semantics.address o

If you want to referenc


indirectly associated, u

All other types:

Value element must no


in this case the annota

Value element must be


The value is a path to a

Annotations belonging to UI.lineItem represent an ordered collection of data elds that is used to represent data from multiple data instances
see Columns.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

UI.lineItem.criticality elementRef This annotation can be speci


annotation references to anoth
3. The criticality value Neutra
value Negative is re ected b
Critical is re ected by the v
Positive is re ected by the v

For more information, see Crit

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 102/119
12/10/2019

Annotation Meaning

UI.lineItem.dataAction String This annotation can be used if


element references the technia
Object Processing Framework
string pattern is BOPF:<tech

UI.lineItem.exclude Boolean default true This annotation allows excludi


annotation on the derived view
optional.

For more information, see Inhe

UI.lineItem.iconURL String This annotation contains the U


optional.

UI.lineItem.importance This annotation expresses the importance of dataFields or other anno


example, in dynamic rendering approaches with responsive design pat

Example
You de ned a table with several columns. The columns that need to b
HIGH. This ensures that these columns are displayed in a table when

If no importance is de ned, the line item is treated like having importa

Values:

String

The following enumerations are provided:

Value Description

HIGH -

MEDIUM -

LOW -

UI.lineItem.invocationGrouping This annotation expresses how multiple invocations of the same action
annotation is optional. This annotation needs to be speci ed if you use

Values:

String enum

The following enumerations are provided:

Value Description

ISOLATED Default
Describes the error handling w
selected instances:

The action is executed


which the action canno

Example
A user selects ve ite
One item cannot be c
other four items are

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 103/119
12/10/2019

Annotation Meaning

CHANGE_SET Describes the error handling w


selected instances:

If an action cannot be
instances, the action is
instances.

Example
A user selects ve ite
One item cannot be c
copied.

UI.lineItem.label String (60) This annotation contains a lan


for column titles in tables head
If omitted, the label of the ann
element referenced via the val

UI.lineItem.position DecimalFloat With This annotation you spec


annotation is mandatory.

UI.lineItem.quali er String (120) This annotation is used to grou


If you want to use more than o
distinguish them on the UI.

UI.lineItem.semanticObjectAction String This annotation refers to the n


The semantic object is taken f
derived via an association from

UI.lineItem.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.lineItem.targetElement whe
of type WITH_NAVIGATION_PA
background information to an
oorplan.

UI.lineItem.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 104/119
12/10/2019

Annotation Meaning

FOR_ACTION Maps to DataFieldForAction.

DataFieldForAction is based on
action. For example, a button i
label.

For more information, see Acti

When you use this type, you ca

label

invocationGrouping

When you use this type, you m

dataAction

AS_ADDRESS Maps to DataFieldForAnnotati

DataFieldForAnnotation is use
Edm.AnnotationPath abstract
vCard.Address or UI.DataPoint

When you use this type, you ca

label

value

AS_DATAPOINT Maps to DataFieldForAnnotati

For more information, see Data

When you use this type, you ca

label

value

FOR_INTENT_BASED_NAVIGATION Maps to DataFieldForIntentBa

DataFieldForIntentBasedNavig
semantic object.

For more information, see Bas

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 105/119
12/10/2019

Annotation Meaning

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 106/119
12/10/2019

Annotation Meaning

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink.

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

value

When you use this type, you m

semanticObjectAction

UI.lineItem.url elementRef This annotation represents the


contains a navigation URL. You
use the annotation UI.lineItem

UI.lineItem.value elementRef This annotation refers to a valu


Type AS_ADDRESS:

Value element must no


annotated. Use instead
@com.sap.vocabularie
alias-quali ed name) a

Value element must be


CDS view is annotated
@Semantics.address o

If you want to referenc


indirectly associated, u

All other types:

Value element must no


in this case the annota

Value element must be


The value is a path to a

UI.masked This annotation refers to, for example, passwords or pass phrases. The
value in clear text upon explicit user interaction. For more information

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into

Value: Boolean default true

UI.multiLineText This annotation contains text that is rendered as multiple lines. For mo

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into

Value: Boolean default true

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 107/119
12/10/2019

Annotation Meaning

Annotations belonging to UI.selectionField allow ltering a list of data. UI.selectionField annotations are usually used in an initial page oorpla

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

UI.selectionField.element elementRef Optional element reference

Must be used when an


path to an element of t
you want to lter a tab
CDS view but in anoth

Example
You de ne a sales ord
business partners fo
country information
view but in the busin

Must not be used whe


this case the annotate

UI.selectionField.exclude Boolean default true This annotation allows excludi


annotation on the derived view
optional.

For more information, see Inhe

UI.selectionField.position DecimalFloat With This annotation you spec


used for ltering. This annotat

Example
When users open a SAP Fior
items, they might want to lt
date, for example. They can s
list. You specify what selectio
so on.

UI.selectionField.quali er String (120) This annotation is used to grou


need to specify a quali er as n
correct selection eld can be r

Annotations belonging to UI.statusInfo represent a list of abstract data elds that convey the status of an entity. UI.statusInfo annotations are
item's object view oorplan.

Scope: [ELEMENT]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into the corresponding OData annotations

Values: array of

UI.statusInfo.criticality elementRef This annotation can be speci


This annotation references to
2, or 3. The criticality value Ne
criticality value Negative is r
Critical is re ected by the v
Positive is re ected by the v

For more information, see Crit

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 108/119
12/10/2019

Annotation Meaning

UI.statusInfo.dataAction String This annotation can be used if


element references the technia
Object Processing Framework
<technical name of act

UI.statusInfo.exclude Boolean default true This annotation allows excludi


annotation on the derived view
optional.

For more information, see Inhe

UI.statusInfo.iconURL String This annotation contains the U


optional.

UI.statusInfo.importance This annotation expresses the importance of dataFields or other anno


example, in dynamic rendering approaches with responsive design pat

Example
You de ned several statuses. The statuses that need to be displayed
ensures that these statuses are displayed in a table, for example, wh
display.

If no importance is de ned, the status info is treated like having impor

Values:

String

The following enumerations are provided:

Value Description

HIGH -

MEDIUM -

LOW -

UI.statusInfo.invocationGrouping This annotation expresses how multiple invocations of the same action
annotation is optional. This annotation needs to be speci ed if you use

Values:

String enum

The following enumerations are provided:

Value Description

ISOLATED Default
Describes the error handling w
selected instances:

The action is executed


which the action canno

Example
A user selects ve ite
One item cannot be c
other four items are

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 109/119
12/10/2019

Annotation Meaning

CHANGE_SET Describes the error handling w


selected instances:

If an action cannot be
instances, the action is
instances.

Example
A user selects ve ite
One item cannot be c
copied.

UI.statusInfo.position DecimalFloat With This annotation you spec


are displayed. This annotation

UI.statusInfo.semanticObjectAction String This annotation can be used in


FOR_INTENT_BASED_NAVIGA
WITH_INTENT_BASED_NAVIG
name of an action on the sema
from @Consumption.semantic
the de ning view.

UI.statusInfo.targetElement elementRef This annotation represents the


view. The path is converted to
This annotation, you can link f
oorplan to a target element. Y
UI.statusInfo.targetElement w
UI.statusInfo.type of type WITH
example, provide background
the object view oorplan.

UI.statusInfo.type This enumeration annotation exactly speci es what type of the type h
enumeration type determines which CDS elements are required or ava

Values:

String

The following enumerations are provided:

Value Description

FOR_ACTION Maps to DataFieldForAction.

DataFieldForAction is based on
action. For example, a button i
label.

For more information, see Acti

When you use this type, you ca

label

invocationGrouping

When you use this type, you m

dataAction

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 110/119
12/10/2019

Annotation Meaning

AS_ADDRESS Maps to DataFieldForAnnotati

DataFieldForAnnotation is use
Edm.AnnotationPath abstract
vCard.Address or UI.DataPoint

When you use this type, you ca

label

value

AS_CONTACT Maps to DataFieldForAnnotati

DataFieldForAnnotation is use
Edm.AnnotationPath abstract
vCard.Address or UI.DataPoint

When you use this type, you ca

label

value

AS_DATAPOINT Maps to DataFieldForAnnotati

For more information, see Data

When you use this type, you ca

label

value

FOR_INTENT_BASED_NAVIGATION Maps to DataFieldForIntentBa

DataFieldForIntentBasedNavig
semantic object. The navigatio

For more information, see Bas

When you use this type, you ca

label

When you use this type, you m

semanticObjectAction

STANDARD Default
Maps to standard DataField. Yo
displayed without any addition

A standard DataField refers to

When you use this type, you ca

label

value

criticality

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 111/119
12/10/2019

Annotation Meaning

WITH_NAVIGATION_PATH Maps to DataFieldWithNavigat

DataFieldWithNavigationPath
value pair that refers to a prop
de nition consists of a link to n
navigation property provided b
annotation le.

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

targetElement

WITH_URL Maps to DataFieldWithURL.

DataFieldWithURL is based on
that refers a property of the O
a URL to navigate to a new targ

For more information, see With

When you use this type, you ca

label

value

When you use this type, you m

url

WITH_INTENT_BASED_NAVIGATION Maps to DataFieldWithIntentB

DataFieldWithIntentBasedNav
be rendered as a hyperlink.

This annotation is displayed lik


similar to type FOR_INTENT_B
information, see With URL and

When you use this type, you ca

label

value

When you use this type, you m

semanticObjectAction

UI.statusInfo.url elementRef This annotation represents the


contains a navigation URL. You
you use the annotation UI.stat

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 112/119
12/10/2019

Annotation Meaning

UI.statusInfo.value elementRef This annotation refers to a valu


Type AS_ADDRESS:

Value element must no


annotated. Use instead
@com.sap.vocabularie
alias-quali ed name) a

Value element must be


CDS view is annotated
@Semantics.address o

If you want to referenc


indirectly associated, u

All other types:

Value element must no


in this case the annota

Value element must be


The value is a path to a

UI.textArrangement Description: This annotation speci es the arrangement of code-text p

Scope: [VIEW]

Evaluation Runtime (Engine): SADL: Translates CDS annotations into

Values:

String

The following enumerations are provided:

Value Description

TEXT_FIRST The text is displayed in front o

Example
English (EN)

TEXT_LAST The code is displayed in front o

Example
EN (English)

TEXT_ONLY The text is displayed without t

Example
English

TEXT_SEPARATE The text and the code are disp

Example

Language Language
(Code)

EN English

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 113/119
12/10/2019

Examples
Example 1: @UI.headerInfo

In this example, the element @UI.headerInfo.typeNamePlural is used to de ne, what can be shown in the title of a table or list.

Sample Code

...
@UI.headerInfo: { typeNamePlural: 'Sales Orders' }
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {
...
}

Example 2: @UI.lineItem

The annotation @UI.lineItem is used to de ne what elements are shown in the table-columns.

Since the desired columns of a table depend on the use-case (an overview may require more elds than a value-help) several list-
layouts can be de ned, distinguished by a quali er. If the CDS view contains analytical annotations, for example
@DefaultAggregation, they are considered automatically. No additional UI annotations are required.

Sample Code

...
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {
@UI.lineItem: [ { position: 10 }, { qualifier: 'ValueList', position: 10 } ]
key so.sales_order_id as SalesOrder,

@UI.lineItem: [ { position: 20 }, { qualifier: 'ValueList', position: 20 } ]


so.customer.company_name as CompanyName,

@UI.lineItem: [ { position: 30 } ]
so.currency_code as CurrencyCode,

@DefaultAggregation: #SUM
@UI.lineItem: [ { position: 40 } ]
so.gross_amount as GrossAmount
}

Example 3: @UI.selectionField

The annotation @UI.selectionField is used to enable speci c elements for selection, for example using a lter bar.

If the CDS view is annotated as @Search.searchable or if a value help is available for the element, this is considered. No additional
UI annotations are required to expose the search eld or value help.

Sample Code

...
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {
key so.sales_order_id as SalesOrder,

@UI.selectionField: [ { position: 10 } ]
so.customer.company_name as CompanyName,
...
}

Example 4: @UI.identi cation


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 114/119
12/10/2019
The annotation @UI.Identi cation is used to de ne which elements are shown on a detail page.

Sample Code

...
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {
@UI.identification: [ { position: 10 } ]
key so.sales_order_id as SalesOrder,

@UI.identification: [ { position: 20 } ]
so.customer.company_name as CompanyName,

@UI.identification: [ { position: 30 } ]
so.currency_code as CurrencyCode,

@UI.identification: [ { position: 40 } ]
so.gross_amount as GrossAmount
}

Example 5: @UI. eldGroup

The annotation @UI. eldGroup is used to group several elds, for example, for sections of forms. Similar to the annotation
@UI.lineItem, the different eld groups have unique quali ers.

Sample Code

define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {


@UI.identification: [ { qualifier: 'GeneralInformation', position: 10 } ]
key so.sales_order_id as SalesOrder,

@UI.identification: [ { qualifier: 'GeneralInformation', position: 20 } ]


so.customer.company_name as CompanyName,

@UI.identification: [ { qualifier: 'SalesData', position: 30 } ]


so.currency_code as CurrencyCode,

@UI.identification: [ { qualifier: 'SalesData', position: 40 } ]


so.gross_amount as GrossAmount
}

Example 6:@UI.badge

The annotation @UI.badge represents the view of a business card. A badge can be considered as the combination of the
annotations @UI.headerInfo and @UI.identi cation. The properties ImageUrl, TypeImageUrl, and Title correspond to the
properties from the annotation @UI.HeaderInfo. In addition to the Title property, the properties HeadLine, MainInfo and
SecondaryInfo of the same format can be speci ed.

Sample Code

@UI.badge: {
title: {
label: 'Sales Order',
value: 'SalesOrderID' -- Reference to element in projection-list
},
headLine: {
label: 'Customer',
value: 'CompanyName' -- Reference to element in projection-list
},
mainInfo: {
label: 'Gross Amount',
value: 'GrossAmount' -- Reference to element in projection-list
},
secondaryInfo: {
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 115/119
12/10/2019
label: 'Billing Status',
value: 'BillingStatus' -- Reference to element in projection-list
}
}

define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {


key so.sales_order_id as SalesOrder,
so.customer.company_name as CompanyName,
so.gross_amount as GrossAmount,
so.billing_status as BillingStatus,
...
}

Example 7: @UI.chart

The annotation @UI.chart is used to de ne the properties of a chart. The annotation is de ned at view level and refers to the
elements that are supposed to be used in the chart. Additionally, a title and description can be provided.

Sample Code

...
@UI.chart: {
title: 'Gross Amount by Customer',
description: 'Line-chart displaying the gross amount by customer',
chartType: #LINE,
dimensions: [ 'CompanyName' ], -- Reference to one element
measures: [ 'GrossAmount' ] -- Reference to one or more elements
}

define view ZExample_SalesOrder as select from sepm_cds_sales_order as so {


key so.sales_order_id as SalesOrder,
so.customer.company_name as CompanyName,
so.currency_code as CurrencyCode,

@Semantics.amount.currencyCode: 'CurrencyCode'
so.gross_amount as GrossAmount,
...
}

Example 8: @UI.hidden

The annotation @UI.hidden prevents elds from being displayed, leaving them available for client.

This is sensible if the CDS has technical keys, for example Guids, that have to be exposed to the OData service to work, but are
usually not supposed to be displayed on the UI. Another use case are elds that are required in other calculations.

In the following example, a data point with precalculated criticality and trend is exposed. These elds are required in the client to
calculate the corresponding values, but are not supposed to be displayed directly.

Sample Code

...
define view ZExample_SalesOrdersByCustomer as select from ... as so {
@UI.hidden
key so.buyer_guid as BuyerGuid,
...
@UI.dataPoint: {
criticality: 'AmountCriticality', -- Reference to element
trend: 'AmountTrend', -- Reference to element
}

so.actual_amount as ActualAmount,

@UI.hidden
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 116/119
12/10/2019
so.criticality as AmountCriticality,

@UI.hidden
so.trend as AmountTrend
}

Example 9: @UI.masked

The annotation @UI.masked marks a eld that may contain sensitive data and should therefore not be displayed in clear text by
the client.

This annotation does not in uence how data is transferred. If a eld is marked as @UI.masked, dataof this eld is still transferred
to the client like any other property.

Sample Code

...
define view Destination as select from ... {
@UI.identification: [ { position: 10 } ]
key DestinationID,
...
@UI.identification: [ { position: 20 } ]
AuthType, -- None, Basic, SSO, ...

@UI.identification: [ { position: 30 } ]
BasicAuthUserName,

@UI.identification: [ { position: 40 } ]

@UI.masked
BasicAuthPassword,
...
}

Example 10:@UI.multiLineText

The annotation @UI.multiLineText marks a eld, for example a description, that is supposed to be displayed by controls that
support multiline-input, for example a text area.

Sample Code

...
define view Product as select from ... {
@UI.identification: [ { position: 10 } ]
key ProductID,

@UI.identification: [ { position: 20 } ]
ProductName,

@UI.identification: [ { position: 30 } ]

@UI.multiLineText: true
Description,
...
}

Example 11: @UI.dataPoint

The annotation @UI.dataPoint de nes a single point of data, typically a number, that can be enriched with business-relevant data,
for example if a high or low value is desired, or if the value is increasing to decreasing.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 117/119
12/10/2019
The simplest variant of a data point consists of a value and a tile. In this case, only the value itself is exposed, without additional
information.

Sample Code

...
define view ZExample_SalesOrdersByCustomer as select from ... as so {
key so.buyer_guid as BuyerGuid,

@Semantics.currencyCode: true
so.currency_code as CurrencyCode,

@UI.dataPoint: { title: 'Gross Amount' }

@Semantics.amount.currencyCode: 'CurrencyCode'
so.actual_amount as ActualAmount
}

VDM Annotations
Allow classifying views of the virtual data model in terms of their admissible reuse options and provisioned content

Scope and De nition

@Scope:[#VIEW, #TABLE_FUNCTION]
Annotation VDM
{
viewType : String enum { BASIC; COMPOSITE; CONSUMPTION; };
private : Boolean default true;
};

Usage
VDM is intended to be interpreted by view browsers and other functionality which is based on the virtual data model.

This classi cation is used only for SAP internal structuring and interpretation of the CDS views. Releasing CDS views for
customers and partners is controlled by additional internal classi cation of the views.

Annotation Meaning

VDM.viewType De nes the type of a VDM view

Scope: #TABLE FUNCTION, #VIEW

Evaluation Runtime (Engine): None - Used for SAP internal structuring and interpretation of the CDS
views

Values:

Value Description

BASIC views that form the core data basis without data redundancies.

COMPOSITE views that provide data derived and/or composed from the BASIC
views.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 118/119
12/10/2019

Annotation Meaning

CONSUMPTION views that serve for speci c application purposes and may be
de ned based upon public interface (for example, BASIC and
COMPOSITE) views.

VDM.private Private interface (for example, BASIC and COMPOSITE) views represent technical helper views which
may only be used by their de ning responsibles.

Scope: #TABLE FUNCTION, #VIEW

Evaluation Runtime (Engine): Interpreted by ABAP Runtime Environment

Examples
Example 1

De ning a public basic VDM interface view:

Sample Code

@VDM.viewType: #BASIC
define view I_SalesOrder ... {
key SalesOrder,
...
}

Example 2

De ning a private composite VDM interface view:

Sample Code

@VDM.private: true
@VDM.viewType: #COMPOSITE
define view P_SalesOrderItemCube ... {
key SalesOrder,
...
}

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20484268&topics=630ce9b386b84e80bfade967… 119/119

You might also like