cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Grid filter does pattern searching how to avoid it doing pattern search

Former Member
0 Kudos

Hi All

In my web dynpro application I use a ALV grid to present the data from the database table. It works fine except when users click on the filter settings I have a column called Region.

The values in the table for region are values like CanadaEast, USEast, MexicoEast, East, West, MexicoWest ,etc

When the user puts a value for filtering at the top as East it seems to Show all records with values like CanadaEast, USEast, MexicoEast and also East. So appears the the filter seems to do pattern search and show all records containing East anywhere in the filter not just East .

Appreciate if any of you can share ideas how I can force the filter to bring only records with just East rather than showing all records with values like CanadaEast, USEast & MexicoEast.

Also are there any options to use in the filter search specification so I can avoid the pattern search but a exact search.

Thanks

Karen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If you want to have the exact match then user needs to give the filter criteria as =EAST or EAST something like this.

If this doesnot work then you need to have your own filter condition and retireval process.

The ALV is of type CL_SALV_WD_FIELD, in this there is a filter there is a GET_FILTER_RULE method which

returns CL_SALV_WD_FILTER_RULE. In this class, it has a operator GET_OPERATOR(SALV_WD_FILTER_OPERATOR). when

you check this for fixed values you can find relevant oeprators. Now try these operators then you can understand.

CP Contains string

NP Does Not Contain Pattern

But how to test these 2 cases needs to be known. I mean how to give the filter criteria for the above values.

For Ex:

You can test with these criteria

*EAST*

(star oneither sides of the string) then this returns all the ones that has 'EAST' in it which acts as 'CS' search.

Edited by: Lekha on Sep 30, 2009 7:16 PM

Edited by: Lekha on Sep 30, 2009 7:20 PM

Former Member
0 Kudos

Hi Lekha

Before I created the message I tried a few variants for search like =EAST or "EAST" or 'EAST' none of them seem to work.

Thanks

Karen

Former Member
0 Kudos

Hi,

Try giving

*EAST*

as search criteria then this works fine.

Former Member
0 Kudos

Hi Lekha

Tried EAST* that works

Thanks

Karen

Answers (0)