CDS Views Annotations

  • CDS View hold the logic of reading data, with semantic information extract from ABAP DDIC
  • CDS Annotation add additional information to a data field or to the entire view
  • CDS core annotation contain most common information use by all clients
  • CDS domain-specific annotation contain information for special usage
  • CDS annotation lets the consumer of a CDS view know how to use data from the CDS view

Domain Specific Annotation Related to Fiori Elements

SAP has grouped annotations according to its function. Below is a small list of most relevant groups of association for Fiori Elements.

DomainUsage
UI AnnotationsMost important domain for Fiori Elements. Nearly one-to-one relationship between CDS annotation and OData annotation term.
Consumption AnnotationsControl visibility of a data field or the whole entity. Useful when defining value help for a field.
Object Model AnnotationsProvides definitions of structural as well as transactional related aspects of the business data model
Semantics AnnotationsEnrichment of semantic information for data field

Refer the SAP documentation for complete list. ABAP CDS – SAP Annotations – ABAP Keyword Documentation

Annotation Syntax

Object style

@UI.headerInfo.typeName: 'Sales Order'
@UI.headerInfo.typeNamePlural: 'Sales Orders'
@UI.headerInfo.title.value: 'SalesOrderID'

JSON style

@UI.headerInfo.typeName: {
typeName: 'Sales Order',
typeNamePlural: 'Sales Orders',
title: {
value: 'SalesOrderID'
}
}

Annotation syntax for Array Type – only JSON style is possible

@UI.lineItem: [{
qualifier: 'qualifier1',
position: 10,
label: 'label1'
},
{
qualifier: 'qualifier2',
position: 20,
label: 'label2'
}]

Annotation Syntax: Single Line Array type

@UI.lineItem: [{
position: 10,
label: 'label1',
importance: #HIGH
}]

Annotation on CDS View association

define view ...
association to zassoc_view as _valuehelp_assoc
on ...
...
@Consumption.valueHelp: '_valuehelp_assoc'
_Cusomer.CompanyName as CustomerName,
_valuehelp_assoc,
...