ERPClimb logoERPClimb
Service Bindings
RAP / CDS / ODataintermediate 15 min read

Service Bindings Part 6: Preview, $metadata and Fiori Elements Annotations

Preview · a free account unlocks the full lesson

Key takeaway

Turn the published service into a real Fiori Elements app: add UI annotations in metadata extensions, verify them in the binding preview, read $metadata to see exactly what the UI receives, and generate and deploy the app.

In this lessonShow sections

Explanation

Preview renders a Fiori Elements app directly from your annotations, so UI annotations belong in the metadata extensions of the projection rather than in hand-written screens. The $metadata document shows exactly what consumers receive, and if a field is missing in the UI the first thing to check is the @UI annotations, not the code.

At this point in the series the Purchase Request service is published and tested (Parts 2-5): the preview works but looks empty and generic. This part is about describing the screens with annotations, checking them in preview, and understanding how Fiori Elements turns metadata into UI.

Fiori Elements has no hand-written screens of its own. It reads the service's $metadata — entity types, keys, navigation, actions and UI annotations — and generates standard floorplans: a List Report (search plus table) and an Object Page (header, sections, item table). What you see in the app is therefore a direct function of the annotations you publish, so when something is missing on screen the annotations are the place to look.

UI annotations live in a metadata extension (DDLX) on the projection view, never in the CDS view itself and never on the ZR_ base views. For this to work, the projection must allow extensions through @Metadata.allowExtensions: true (added back in Managed RAP Part 5). You create one metadata extension per projection entity — here, ZC_PurchReq and ZC_PurchReqItem — and mark your own development with @Metadata.layer: #CORE. This separation keeps the data model clean and lets UI and API projections differ from each other.

A complete app needs several annotation types. @UI.headerInfo supplies the object's name, plural name and title field for the Object Page header. @UI.selectionField defines the filter fields shown in the List Report's filter bar. @UI.lineItem controls the table columns in the List Report and in the Items table on the Object Page, and is also where action buttons are placed above the table using type #FOR_ACTION. @UI.facet defines the sections of the Object Page — for example a "General" section with the identification fields and an "Items" section showing the item table through the _Item association. @UI.identification places fields in the "General" section and adds action buttons to the Object Page header. @UI.hidden hides technical fields such as UUIDs.

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

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

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.