Post

CDS: Enable Global Search on Child Entity Fields in List Report

Learn how to extend the global search in a Fiori List Report to search child entity fields using @Search.defaultSearchElement on associations.

CDS: Enable Global Search on Child Entity Fields in List Report

By default, the global search in a Fiori List Report only searches root entity fields. You can extend it to search fields on child/associated entities too.

Step 1: Mark the Association in the Root Entity

1
2
3
" ZC_Travel — Root Entity
@Search.defaultSearchElement: true
_Booking;    " expose the association as searchable

Step 2: Mark Searchable Fields in the Child Entity

1
2
3
4
5
6
" ZC_Booking — Child Entity
@Search.defaultSearchElement: true
CarrierName;

@Search.defaultSearchElement: true
ConnectionId;

Full Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
" Root CDS Metadata Extension
annotate view ZC_Travel with
{
  @Search.defaultSearchElement: true
  TravelId;

  @Search.defaultSearchElement: true
  _Booking;
}

" Child CDS Metadata Extension
annotate view ZC_Booking with
{
  @Search.defaultSearchElement: true
  CarrierName;

  @Search.defaultSearchElement: true
  BookingId;
}

Result

When a user types in the global search bar of the Travel List Report, it searches across:

  • TravelId (root)
  • CarrierName (booking child)
  • BookingId (booking child)
1
2
@Search.fuzzinessThreshold: 0.8
CarrierName;

Values between 0 and 1 — higher = more strict matching. Add this to child entity fields for typo-tolerant search.

This post is licensed under CC BY 4.0 by the author.