CDS Views Part 7: Annotations for Semantics, Texts, Search and UI
Preview · a free account unlocks the full lesson
Use CDS annotations to give data meaning: currency and unit semantics, text views and text associations, language-dependent descriptions, search annotations, UI annotations for Fiori elements, and metadata extensions that keep UI layout out of the data model.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 5 introduced consumption views; now we make them meaningful for Fiori, search, and value helps. Annotations — written as @Namespace.annotation: value and placed before a view or before a field — add metadata that the database itself mostly ignores, but that frameworks like OData, Fiori elements, analytics, and search actively read.
Common namespaces include EndUserText, Semantics, ObjectModel, Search, UI, Consumption, Analytics, AccessControl, and VDM, and ADT's code completion (Ctrl+Space) will show which annotations are valid in a given scope.
It's worth noting that annotations have distinct scopes — view level, element level, parameter level — and a misspelled or misplaced annotation often produces only a warning, with the app then silently ignoring it.
Semantic annotations describe what a field actually is, independent of how it's displayed: @Semantics.amount.currencyCode: 'CurrencyField' pairs an amount with its currency, @Semantics.quantity.unitOfMeasure: 'UnitField' pairs a quantity with its unit, @Semantics.language: true and @Semantics.text: true mark fields in text views, and @EndUserText.label / quickInfo supply the field labels shown in apps.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.