⚙️SAPTools
CDS11 min read

SAP CDS Annotations Deep Dive: @UI, @OData, @Consumption

A practical walkthrough of the CDS annotation families that control Fiori Elements rendering, OData exposure, and consumption behavior — with real examples.

Published July 8, 2026

Advertisement

SAP CDS Annotations Deep Dive: @UI, @OData, @Consumption

CDS annotations are how a data model becomes a working Fiori app without writing any UI5 view code. Three families do most of the heavy lifting: @UI, @OData, and @Consumption.

@UI — Controls Fiori Elements Rendering

@UI annotations tell Fiori Elements which fields to show, where, and how.

define view entity ZI_Travel as select from ztravel
{
  key travel_id as TravelId,

  @UI.lineItem: [{ position: 10, label: 'Description' }]
  @UI.identification: [{ position: 10 }]
  description as Description,

  @UI.lineItem: [{ position: 20 }]
  @UI.selectionField: [{ position: 10 }]
  overall_status as OverallStatus,

  @UI.hidden: true
  created_by as CreatedBy
}
  • @UI.lineItem — shows the field as a column in the List Report table.
  • @UI.identification — shows the field in the Object Page header/facet.
  • @UI.selectionField — adds the field as a filter in the List Report's smart filter bar.
  • @UI.hidden — excludes the field from the UI entirely, without removing it from the OData entity.

@OData — Controls How the Entity Is Exposed

@OData annotations shape the OData service itself, independent of UI.

@OData.publish: true
define view entity ZI_Travel as select from ztravel
{
  key travel_id as TravelId,

  @OData.property.valueControl: 'CurrencyCodeVC'
  total_price as TotalPrice,

  currency_code as CurrencyCode,

  @OData.property.valueControl: '#HIDDEN'
  CurrencyCodeVC as CurrencyCodeVC,
}

@OData.property.valueControl is a common one for numeric fields tied to a currency or unit — it hides internal helper fields from the OData response while still using them to render the amount correctly (e.g. with the right decimal places).

@Consumption — Controls Value Help and Field Behavior

@Consumption annotations affect how a field behaves when consumed by an app, most often for value helps and filtering defaults.

@Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_Customer', element: 'CustomerId' } }]
customer_id as CustomerId,

@Consumption.filter.mandatory: true
company_code as CompanyCode,

@Consumption.valueHelpDefinition wires up an F4 value help against another CDS entity without needing a separate search help object. @Consumption.filter.mandatory forces the user to provide a value before the List Report will run a query — useful for large tables where an unfiltered SELECT would be too expensive.

Putting Them Together

These three families are not mutually exclusive — the same field commonly carries annotations from all three:

@UI.lineItem: [{ position: 30 }]
@UI.selectionField: [{ position: 20 }]
@Consumption.filter.mandatory: true
@OData.property.valueControl: 'CurrencyCodeVC'
total_price as TotalPrice,

Read top to bottom: it's a mandatory filter field (@Consumption), shown as both a List Report column and a filter bar entry (@UI), and its OData exposure carries a currency value-control hint (@OData).

Our CDS Annotation Reference documents each annotation family with more examples, and the Fiori Elements Feature Matrix maps annotations directly to the UI behavior they produce across List Report, Object Page, and Analytical floorplans.

Topics:

cds annotations@ui annotation@odata annotation@consumption annotationfiori elements cds