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

Making search non case sensitive

Former Member
0 Likes
1,101

hi,

I am using the following statement :

SELECT fname 
             FROM z3af_hcp INTO TABLE lt_select_list
                WHERE fname LIKE lv_first_name.

lv_first_name is a variable which contains value something like a%, ab%, A%.

I want a search criteria which is not case sensitive. Plz suggest.

Regards

Pankaj Aggarwal

hi,

I am using the following statement :

SELECT fname 
             FROM z3af_hcp INTO TABLE lt_select_list
                WHERE fname LIKE lv_first_name.

lv_first_name is a variable which contains value something like a%, ab%, A%.

I want a search criteria which is not case sensitive. Plz suggest.

Regards

Pankaj Aggarwal

8 REPLIES 8
Read only

Former Member
0 Likes
1,042

firstly dat is dependent upon the domain of the data element.

there is a check box in the domain in the domain which when clicked enables the field as case sensitive.

as i can see u are using a ztable u can very well use a domain of ur choice to make the domain not case sensitive if it case sensitive now.

and if it is not case sensitive then what ever u pass in that variable it will automatically be considered as non case sensitive..

Edited by: soumya prakash mishra on May 29, 2009 12:58 PM

Read only

0 Likes
1,042

Hi,

i can not change domain or table .

Read only

Former Member
0 Likes
1,042

hi,

You can use 'CA' comparision operator.

Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands.

sample code for your reference.

data:begin of itab OCCURS 0,

matnr type makt-matnr,

maktx type makt-maktx,

end of itab.

select matnr maktx

into table itab

from makt.

loop at itab where maktx ca 'A'.

write 😕 itab-matnr, itab-maktx.

endloop.

hope this solves your issue.

Read only

0 Likes
1,042

is the domain case sensitive? please check and let us know first.

in general fname is of domain type : FDNAME

which is not case sensitive... so no need to worry about case as for me

Edited by: soumya prakash mishra on May 29, 2009 1:11 PM

Read only

0 Likes
1,042

domain is case sensitive...

plz suggest what i can use except like...

Read only

0 Likes
1,042

hi,

Either remove the tick of case sensitive from domain or can use the sample code given above.

Read only

matt
Active Contributor
0 Likes
1,042

It is NOT POSSIBLE in opensql to have non-case sensitive selects. Where SAP have provided functionality that looks like this, they've added a field for searching, which has the contents of the desired fields, in UPPER CASE.

You must add a field to z3af_hcp, e.g. fname_upper, which contains the values in fname but in upper case. You must make sure it is populated.

Then you can use:

TRANSLATE lv_first_name TO UPPER-CASE.
SELECT fname 
             FROM z3af_hcp INTO TABLE lt_select_list
                WHERE fname_upper LIKE lv_first_name.

matt

Edited by: Matt on May 29, 2009 2:09 PM

Read only

Former Member
0 Likes
1,042

Depending on your database, you can use native SQL to achieve this directly.

Rob