2007 Mar 13 7:42 AM
In a database table i have a field which is can contain both upper and lower case chars..
I need to do a case insensitve pattern search.
for e,g. ig the column values are
Abc, ABC, ABc.....
and if the user enters abc he should be returned all rows that contain the
chars "abc" irrespective of their case.
Is there a method to tackle this using Ranges ?
In a database table i have a field which is can contain both upper and lower case chars..
I need to do a case insensitve pattern search.
for e,g. ig the column values are
Abc, ABC, ABc.....
and if the user enters abc he should be returned all rows that contain the
chars "abc" irrespective of their case.
Is there a method to tackle this using Ranges ?
2007 Mar 13 7:46 AM
Method 1:
... IGNORING CASE.
You can use FIND stmt with ignoring case option.
Example
DATA:
c TYPE STRING,
p(2) TYPE C.
c = 'Everyone knows this'.
p = 'NO'.
FIND p IN c IGNORING CASE.
After the search, sy-subrc = 0.
Methode 2:
You can convert both the comparing strings into single case, either Lower case or Uppper case using TRANSLATE c TO LOWER CASE.
TRANSLATE c TO UPPER CASE.
Regards,
Vishnu priya
Message was edited by:
Vishnu priya
2007 Mar 13 7:53 AM
tables: pa0001.
data: v_ename like pa0001-ename.
start-of-selection.
select single ename into v_ename from pa0001 where
ename like '%a'.
note: this will be case sensitive
2007 Mar 13 8:11 AM
Hi gerson,
In general the will be another field in the same database table which contains the value ALL IN UPPERCASE letters. You can then use the select-option like this.
select-options: s_search for <table>-field>.
Let the user enter in whichever case he likes.The select-option automatically converts it into uppercase.
Then you can use the select-option in the select statement:
select * from <table> into table <internal table>
where <field> in s_search.
Regards,
Ravi
2007 Mar 13 8:15 AM
Is there a method to tackle this using Ranges
no unless otherwise as Ravi mentioned, if there is a field with the same value in all upper cases.
else. you have to dump all the enteries into a temp table convert those fields to upper case and then do a filter
Raja
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |