CDS Annotations

CDS: UI Annotations for Selection Filters and Report Layout

Annotations enrich the CDS views but can be confusing as well. These series of blogs have my simplified explanation.

If you are building a Fiori List Report, then you definitely need to use UI Annotations to mark your selection filters and report layout and they are very use to use.

For selection screen, you need to add above a column, the following annotations and if there are multiple selection filters, position value will determine the order. The lower position value appears first in the selection filter.


 @UI.selectionField: [{ position: 40 }]
field1,
 @UI.selectionField: [{ position: 30 }]
field2,

In this example, the field2 will appear first even though it is written below field1 in the selection filter list.

For the report layout, we use the following annotations:


 @UI.lineItem: [{ position: 60 }]

 @EndUserText.label: 'StorageBin'  
    StorageBin,
 @UI.lineItem: [{ position: 50 }]

 @EndUserText.label: 'Plant'  
    Werks,

Just like a field catalog in ALV grid program, we maintain the order and description for columns. The report appears in sequential order of the position in ascending order.

If the same field is shown in the report and used in the selection (as is the case generally), then you can add both the annotations.

UI has a long list of annotations just like a field catalog of the ALV grid and probably we will not use most of them so frequently but this will be surely used.

These annotations are used in Fiori Elements Apps and I guess you can ignore @UI.lineItem: and @UI.selectionField: if the apps is created using the UI5 programming.

Was this post helpful. Please let us know in the comment section. Please also let us know which annotations you want to understand better.

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Follow by Email
Twitter
LinkedIn
LinkedIn
Share