Tiven Wang
Wang Tiven September 26, 2019
425 favorite favorites
bookmark bookmark
share share



This is implemented using specific CDS annotations, which you – as a Fiori app developer – add to the source code of the respective CDS view.

A CDS annotation (in short: annotation) adds metadata to the view that expands the syntax options of SQL.

In this development scenario, you will use different types of CDS annotations:

  • Core annotations - can be specified in the source code of any ABAP CDS object and are evaluated by ABAP runtime environment.

  • UI annotations - allow you to focus OData UI vocabulary on usage patterns of data in UIs representing certain semantic views of business data. The UI annotations used are evaluated by the SADL framework, which means that SADL translates CDS annotations into the corresponding OData annotations.

  • Search annotations - allow you to define search fields as filters or . The annotations used are also evaluated by the SADL framework.

  • Analytics annotations - provide data elements with aggregation behaviour in analytical scenarios.

Enabling Variant Management

Variants allow you to store settings that users create for the smart filter bar, such as selection fields and layout, and for the smart table, such as sorting and visible columns.

"sap.ui.generic.app": {
  "pages": [
      "entitySet": "XXXXXX_Product",
      "component": {
        "name": "sap.suite.ui.generic.template.ListReport",
        "list": true,
        "settings" : {
          "gridTable" : false,
          "multiSelect": false,
          "smartVariantManagement": true

Smart Filter Bar

使用 Selection Fields 注解为 com.sap.vocabularies.UI.v1.SelectionFields 为 Smart Filter Bar 增加 Filter 字段。

Smart Filter Bar

ABAP CDS - Consumption Annotations

Value Help as a Dropdown List

If your value help contains a fixed number of values, a dropdown list will be rendered.

可以通过 metadata 里的 Property 的 sap:semantics='fixed-values' 来控制。

Value Help Multiple Selections

多选和单选可以通过 metadata 里的 Property 的 sap:filter-restriction="single-value" 来控制。

涉及到 ABAP CDS Annotations @Consumption.filter.multipleSelections@Consumption.filter.selectionType

Settings for List Report Tables

如果要决定 EntitySet 的字段有哪些需要在 List Report 的 Table 上显示, 可以用 Annotation com.sap.vocabularies.UI.v1.LineItem 来定义.

<Annotation Term="UI.LineItem">
      <PropertyValue Property="Value" Path="Product"/>
      <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
      <PropertyValue Property="Value" Path="ProductCategory"/>
      <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
      <PropertyValue Property="Value" Path="Supplier"/>
      <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>

CDS Annotation - @UI.lineItem

Columns - Defining CDS Annotations for Metadata-Driven UIs

Similar Posts


Back to Top