Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2009 at 01:34 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.