CDS Annotations Part 3: Fiori UI Annotations — Line Items, Facets and Selection Fields
Preview · a free account unlocks the full lesson
Build a complete Fiori Elements list report and object page with UI annotations: header info, line items, selection fields, identification, facets, field groups, actions and value helps.
In this lessonShow sectionsHide sections
Visual overview
Explanation
@UI.lineItem drives the list columns, @UI.selectionField drives the filter bar, and @UI.headerInfo supplies the object's title. On the object page, @UI.facet defines the sections, pointing to @UI.identification or @UI.fieldGroup for their content. Actions become buttons through @UI.lineItem or @UI.identification entries with type #FOR_ACTION, and value helps come from @Consumption.valueHelpDefinition placed on the field.
Part 2 made the underlying data meaningful; this part is about describing the screen itself. Fiori Elements generates both the list report and the object page entirely from these annotations, with no UI5 code required.
For the list report, @UI.headerInfo at the entity level supplies a typeName ('Purchase Request'), a typeNamePlural, a title — the field shown as the object's title — and a description. @UI.lineItem, written as something like [{ position: 10, importance: #HIGH }], defines a column in the table: position controls the column order, and importance decides what stays visible on small screens. @UI.selectionField, written as [{ position: 10 }], adds a field to the filter bar. @UI.hidden: true keeps technical fields like UUIDs from ever being shown.
The object page is built entirely from facets. @UI.facet placed on one element, usually the key, lists out the page's sections, each described with something like { id: 'General', purpose: #STANDARD, type: #IDENTIFICATION_REFERENCE, label: 'General', position: 10 }. A facet of type #IDENTIFICATION_REFERENCE shows all fields carrying @UI.identification.
A facet of type #FIELDGROUP_REFERENCE with a targetQualifier shows fields carrying a matching @UI.fieldGroup, such as [{ qualifier: 'Amounts', position: 10 }]. A facet of type #LINEITEM_REFERENCE with targetElement: '_Item' shows a table of child entities, driven by their own @UI.lineItem annotations. And a facet with purpose #HEADER puts data points or field groups directly into the page header.
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.