CDS Annotations Part 5: Troubleshooting Precedence, Metadata and UI Behavior
Find out why an annotation seems to be ignored: check the effective value, layer precedence, the exposed element, the OData metadata and caches — in a fixed order.
Explanation
📌 KEY POINTS
✅ First check the EFFECTIVE annotation (ADT Active Annotations), not the one you wrote.
✅ Then check the service: is the element exposed and the annotation in $metadata?
✅ Then check the client: caches and personalized variants.
⚠️ A higher-layer metadata extension silently overrides your change.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Parts 1–4 built annotations. When the Fiori app does not show what you annotated, the cause can be in five different places. This lesson gives the order to check them.
━━━━━━━━━━━━━━━━━━━━
▶ 1. IS THE ANNOTATION EFFECTIVE?
Open the view in ADT → context menu → Open With → Active Annotations. It shows, per element, the effective value and its origin (view, metadata extension layer, propagated).
Typical findings:
- Another metadata extension in a higher layer sets a different value.
- The view lacks @Metadata.allowExtensions: true, so your extension is ignored.
- The annotation is at the wrong scope or has a typo (e.g. selectionField without position).
- A propagated annotation from a lower view is winning because yours is not effective.
━━━━━━━━━━━━━━━━━━━━
▶ 2. IS IT ON THE RIGHT VIEW?
The service exposes the projection (ZC_), not the base view (ZR_). Annotations on ZR_ are only visible if propagated. UI annotations belong on the projection or its extension.
━━━━━━━━━━━━━━━━━━━━
▶ 3. IS THE ELEMENT EXPOSED?
- Is the field in the projection's element list?
- Is the entity exposed in the service definition?
- For facets pointing to child tables: is the association redirected and the child entity exposed?
- For value helps: is the value-help entity reachable?\n\n━━━━━━━━━━━━━━━━━━━━\n▶ 4. IS IT IN $METADATA?\nOpen the service's $metadata (…/$metadata) and search for the property or the vocabulary term (UI.LineItem, UI.SelectionFields, Common.ValueList, UI.Facets). If it is missing here, the problem is on the backend; if it is present, the problem is on the client.
━━━━━━━━━━━━━━━━━━━━
▶ 5. IS THE CLIENT SHOWING OLD METADATA?
- Fiori apps and the launchpad cache metadata. Reload with cache cleared, or use the preview in a private window.
- Gateway metadata cache: clear it (e.g. /IWFND/CACHE_CLEANUP on hub systems) when changes are not visible.
- User personalization: a saved variant can hide columns or filters — reset to the standard variant.
━━━━━━━━━━━━━━━━━━━━
▶ 6. BEHAVIOR VS LAYOUT
If a field is shown but not editable, or a button is disabled, it is usually not an annotation problem: check BDEF field characteristics, feature control and authorization.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
Use the checklist in the code example for every "annotation not working" ticket and note at which step you found the cause.
✅ CHECKPOINT: you can trace any annotation from source to screen. Next topic: RAP business objects and behavior.
Code example
// ===== Troubleshooting checklist: "my annotation is ignored" =====//// STEP 1 Effective value?// ADT: view -> Open With -> Active Annotations// -> origin: view | MDE layer (#CORE..#CUSTOMER) | propagated//// STEP 2 Right view?// Service exposes ZC_PurchReq -> annotate ZC_ (or its MDE), not ZR_//// STEP 3 Allowed & enabled?// ZC_PurchReq header: @Metadata.allowExtensions: true// MDE layer unique per view; no @Semantics/@AccessControl in the MDE//// STEP 4 Element / entity exposed?// field in projection element list?// entity in service definition? child association redirected?//// STEP 5 In $metadata?// GET /sap/opu/odata4/sap/zui_purchreq_o4/srvd/sap/zui_purchreq/0001/$metadata// search: UI.LineItem | UI.SelectionFields | UI.Facets | Common.ValueList// missing -> backend problem (steps 1-4)// present -> client problem (step 6)//// STEP 6 Client cache / variant?// reload with cache cleared / private window// reset personalized variant to "Standard"// clear gateway metadata cache if changes are not visible//// STEP 7 Not layout at all?// read-only field -> BDEF field ( readonly ) / feature control// disabled button -> instance feature control / authorization // ===== Example of a silent override =====// your MDE (#CUSTOMER): @UI.lineItem: [{ position: 10 }] Description;// view itself: @UI.hidden: true Description// -> @UI.hidden still hides the field: remove it from the view, or set// @UI.hidden: false in your MDEReal project scenario
A developer spent a day trying to make a new column appear. The annotation was correct in his metadata extension, and $metadata was even checked on the wrong service version. Following the checklist, Step 1 showed nothing wrong, Step 4 revealed that the field was missing from the projection element list — it existed only in the base view.
After adding the field to the projection, the column appeared. The team added the checklist to their wiki, and similar tickets were resolved in minutes afterwards.
Common mistakes
- Checking the annotation you wrote instead of the effective one.
- Annotating the base view instead of the exposed projection.
- Forgetting @Metadata.allowExtensions: true.
- Field or child entity not exposed in the projection or service.
- Not checking $metadata before blaming the UI.
- Cached metadata or personalized variants hiding the change.
- Treating editability or button state as an annotation problem.
Best practices
- Follow the checklist in order: effective → view → enabled → exposed → $metadata → client.
- Use ADT Active Annotations for every non-trivial case.
- Keep UI annotations only in projection metadata extensions.
- Test in a private window after changes.
- Document common causes in the team wiki.
Interview angle
Questions: "An annotation is not reflected in the Fiori app — how do you analyze it?", "What is annotation precedence?"
Strong answer: check the effective annotation with Active Annotations (layers, view, propagation), confirm it is on the exposed projection with allowExtensions, confirm the element and entity are exposed, check $metadata to split backend from client, then clear caches and reset variants. Distinguish layout issues from behavior (feature control, authorization). Precedence: MDE layers (CUSTOMER highest) over view annotations over propagated ones.
Practice this lesson
Quick check
1. After a refactor, an object page section disappeared although the facet still exists. What is the most likely cause?
2. Which statement about CDS annotation propagation is correct?
3. Three Fiori apps need different layouts for the same RAP business object. What is the best structure?
Interview questions
1. After transport to QAS, list columns and filters look different from DEV. What could cause it?
Answer it in your own words first, then compare.
2. A developer's new column annotation does not appear in the Fiori app. Give your troubleshooting order.
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- CDS Annotations Part 1: What Annotations Are and Where They Apply
- CDS Annotations Part 2: Semantic Annotations for Currency, Units and Texts
- CDS Annotations Part 3: Fiori UI Annotations — Line Items, Facets and Selection Fields
- CDS Annotations Part 4: Metadata Extensions — Separating UI from the Data Model