Where can UI annotations live, and which one wins when the same annotation exists in several places?
Say your answer out loud first.
Practise another way
Three places: in the CDS projection view itself, in a CDS metadata extension that annotates the view, and in a local annotation file in the Fiori app. SAP's tutorials put UI annotations in metadata extensions to keep the view readable.
Metadata extensions have layers, so a customer or partner can override SAP's without touching the original. A local annotation file in the app is the last resort for app-specific tweaks, and it is merged on the UI side.
The principle: keep UI concerns out of the data model, and keep each annotation where its owner can change it.
1. In the CDS view
You can write @UI annotations directly in the projection view, and some non-UI ones always belong there: @ObjectModel.text.element, @Consumption.valueHelpDefinition, @Search, @EndUserText.label and @ObjectModel.semanticKey. The SAP tutorials keep these data-bound annotations in the projection view.
2. In a metadata extension (MDE)
A metadata extension annotates an existing CDS view without changing it:
@Metadata.layer: #CORE
annotate view ZC_Travel with
{
@UI.lineItem: [{ position: 10 }]
TravelID;
}
SAP's tutorial states that UI annotations are stored in metadata extension files so the CDS structure stays readable. The layer controls precedence. A higher layer, such as customer, overrides a lower one such as core, which is how a customer changes a delivered UI without modification.
The view must allow it (extensions are enabled for CDS views by annotation on the view in standard use; check the view's release and extensibility settings).
3. Local annotation file in the Fiori project
Fiori tools generate an annotation file in the app (webapp/annotations). These annotations are merged with the service ones in the browser, and the local file is applied last.
Use it for annotations that only one app needs, or when you do not own the back end.
Which wins
- Within the back end: the metadata extension layer order decides.
- Between back end and app: the local annotation file is applied on top of what the service delivers.
- To be sure, open $metadata or the generated annotation view and look at the effective result.
Practice guidance
- A UI that should look the same in every app: back-end MDE.
- A single app with a special layout: local annotation, or better a manifest setting.
- Avoid duplicating the same term in both; debugging 'which one is it' costs hours.
- Extension of an SAP-delivered app: use an MDE in the customer layer on a released view, or an adaptation project, rather than modifying the SAP object.
Interview point: mention the $metadata check. Many UI bugs are an annotation that never reached the service.
Names projection view, metadata extension and local annotation file, explains layers and merge order, and says to verify the effective result in $metadata.
Says 'annotations go in the CDS view' and has no answer for overriding SAP-delivered annotations.
Putting every annotation, including the same term, in both the MDE and a local annotation file, then not knowing which one the UI is using.
- How do you change a delivered SAP list report column without modifying SAP code?
- Why keep value help annotations in the projection view and not the metadata extension?
- Annotation is correct in the MDE but not in $metadata. What do you check?
3 official pages. Confidence: medium. Checked 21 Nov 2026.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.