SAP RAP Tutorial : Implementing SAP RAP Search Help

In our last blog – SAP RAP Tutorial : SAP RAP Search Capabilities, we enabled a generic search capability in our list report. So in this blog we will learn implementing SAP RAP Search Help for our selection fields.

In SAP’s ABAP RESTful Application Programming Model (RAP), enhancing user experience with value helps (search helps) is a key feature—especially when building Fiori Elements applications. This blog walks you through how to implement search help using the @Consumption.valueHelpDefinition annotation in a RAP-based CDS view.

What is a Value Help?

A Value Help allows users to select values from a predefined list for input fields. It appears as a dropdown or F4 help in Fiori UIs, making data entry intuitive and error-free.

Why Use @Consumption.valueHelpDefinition?

The annotation @Consumption.valueHelpDefinition enables you to define a value help without needing an association. It directly references a CDS view that acts as the value help provider.

This is especially useful when:

  • You want to decouple the value help logic from the main entity.
  • You need dynamic filtering or custom logic in the value help provider.
  • You want to reuse the same value help across multiple entities.

Implementing SAP RAP Search Help

We will now create search help for lets say departure and destination airport selection.

For search help we need to use annotation @consumption.valuehelpdefinition.
But before that we need to understand the source from where this data will come.

For Airport Ids we have demo table /dmo/airport that contains all airport Ids. We will first create a view on top of this table.

SAP RAP value help,
@Consumption.valueHelpDefinition annotation,
SAP RAP search help,
CDS view value help SAP,
ABAP RAP Fiori dropdown,
SAP Fiori value help RAP,
SAP RAP tutorial,
SAP RAP CDS annotations
SAP RAP OData value help

Note the naming convention as this indicates this view is only for value help which can help you identify if you have to change some logic in value help view in a list of multiple views.

SAP RAP value help,
@Consumption.valueHelpDefinition annotation,
SAP RAP search help,
CDS view value help SAP,
ABAP RAP Fiori dropdown,
SAP Fiori value help RAP,
SAP RAP tutorial,
SAP RAP CDS annotations
SAP RAP OData value help

Now let us add search help to our selection fields in the main view.

SAP RAP value help,
@Consumption.valueHelpDefinition annotation,
SAP RAP search help,
CDS view value help SAP,
ABAP RAP Fiori dropdown,
SAP Fiori value help RAP,
SAP RAP tutorial,
SAP RAP CDS annotations
SAP RAP OData value help

Activate and refresh our application.

Search help is available now.

SAP RAP value help,
@Consumption.valueHelpDefinition annotation,
SAP RAP search help,
CDS view value help SAP,
ABAP RAP Fiori dropdown,
SAP Fiori value help RAP,
SAP RAP tutorial,
SAP RAP CDS annotations
SAP RAP OData value help

How to implement value help in SAP RAP
Using @Consumption.valueHelpDefinition in CDS views,
SAP RAP search help without association,
SAP RAP value help for Fiori Elements,
CDS view value help with @Consumption annotation
SAP RAP dynamic value help example,
SAP RAP value help binding tutorial

Let us do for destination airport also.

How to implement value help in SAP RAP
Using @Consumption.valueHelpDefinition in CDS views,
SAP RAP search help without association,
SAP RAP value help for Fiori Elements,
CDS view value help with @Consumption annotation
SAP RAP dynamic value help example,
SAP RAP value help binding tutorial

How to implement value help in SAP RAP
Using @Consumption.valueHelpDefinition in CDS views,
SAP RAP search help without association,
SAP RAP value help for Fiori Elements,
CDS view value help with @Consumption annotation
SAP RAP dynamic value help example,
SAP RAP value help binding tutorial

How to implement value help in SAP RAP
Using @Consumption.valueHelpDefinition in CDS views,
SAP RAP search help without association,
SAP RAP value help for Fiori Elements,
CDS view value help with @Consumption annotation
SAP RAP dynamic value help example,
SAP RAP value help binding tutorial

How to implement value help in SAP RAP
Using @Consumption.valueHelpDefinition in CDS views,
SAP RAP search help without association,
SAP RAP value help for Fiori Elements,
CDS view value help with @Consumption annotation
SAP RAP dynamic value help example,
SAP RAP value help binding tutorial

Now let us try to implement what we have already learned. The search capabilities to make the search help searchable.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

Include fuzziness also so that partial or typos are also searched.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

Now let us see our metadata to check how all these changes are impacting our metadata.

Go to service definition and click on service url.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

In browser at the end, we need to add $metadata.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

Here we can see our search help view is created as an entity type with key as airport id.

Also, sap:value-lists=’true’ means this is a value help view.

Now one more thing currently Destination and Departure airport ids are displayed but labels are Destination and Departure airport everywhere. We can do this change by doing label change at facet, line item and selection field labels. But instead of that we can do it directly from ABAP level annotations instead of UI level annotations. We will use annotation @EndUserText.label.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

This will change the label throughout the application.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

At Item level and facets also.

ABAP RESTful Application Programming Model,
SAP Fiori UI annotations,
CDS view search help,
SAP OData value help,
SAP RAP metadata extension,
SAP RAP best practices,
SAP RAP development guide

With this we have created a simple read only report with SAP RAP. I hope you enjoyed it and I hope to see you in our next blog where we will start designing a managed RAP application.

Do let me know if you find the blog and journey helpful.

Also Read – Understanding OData Services with Metadata

Leave a Comment

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