ERPClimb logoERPClimb
CDS Annotations
RAP / CDS / ODataintermediate 8 min read

CDS Annotations Part 5: Troubleshooting Precedence, Metadata and UI Behavior

Preview · a free account unlocks the full lesson

Key takeaway

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.

In this lessonShow sections

Visual overview

CDS Annotations Part 5: Troubleshooting Precedence, Metadata and UI Behavior — learning sheetIn one line: 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.ERPClimb.com / RAP / LESSON 5/5 / LEARNING SHEETCDS Annotations Part 5: Troubleshooting Precedence,Metadata and UI Behavior1 · IN ONE LINEFind 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.2 · KEY IDEAS EXPLAINEDIs The Annotation Effective?Another metadata extension in a higher layer setsa different value.The view lacks @Metadata.allowExtensions: true, soyour extension is ignored.Is It On The Right View?The service exposes the projection (ZC_), not thebase view (ZR_). Annotations on ZR_ are onlyvisible if propagated. UI annotations belong on…Is The Element Exposed?Is the field in the projection's element list?Is the entity exposed in the service definition?Is It In $Metadata?Open the service's $metadata (…/$metadata) andsearch for the property or the vocabulary term(UI.LineItem, UI.SelectionFields…3 · DO · AVOIDBest practice!Common mistakeFollow the checklist in order: effective →view → enabled → exposed → $metadata → client.Use ADT Active Annotations for everynon-trivial case.Keep UI annotations only in projectionmetadata extensions.✕Checking the annotation you wrote instead ofthe effective one.✕Annotating the base view instead of theexposed projection.✕Forgetting @Metadata.allowExtensions: true.4 · IN A REAL PROJECTA developer spent a day trying to make a new column appear. The annotation was correct in his metadataextension, and $metadata was even checked on the wrong service version. Following the checklist, Step 1 showednothing wrong, Step 4 revealed that the field was missing from the projection element list — it existed only…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 1 through 4 built up annotations. When the Fiori app doesn't show what was actually annotated, the cause can be in any of five different places, and this lesson gives the order in which to check them.

The first question is whether the annotation is even effective. Opening the view in ADT, using the context menu, Open With, Active Annotations, shows the effective value per element along with its origin — the view itself, a metadata extension layer, or propagation from elsewhere.

Typical findings here are that another metadata extension in a higher layer sets a different value, that the view lacks @Metadata.allowExtensions: true so the extension gets ignored entirely, that the annotation sits at the wrong scope or has a typo (such as selectionField without a position), or that a propagated annotation from a lower view wins simply because the intended one was never effective.

The second question is whether the annotation is on the right view. The service exposes the projection (ZC_), not the base view (ZR_), so annotations placed on ZR_ are only visible if they propagate up. UI annotations belong on the projection or its metadata extension.

Free account

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

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.