‎2007 Mar 02 8:29 AM
How do i do string comparisons in the where clause of a select.
Something like:
data: c(20).
c = 'Music'.
Select a b from yplaylist into table i_playlist where
a CO c.
‎2007 Mar 02 8:33 AM
HI Asha,
If you want the exact string to be matched, then you can directly uuse
Select a b from yplaylist into table i_playlist where
a = c.
If you want a matchin the patterns, i.e. all the strings that contain a string 'Music', then use like syntax.
Select a b from yplaylist into table i_playlist where
a like '%Music%'.
‎2007 Mar 02 8:31 AM
u have where a LIKE C.
operator LIKE to compare in where clause chck that..
reward if it helps uu..
‎2007 Mar 02 8:31 AM
‎2007 Mar 02 8:33 AM
HI Asha,
If you want the exact string to be matched, then you can directly uuse
Select a b from yplaylist into table i_playlist where
a = c.
If you want a matchin the patterns, i.e. all the strings that contain a string 'Music', then use like syntax.
Select a b from yplaylist into table i_playlist where
a like '%Music%'.
‎2007 Mar 02 8:42 AM
Hi Ravi,
I want to get the various values from table which is exactly or contains music. So instead of hardcoding , can i just use
Select a b from yplaylist into table i_playlist where a like c.
‎2007 Mar 02 8:46 AM
if u dont want to hardcode then declare the variable and use in select statement.
date: g_cat(7) type c value '%Music%'.
‎2007 Mar 02 8:49 AM
No the value keeps changing. So i capture it in a variable and do the comparison. So it has to be dynamic.
‎2007 Mar 02 9:30 AM
To Do that you ave to concatenate '%' in front and after the actual word.
Assume that the word you want to check is in a variable v_word.
then do like this:
concatenate '%' v_word '%' into c.
Select a b from yplaylist into table i_playlist where a like c.
Regards,
Ravi
‎2007 Mar 02 8:35 AM
Hi,
Try this
Select a
b
from ypaylist
into table i_paylist
where a = c.
if sy-subrc eq 0.
endif.