Subject: SAP-Fiori-Elements | SAP Field
The Smart Filter Bar (SFB) is one of the most powerful and essential UI components in SAP Fiori Elements applications. It provides end users with a flexible, user-friendly way to filter and search data in List Report and Analytical List Page apps, improving the overall usability and efficiency of SAP Fiori apps.
In this article, we explore the capabilities, configuration, and best practices for using the Smart Filter Bar in SAP Fiori Elements.
The Smart Filter Bar is an SAPUI5 control designed to automatically generate filter fields based on metadata annotations from CDS views or OData services. It allows users to input filter criteria, execute searches, and dynamically narrow down large datasets.
Key features include:
In SAP Fiori Elements apps, the Smart Filter Bar is automatically included in List Report and Analytical List Page templates. It reads the annotations in the underlying CDS views or OData services to create corresponding filter fields.
For example, the annotation @UI.selectionField on a CDS entity property signals that this field should be included in the filter bar.
Proper use of these annotations ensures that the Smart Filter Bar renders appropriate filter options automatically.
While SAP Fiori Elements handles most of the filter bar configuration, developers can customize it as needed:
Developers can adjust filter bar behavior in the manifest.json under the settings section of the List Report:
"settings": {
"filterBar": {
"search": {
"visible": true
},
"basicSearchField": "SearchTerm"
}
}
You can add custom filter fields using annotations or programmatically via controller extensions:
@UI.selectionField with position attribute to order filters.ext folder controller extensions.For advanced scenarios, developers can implement custom filter validation and handling by extending the filter bar controller and reacting to filter events.
position annotation to prioritize important filters.@UI.selectionField and @Consumption.filterable.@Common.valueList annotations or implement custom value helps.The Smart Filter Bar is a cornerstone of SAP Fiori Elements applications, delivering a dynamic and intuitive filtering experience. By properly leveraging metadata annotations and customizing where needed, SAP developers can create powerful, user-friendly apps that allow users to quickly find relevant information with minimal effort.
As SAP continues to enhance the Fiori Elements framework, mastering the Smart Filter Bar remains essential for building efficient SAP UI solutions that boost productivity and user satisfaction.