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

Using LIKE in Select query

Former Member
0 Likes
1,045

Hi experts,

I am writing a Function module to get data from a table.

Import :

desc TYPE ZTABLE-DESCRIPTION.

-


Now when desc = te*

REPLACE ALL OCCURRENCES OF '*' IN

desc WITH '%' .

SELECT *

FROM ZTABLE

INTO CORRESPONDING FIELDS OF TABLE t_list WHERE DESCRIPTION LIKE desc.

-


.. With is the table fetches all records where description starts with " te " .. here te is case senstive

So if description is "Test " or " TEST " or "tE" ......... so on.. i want this like to be made case in sensitive

Coz user can search as per his/her way...

Regards,

Bijal

8 REPLIES 8
Read only

Former Member
0 Likes
943

Hello,

Better you select Lowecase option is the domain of the DESCRIPTION field then u can fetch the data from Ztable.

Read only

former_member156446
Active Contributor
0 Likes
943

using translate to upper case should help.

or you can populate a range table/ select options kind of table and so_vlaue-low = te% so_vlaue-high = TE%

Read only

0 Likes
943

Hi jay,

e_sel-sign = 'I'.

e_sel-option = 'BT'.

e_sel-low = 'te%'.

e_sel-high = 'TE%'.

APPEND e_sel TO i_sel .

SELECT *

FROM ztable

INTO CORRESPONDING FIELDS OF TABLE t_list

WHERE description IN i_sel.

This does not work ..:(...

how

Read only

0 Likes
943

e_sel-sign = 'I'.

e_sel-option = 'BT'.

e_sel-low = 'te%'.

e_sel-high = 'TE%'.

APPEND e_sel TO i_sel .clear e_sel.

e_sel-sign = 'I'.

e_sel-option = 'BT'.

e_sel-low = 'tE%'.

e_sel-high = 'Te%'.

APPEND e_sel TO i_sel .clear e_sel.

SELECT *

FROM ztable

INTO CORRESPONDING FIELDS OF TABLE t_list

WHERE description IN i_sel.

or

SELECT *

FROM ztable

INTO CORRESPONDING FIELDS OF TABLE t_list

WHERE description+0(2) in ( 'te%', 'TE%' , 'Te%', 'tE%').

Read only

0 Likes
943

Thanks Jay

But the serach can be any thing like Test* or traIN* ...

What will i do...?

Read only

0 Likes
943

>

> Thanks Jay

>

> But the serach can be any thing like Test* or traIN* ...

>

> What will i do...?

Following the suggestion of Thomas Zloch above would seem to me to be the best solution. It's what SAP does in this situation eg in table LFA1 where (in our system at least) MCOD1 holds an uppercase version of NAME1.

Read only

ThomasZloch
Active Contributor
0 Likes
943

This can be done by adding another field to ZTABLE that duplicates the contents of DESCRIPTION in upper case (or lower case). Then your select could use this new field to search for the pattern, after converting it to upper case (or lower case).

Thomas

Read only

Former Member
0 Likes
943

This can really only be done using native SQL (that is, if your database supports something like 'translate').

Rob