# ABAP CDS Annotations Reference for On-Premise Systems

> Source: https://netray.co/tools/abap-cds-annotations-reference
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

The annotations you actually write in on-premise CDS views, with allowed values, scope, effect and the difference between DDIC-based views and view entities.

## Category

developer

## Erp

SAP S/4HANA (on-premise)

## Audience

- ABAP developer
- SAP CDS developer
- Fiori developer

## Tool

**Kind:** worksheet

**Mode:** reference

**Columns:**

#### Annotation

**Key:** annotation

**Type:** text

#### Allowed values

**Key:** values

**Type:** text

#### Scope

**Key:** scope

**Type:** text

#### Effect

**Key:** effect

**Type:** text

#### Release / notes

**Key:** notes

**Type:** text

**Rows:**

**Annotation:** @AbapCatalog.sqlViewName

**Values:** Name, max 16 characters

**Scope:** View

**Effect:** Name of the generated CDS database view in DDIC

**Notes:** DDIC-based views (DEFINE VIEW) only. Not allowed with DEFINE VIEW ENTITY.

**Annotation:** @AbapCatalog.compiler.compareFilter

**Values:** true, false

**Scope:** View

**Effect:** Same filter on an association in several path expressions creates one join instead of several

**Notes:** DDIC-based views; view entities always behave this way.

**Annotation:** @AbapCatalog.preserveKey

**Values:** true, false

**Scope:** View

**Effect:** true keeps the KEY elements of the CDS view as key of the database view

**Notes:** DDIC-based views only.

**Annotation:** @AbapCatalog.viewEnhancementCategory

