alterno logo 2021-02

Search help on multi columns using table select dialog and OData

One of the most frequent challenges UI5 developers are facing is how to implement a Search Help with OData model on one hand but search and filter it’s results with same query string on many columns simultaneously.
When using JSON model multiple filtering with property  “and  :  false”  works perfectly fine because it is done on the client side,
but if we switch to OData the filtering is done on the ABAP back end which will immediately will drop your request with an error.

In this sample we declare a table select dialog, notice that two of its columns are Posid & Post1:

on the controller we will change the property “and” from “false” to “true” so that the ABAP back end won’t drop our request.

On back end our entity is connected to a real search help:

but for our mission to succeed we need to manipulate the generated ABAP code so the gateway will accept our request.

Here we redefine the GetEntitySet method to support our needs:

We will copy the original generated code and change it accordingly.
For example – we will loop on the selection criteria table to execute the search help per each iteration and collect the results.

Finally,
Our table select dialog search help searches same query simultaneously on both columns Posid & Post1:

Leave a Reply

Any questions?

Just write us a message!

Fill out the form and we will be in touch as soon as possible!