Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 3 of 5

Annotations for UI, analytics and semantics

10 min

Listen to this lesson

0:00 / 9:46

Annotations are metadata that start with @ and sit in front of a view, a field or an association. They do not change which rows the view returns. They tell frameworks and consumers what the data means and how to use it: that a field is an amount, that the view is an analytical cube, that a column should appear in a Fiori table. Learn the families and you can read almost any SAP view.

Header and technical@AbapCatalog, @AccessControl, @EndUserText, @Metadata, @ObjectModel.usageType
Semantics@Semantics.amount.currencyCode, @Semantics.quantity.unitOfMeasure, @ObjectModel.text.element
UI@UI.lineItem, @UI.selectionField, @UI.headerInfo, @UI.identification (often in metadata extensions)
Analytics@Analytics.dataCategory #CUBE or #DIMENSION, @Aggregation.default #SUM
Search and value help@Search.searchable, @Consumption.valueHelpDefinition
Annotation families and what each tells the frameworks.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-201

The header annotations in ADT’s template

SAP's ABAP Data Models guide explains the annotations in ADT's standard view entity template, and the defaults are deliberate. @AccessControl.authorizationCheck defaults to #NOT_REQUIRED, which makes access control optional. @EndUserText.label takes the description you enter. @Metadata.ignorePropagatedAnnotations: true switches off inherited annotations so higher-layer views stay stable when lower layers change; SAP warns that this can drop mandatory annotations such as currency references, which you must then set again. @AbapCatalog.viewEnhancementCategory defaults to #NONE, so the view cannot be extended unless you allow it. The @ObjectModel.usageType annotations (service quality, size category, data class) tell consumers how expensive the view is to call.

Switching off propagated annotations keeps upper layers stable, but mandatory ones such as a currency reference must then be declared again.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-201
Annotation (template default)What it controlsWhat to check in review
@AccessControl.authorizationCheck (#NOT_REQUIRED)Whether CDS access control is mandatory, optional or not allowedBusiness data views should normally be protected
@Metadata.ignorePropagatedAnnotations (true)Whether annotations from lower views are inheritedCurrency and unit references are still present
@AbapCatalog.viewEnhancementCategory (#NONE)Whether the view can be extendedSet deliberately if partners or key users must extend
@ObjectModel.usageType.sizeCategory (#S)Expected data volumeMatches reality: core return items are not small at year-end

Header annotations from ADT’s template, as SAP documents them, with review prompts.

Semantics and UI

Semantic annotations make fields behave correctly everywhere. Contoso's TotalDeposit is annotated with @Semantics.amount.currencyCode: 'Currency', so every consumer formats it with the right decimals for USD or MXN. A text association plus @ObjectModel.text.element lets a UI show "Great Lakes Fleet Services" next to the customer number. UI annotations such as @UI.lineItem and @UI.selectionField tell a Fiori elements app which columns and filters to show. SAP's RAP guide recommends putting UI annotations in a metadata extension, a separate object with the same name as the view, so the data model stays clean; the view needs @Metadata.allowExtensions: true for that.

  1. Basic viewSemantic annotations: amounts, units, texts
  2. Consumption viewZC_CMC_OpenCoreDeposits with @Metadata.allowExtensions: true
  3. Metadata extension@UI.lineItem for Agreement, Customer, TotalDeposit, ValidTo; @UI.selectionField for Customer
  4. ServiceThe view is exposed through a service definition and binding
  5. Fiori elements listColumns and filters appear without UI code
How annotations become a Fiori list for Maria’s team.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-201

Two more families save a lot of UI work. @Consumption.valueHelpDefinition attaches a value help to a field, for example a customer search on the agreement's Customer field that reads a released customer view, so users pick valid values instead of typing numbers. @Search.searchable with fuzzy search settings on chosen fields gives the list a free-text search box. Both are cheap to add and easy to test: the value help offers only valid customers, and searching "Great Lakes" finds Great Lakes Fleet Services.

Analytics

For analytical apps, a view declares its role. @Analytics.dataCategory: #CUBE marks a fact view with measures, #DIMENSION marks master data such as customers, and @Aggregation.default: #SUM tells the analytical engine how to total a measure. Contoso's finance process owner Dan wants open deposits by customer and month; a small cube over the item view, with the customer as a dimension, gives him that without a custom report. Analytical queries built on cubes are covered in SAP's ABAP Analytics guide.

A cube supplies the summed measure and a dimension supplies the customer, which is all Dan’s analysis needs.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-201

What would you do?

After Kenji's team sets @Metadata.ignorePropagatedAnnotations to true on the consumption view, activation fails with an error about the TotalDeposit field. What is the most likely cause?

Key points
  • Annotations add meaning; they do not change which rows a view returns.
  • ADT’s template sets authorizationCheck #NOT_REQUIRED, ignorePropagatedAnnotations true and viewEnhancementCategory #NONE.
  • Amounts and quantities need currency and unit references through @Semantics annotations.
  • Put UI annotations in metadata extensions; allow them with @Metadata.allowExtensions: true.
  • @Analytics.dataCategory marks cubes and dimensions for analytical apps.

Check your understanding · not graded

Lesson check

  1. 1. What is the default value of @AccessControl.authorizationCheck in ADT’s view entity template?

  2. 2. Where does SAP recommend placing UI annotations such as @UI.lineItem?

  3. 3. Which annotation marks a view as an analytical fact view with measures?

  4. 4. Why might activation fail after setting @Metadata.ignorePropagatedAnnotations to true?