**Values:** [#NONE], [#PROJECTION_LIST], [#UNION], [#GROUP_BY]

**Scope:** View

**Effect:** Controls which CDS view extensions are allowed

**Notes:** Array value. Needed when the view uses aggregates or UNION and should be extensible.

**Annotation:** @AccessControl.authorizationCheck

**Values:** #CHECK, #NOT_REQUIRED, #NOT_ALLOWED, #PRIVILEGED_ONLY

**Scope:** View

**Effect:** Whether a DCL role (DEFINE ROLE) must restrict ABAP SQL access

**Notes:** #CHECK gives a syntax warning if no role exists. Access control applies to ABAP SQL, not to direct database access.

**Annotation:** @EndUserText.label

**Values:** Text, max 60 characters

**Scope:** View, element, parameter

**Effect:** Translatable label shown in tools and UIs

**Notes:** Element labels override the data element text.

**Annotation:** @EndUserText.quickInfo

**Values:** Text

**Scope:** Element, parameter

**Effect:** Tooltip text

**Notes:** Translatable.

**Annotation:** @ClientHandling.type

**Values:** #INHERITED, #CLIENT_DEPENDENT, #CLIENT_INDEPENDENT

**Scope:** View

**Effect:** Declares whether the view is client-specific

**Notes:** DDIC-based views and table functions. View entities handle the client implicitly.

**Annotation:** @ClientHandling.algorithm

**Values:** #AUTOMATED, #SESSION_VARIABLE, #NONE

**Scope:** View

**Effect:** How the client is applied in the generated SQL

**Notes:** #SESSION_VARIABLE uses the HANA session variable CDS_CLIENT.

**Annotation:** @Metadata.allowExtensions

**Values:** true, false

**Scope:** View

**Effect:** Allows metadata extensions (DDLX) to add annotations

**Notes:** Typical for UI annotations kept out of the DDL.

**Annotation:** @Metadata.ignorePropagatedAnnotations

**Values:** true, false

**Scope:** View

**Effect:** Stops element annotations from being inherited from data sources

**Notes:** Use when inherited UI or semantics annotations are wrong for this view.

**Annotation:** @VDM.viewType

**Values:** #BASIC, #COMPOSITE, #CONSUMPTION, #TRANSACTIONAL

**Scope:** View

**Effect:** Classifies the view in the virtual data model

**Notes:** Documentation only for the runtime; used by SAP naming and release contracts.

**Annotation:** @ObjectModel.representativeKey

**Values:** Element name

**Scope:** View

**Effect:** Marks the most specific key element, e.g. the item in an item view

**Notes:** Needed for value helps and analytics on multi-key views.

**Annotation:** @ObjectModel.text.element

**Values:** [ 'ElementName' ]

**Scope:** Element

**Effect:** Links a code to its text element in the same view

**Notes:** Alternative: @ObjectModel.text.association to a text view.

**Annotation:** @ObjectModel.foreignKey.association

**Values:** '_AssociationName'

**Scope:** Element

**Effect:** Declares the association that checks or describes the field value

**Notes:** Used by analytics and value helps.

**Annotation:** @ObjectModel.usageType.serviceQuality

**Values:** #A, #B, #C, #D, #X, #P

**Scope:** View

**Effect:** Performance class of the view

**Notes:** #A cheapest, #D heaviest, #X for extraction, #P for hierarchy or helper views.

**Annotation:** @ObjectModel.usageType.sizeCategory

**Values:** #S, #M, #L, #XL, #XXL

**Scope:** View

**Effect:** Expected row count class

**Notes:** Rough sizing hint, not enforced.

**Annotation:** @ObjectModel.usageType.dataClass

**Values:** #TRANSACTIONAL, #MASTER, #ORGANIZATIONAL, #CUSTOMIZING, #META, #MIXED

**Scope:** View

**Effect:** Kind of data the view returns

**Notes:** Used for caching and classification.

**Annotation:** @Semantics.amount.currencyCode

**Values:** 'CurrencyElement'

**Scope:** Element

**Effect:** Links an amount to its currency key field

**Notes:** Required for CURR fields in view entities, which check the reference strictly.

**Annotation:** @Semantics.quantity.unitOfMeasure

**Values:** 'UnitElement'

**Scope:** Element

**Effect:** Links a quantity to its unit field

**Notes:** Required for QUAN fields in view entities.

**Annotation:** @Semantics.currencyCode

**Values:** true

**Scope:** Element

**Effect:** Marks the element as a currency key

**Notes:** Set on the CUKY element referenced by amounts.

**Annotation:** @Semantics.unitOfMeasure

**Values:** true

**Scope:** Element

**Effect:** Marks the element as a unit key

**Notes:** Set on the UNIT element referenced by quantities.

**Annotation:** @Semantics.text

**Values:** true

**Scope:** Element

**Effect:** Marks the element as a language-dependent text

**Notes:** Used with text views and @ObjectModel.text.

**Annotation:** @Semantics.systemDateTime.lastChangedAt

**Values:** true

**Scope:** Element

**Effect:** Marks the last changed time stamp

**Notes:** RAP uses it for ETag and change tracking.

**Annotation:** @Analytics.dataCategory

**Values:** #CUBE, #DIMENSION, #FACT, #AGGREGATIONLEVEL

**Scope:** View

**Effect:** Role of the view in the analytic model

**Notes:** Cubes need measures with an aggregation default.

**Annotation:** @Analytics.query

**Values:** true

**Scope:** View

**Effect:** Makes the view an analytical query for the analytic engine

**Notes:** Classic approach. Newer releases use transient view entities with provider contract analytical_query.

**Annotation:** @Analytics.dataExtraction.enabled

**Values:** true

**Scope:** View

**Effect:** Allows extraction through ODP, for example to BW or Datasphere

**Notes:** Add delta annotations for change data capture.

**Annotation:** @DefaultAggregation

**Values:** #SUM, #MIN, #MAX, #COUNT_DISTINCT, #NONE, #FORMULA

**Scope:** Element

**Effect:** Default aggregation of a measure

**Notes:** Newer releases prefer @Aggregation.default with the same values.

**Annotation:** @OData.publish

**Values:** true

**Scope:** View

**Effect:** Generates an SAP Gateway OData V2 service for the view

**Notes:** Legacy approach for DDIC-based views: register the generated service in /IWFND/MAINT_SERVICE. Not used for RAP.

**Annotation:** @UI.lineItem

**Values:** [{ position: 10, importance: #HIGH, label: '...' }]

**Scope:** Element

**Effect:** Column in a Fiori elements list or table

**Notes:** Usually placed in a metadata extension.

**Annotation:** @UI.identification

**Values:** [{ position: 10 }]

**Scope:** Element

**Effect:** Field in the identification area of an object page

**Notes:** Referenced by a facet of type #IDENTIFICATION_REFERENCE.

**Annotation:** @UI.selectionField

**Values:** [{ position: 10 }]

**Scope:** Element

**Effect:** Filter field in the list report filter bar

**Notes:** Combine with a value help.

**Annotation:** @UI.headerInfo

**Values:** { typeName: '...', typeNamePlural: '...', title: { value: 'Element' } }

**Scope:** View

**Effect:** Object page header and list title

**Notes:** View-level annotation.

**Annotation:** @UI.facet

**Values:** [{ id: '...', purpose: #STANDARD, type: #IDENTIFICATION_REFERENCE, label: '...', position: 10 }]

**Scope:** Element

**Effect:** Sections of an object page

**Notes:** Placed on any element, often the key.

**Annotation:** @Consumption.valueHelpDefinition

**Values:** [{ entity: { name: 'ValueHelpView', element: 'Element' } }]

**Scope:** Element, parameter

**Effect:** Assigns a value help view

**Notes:** The value help view must be exposed in the service.

**Annotation:** @Consumption.filter

**Values:** { selectionType: #SINGLE | #INTERVAL | #RANGE, multipleSelections: true, mandatory: true }

**Scope:** Element

**Effect:** Filter behaviour in analytical queries and UIs

**Notes:** Mostly evaluated by analytics.

**Annotation:** @Search.searchable

**Values:** true

**Scope:** View

**Effect:** Enables free-text search on the view

**Notes:** Needs at least one element with defaultSearchElement.

**Annotation:** @Search.defaultSearchElement

**Values:** true

**Scope:** Element

**Effect:** Element included in the free-text search

**Notes:** Add @Search.fuzzinessThreshold for fuzzy search on HANA.

**Annotation:** @Environment.systemField

**Values:** #CLIENT, #SYSTEM_DATE, #SYSTEM_TIME, #SYSTEM_LANGUAGE, #USER

**Scope:** Parameter

**Effect:** ABAP SQL passes the matching system value when no actual parameter is given

**Notes:** Introduced with 7.50. #CLIENT prevents passing the client explicitly.

**Notes:** Values are from the ABAP keyword documentation section on ABAP CDS SAP annotations and the framework-specific annotation docs. Annotation support differs between SAP_BASIS 7.50, ABAP Platform 7.5x for S/4HANA and view entities (7.55 and later); check the ADT element info (F2) on your system.

## Content

**Intro:** This reference lists the CDS annotations on-premise developers write most, with their allowed values, where they go and what they change at runtime. It covers both DDIC-based views (DEFINE VIEW) and CDS view entities (DEFINE VIEW ENTITY) on SAP NetWeaver 7.50 and S/4HANA.

**Sections:**

#### How to use it

**Body:** Search by annotation name or by what you want to achieve, for example authorization, currency, text or filter. The scope column tells you whether the annotation goes before DEFINE (view), before an element in the select list, or before a parameter. The notes column flags annotations that only work in DDIC-based views. In ADT, place the cursor on an annotation and press F2 to see the definition and allowed values for your exact release, and use code completion after the @ sign to list what your system supports.

#### Version differences and gotchas

**Body:** CDS view entities, available from ABAP Platform 7.55, drop several AbapCatalog and ClientHandling annotations because they have no generated SQL view: @AbapCatalog.sqlViewName, preserveKey and the ClientHandling annotations are not allowed. View entities also check amount and quantity references strictly, so CURR and QUAN fields need @Semantics.amount.currencyCode and @Semantics.quantity.unitOfMeasure. @OData.publish is the older shortcut to a Gateway V2 service and is not used with RAP, where you write a service definition and binding instead.

**Bullets:**

- Migrating DEFINE VIEW to DEFINE VIEW ENTITY: remove sqlViewName and ClientHandling.
- @Analytics.query true is the classic query; newer releases use transient view entities.
- @DefaultAggregation is being replaced by @Aggregation.default.

#### Authorization check in practice

**Body:** @AccessControl.authorizationCheck: #CHECK means you intend to write a DCL role with DEFINE ROLE that maps PFCG authorization objects to view fields, for example a condition on the sales organization with an aspect pfcg_auth to V_VBAK_VKO. Without a role, #CHECK gives a syntax warning and the view returns all rows. #NOT_REQUIRED means no role is needed, #NOT_ALLOWED blocks roles, and #PRIVILEGED_ONLY allows only privileged access. Access control runs for ABAP SQL reads. An SQL console or a direct database user bypasses it, which matters when you expose views to reporting tools.

#### How to check the result in the system

**Body:** Activate the view in ADT and read the warnings: missing currency references and missing DCL roles show up there. For a DDIC-based view, check the generated SQL view in SE11 under the sqlViewName. Use the ADT data preview to confirm text, filter and value help behaviour, and compare results for a user with and without the relevant PFCG authorization to confirm the DCL role applies. For UI annotations, open the service in the Fiori elements preview of the service binding or check the OData $metadata document.

**Cta:** If you want your team to query these CDS views in plain English on your own servers, with the same DCL rules applied, Netray can set that up.

**Faq:**

#### What is an annotation in an ABAP CDS view?

**Answer:** An annotation is metadata written with @ before the view, an element or a parameter. Some change how the view is generated or checked (AbapCatalog, AccessControl), some describe meaning (Semantics, ObjectModel) and some are read by frameworks such as analytics, search or Fiori elements (Analytics, Search, UI, Consumption).

#### What are the values of @AccessControl.authorizationCheck?

**Answer:** The common values are #CHECK (a DCL role should restrict access), #NOT_REQUIRED (no role needed), #NOT_ALLOWED (roles are not allowed) and #PRIVILEGED_ONLY. With #CHECK and no role, the view is readable by everyone with a syntax warning.

#### Can I use @AbapCatalog.sqlViewName in a view entity?

**Answer:** No. DEFINE VIEW ENTITY creates no separate DDIC SQL view, so sqlViewName, preserveKey and ClientHandling annotations are not allowed. Remove them when you migrate a DDIC-based view to a view entity.

#### Why does my amount field show a currency error?

**Answer:** View entities require every CURR field to reference a currency key. Annotate the amount with @Semantics.amount.currencyCode: 'CurrencyField' and include that CUKY field in the select list. Quantities need @Semantics.quantity.unitOfMeasure the same way.

## Search terms

abap cds view annotations, annotations in abap cds views, abap cds view annotation, what is annotation in cds view in sap abap, cds view authorization check abap, accesscontrol.authorizationcheck values, cds semantics amount currencycode

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
