cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering with SearchTerm

0 Kudos

Hi all.

I need to adapt coding to a existing Fiori App. This App has the search functionality that of course should be implemented.

Debbuging the ABAP code I can see content of IV_FILTER_STRING with value ( SearchTerm eq 'Hello World' ). URL sent by the browser is :

https://host/sap/opu/odata/sap/TEST_SRV/EntitySet?$skip=0&$top=20&$filter=SearchTerm%20eq%20%27dtbes...

In the search box I just typed 'dtbes'.

Is there any class/method to directly filter et_entityset with those entries that contain word 'dtbes'?

Your help is much appreciated.

Iñigo.

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Garcia,

In the Get_Entity_Set method of the Data Provider Class you can read all the filter parameters and then can be sent to your backend logic as input to fetch the matching records.

There would be already code written to read filter parameters in Get_Entity_Set method. Please check.

If not below will help ->

$filter System Query Option APIs - SAP NetWeaver Gateway - SAP Library

You need to have the logic written inside Get_Entity_Set method of your Data Provider Class which filters data by taking inputs from the application.

Regards,

Ashwin

Answers (1)

Answers (1)

former_member184867
Active Contributor
0 Kudos

No, there is no utility class to do it for you.

However in your GET_ENTITYSET method, you have a parameter IT_FILTER_SELECT_OPTIONS. This gives you the corresponding select options for your filter property.

Here you get SELECT OPTIONS for every filter property. You can make use of this SELECT OPTION table to easily filter the data.

sample code would look like....


DATA: ls_filter_select_option TYPE /iwbep/s_mgw_select_option .

     READ TABLE it_filter_select_options INTO ls_filter_select_option

     WITH KEY property = '<PROPERTY NAME>'.




"Populate ET_ENTITYSET

..........

.................


DELETE et_entityset  WHERE <PROPERTY NAME> NOT IN ls_filter_select_option-select_options.



0 Kudos

Thanks for your help.

I basically sorted out with abap coding. Just adding ranges with option equal to 'CP' and always adding * before and after. Search is done in all fields possible.

Thanks anyway!