Value Help in SAP RAP

Value Help in SAP RAP

SAP RAP

You are working on a Billing Document application where a new billing document is created for a specific customer. Each time a document is created, the user must enter the Customer ID manually.

But honestly, who remembers customer IDs?

What if the user could simply:

  • search by customer name

  • see a list of customers

  • and select the correct one?

In SAP RAP, this can be achieved very easily using the @Consumption.valueHelpDefinition annotation.


The annotation for value help

The basic syntax looks like this:

@Consumption.valueHelpDefinition: [{
  entity: {
    name: 'entityRef',
    element: 'elementRef'
  }
}]

Here we tell RAP:

  • which CDS entity should act as value help

  • which field of that entity provides the values


Adding value help to CustomerId field

Open the Metadata Extension of the Billing Document Header and add the annotation on top of the CustomerId element.

@Consumption.valueHelpDefinition: [
  { entity: { name: '/DMO/I_Customer', element: 'CustomerID' } }
]
CustomerId;

System specific note

  • If you are on BTP ABAP Trial, you can use the standard entity /DMO/I_Customer

  • If you are on S/4HANA, replace it with I_Customer


value help in sap rap


Result on the UI

Once this annotation is active, a value help icon automatically appears next to the Customer field.

When the user clicks it, the system shows:

  • list of customers

  • search option

  • selection dialog

No more need to remember IDs.

value help results


More powerful @Consumption options

The annotation @Consumption is very rich and offers many additional capabilities.

Some useful ones to explore:

@Consumption.filter.mandatory: true

Makes the field mandatory in filter scenarios.

@Consumption.filter.multipleSelections: true

Allows selecting multiple values.

@Consumption.filter.selectionType

Controls how selection should behave.

Dependent value help

You can also build dependent value helps using attributes:

  • additionalBinding

  • useForValidation

of the annotation @Consumption.valueHelpDefinition.

This allows scenarios like:

  • Show materials only for selected customer

  • Show plants only for selected company code


What we achieved

With just one annotation, we:

  • improved user experience

  • removed dependency on remembering technical IDs

  • enabled search by meaningful fields

  • added standard Fiori value help behavior