SAP RAP Tutorial : SAP RAP Search Capabilities

In our last blog SAP RAP Tutorial : Read Multiple Entities we have seen how to get data from multiple data sources and display them on our read only report. In this blog we take a step further and will check the SAP RAP search capabilities. We will add a search field in our report that will help us search full or part of what we want to search in the whole report.

In the ABAP RESTful Application Programming Model (RAP), search functionality is a cornerstone of user experience. SAP provides powerful annotations to fine-tune how data is searched and displayed in Fiori Elements apps. In this post, we’ll explore three key annotations:

  • @Search.searchable: true
  • @Search.defaultSearchElement: true
  • @Search.fuzzinessThreshold: <value>

These annotations help developers build intuitive, responsive, and intelligent search experiences.

1. @Search.searchable: true

Marks a field as searchable in the global search bar of a Fiori app.

Benefit:

  • Enables full-text search on the field.
  • Improves discoverability of records.

2.@Search.defaultSearchElement: true

Designates the field as the primary search target when multiple fields are searchable.

Benefit:

  • Prioritizes this field in search relevance.
  • Ideal for unique identifiers.

3.@Search.fuzzinessThreshold: <value>

Controls the tolerance level for fuzzy matching. This is especially useful when users make typos or partial matches.

What is Fuzziness?

Fuzziness allows approximate matching. For example, if a user types “Jon” instead of “John,” fuzzy search can still return relevant results.

  • Threshold Range: 0.0 (strict) to 1.0 (lenient)
  • Recommended: Start with 0.7 for balanced tolerance

Benefit:

  • Enhances user experience by forgiving minor input errors.
  • Useful in multilingual or typo-prone environments.

Adding SAP RAP Search Capabilities in Our Report

In our report we have two selection fields on our screen – Departure Airport and Destination Airport. Now let us try to add a generic search field with these fields.


To make our view searchable first we need to give annotation @search.searchable:true.

Now we need to indicate which fields to search or which fields can be searched when something is entered in our search field. For that we need to give @search.defaultSearchElement: true. Here we will try to make carrier id or airline id as searchable.

Activate and refresh our application.

Enabling Search for Associations

Now a search field is appearing. Also note because we have given search enabled to carrier id field it searches based on Ids and not the descriptions. If we also want to enable search for Destination airport or Departure airport we can do the same.

Now we will make the Airline Name as searchable but we first need to understand where it is coming from?

In our last blog we made the description to come from association _Airline. We need to make it searchable first.

Now the view also needs to be made searchable and we also need to indicate which fields are searchable the same way we did for main view.

Activate and refresh the application.

Now we are able to search with the airline name but only if we provide the full exact name. If we want to search for partial or typos we need to enable fuzziness in our search.

Activate and refresh our application.

Now we are able to search without the exact name.

Moving forward what if we want to search the data in facets from our main page ?

Let us take a look at our object page first.

We will try to search for plane type from our main page. This data is coming from our _Flight association . Repeat the same exercise.

  • Make the _Flights association searchable.
  • Make the view searchable
  • Indicate the field to search

Activate and refresh application

Now we are able to search from main page the plane type field.

We can add fuzziness as well.

By combining @Search.searchable, @Search.defaultSearchElement, and @Search.fuzzinessThreshold, you can build smarter, more user-friendly RAP applications. These annotations are not just technical tweaks—they’re UX enhancers that make your Fiori apps feel intuitive and responsive.

Also Read – SAP RAP Tutorial : Naming Conventions for Development Objects

Leave a Comment

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