Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Case insensitive search

Former Member
0 Likes
718

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 ?

4 REPLIES 4
Read only

Former Member
0 Likes
643

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

Read only

Former Member
0 Likes
643

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

Read only

Former Member
0 Likes
643

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

Read only

athavanraja
Active Contributor
0 Likes
643

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