ERPClimb logoERPClimb

Code examples · CDS views · Intermediate

CDS value help and search annotations for Fiori elements

The problem

When entering a leave request, users must pick the employee from a searchable list, by id or by name, instead of typing a number by heart.

How we solve it

  1. 1Employee tableZEMPLOYEE_D
  2. 2Fill with dataconsole class
  3. 3Value help viewZI_EmployeeVH
  4. 4Connect the fieldannotation

The result

The Employee field shows a value help icon that opens a searchable dialog and fills the field with the chosen id.

Overview drawn by ERPClimb from this example. The steps are the same as in the code below.

1. The requirement

When entering a leave request, users must pick the employee from a searchable list, by id or by name, instead of typing a number by heart.

2. How we design it

A value help is a normal CDS view that lists the allowed values. We mark it searchable, then point the input field to it with one annotation. Fiori elements builds the value help dialog from that, including the search field.

Why we decided it this way

  1. 1A dedicated value help viewIt can be reused by every field that holds an employee id.
  2. 2Search annotations on id and nameUsers can find an employee by typing a part of the name.
  3. 3Annotation in the metadata extensionUI and value help wiring stay out of the data model views.

Before you start

  • The Leave Request projection and metadata extension from the managed RAP example.
  • A small table of employees (definition in step 1).

3. The code, step by step

Step 1 of 4: Create the employee table

A tiny table with an id and a name, enough for the value help.

CDS · Dictionary table · ZEMPLOYEE_D
// Table definition
@EndUserText.label : 'Demo employee'
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zemployee_d {
  key client      : abap.clnt not null;
  key employee_id : abap.numc(8) not null;
  name            : abap.char(40);
}
Part by part (plain text)
  1. Table definition. Client, employee id as key, and a name. Fill it with a few rows using a small console class (INSERT ... FROM TABLE).

Open in the portal

The SAP objects named in this code are linked in the code above and listed here. Each opens its page in the SAP Library.

4. The final outcome

The Employee field shows a value help icon that opens a searchable dialog and fills the field with the chosen id.

What you should see

Click the value help icon at Employee: a dialog with a search field and a list appears. Type part of a name: the list narrows. Select a row: the Employee field receives the id.

Try it and check the result

  • Run the class ZCL_EMPLOYEE_SEED with F9. The console says 3 employees written.
  • Activate the view and the metadata extension, then reload the Fiori preview.
  • Open the value help and type part of a name: the list narrows and the selected id fills the field.

Common mistakes

  • Annotation on the wrong layer: if the metadata extension and the projection disagree, the icon does not appear. Check the projection field name.
  • No @Search.searchable on the view: the dialog opens but has no working search.
  • You do not list the value help view in the service definition; it is exposed automatically with the view that references it. If the dialog stays empty, check the entity and element names in the annotation.

Keep learning

Checking status: Reviewed line by line against SAP documentation. Not executed on a live system. Reviewed 2026-11-25. Release: ABAP CDS and Fiori elements OData V4 (RAP). Check on your release.

Original ERPClimb teaching code with illustrative names. Not taken from a customer system. Syntax can differ by release; check the references below and activate in a sandbox first. ERPClimb is independent of SAP SE.