String search
Hello Folks,
I need to do a a select on a database table for a text field to look for the user entered string.
Example : *bill* . The field's domain(TEXT40) has the lowecase checkbox selected, hence data is stored as entered.Because of this, Select gets records only if it find exact match(case).
I don't want to restrict the user's selection criteri. Any ideas?
JM
Hi Joe
Try this
report ZNTEST no standard page heading.
TABLES : SPFLI.
parameters : city like spfli-cityfrom.
start-of-selection.
concatenate '%' city '%' into city.
SELECT * FROM SPFLI WHERE CITYFROM LIKE city.
WRITE : / SPFLI-CITYFROM.
ENDSELECT.
Hope that helps.
_________________
Regards
Abaper
Thanks.
But thats not what I was looking for.
In your example, if CITYFROM field had a domain in which lowecase checkbox was checked, then your "CITY" will be case sensitive. This is exactly what I want to avoid
JM
Hi,
You have to use native Sql. Here an example:
report ystmy_exec .
tables: lfa1.
data: begin of i_exec occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
ort01 like lfa1-ort01,
end of i_exec.
select-options p1 for lfa1-name1 default 'hub*' option cp no intervals.
start-of-selection.
loop at p1.
translate p1 using '*%+_'.
translate p1 to upper case.
modify p1.
endloop.
exec sql performing write_into_table.
select lifnr, name1, ort01
into :i_exec-lifnr,
:i_exec-name1,
:i_exec-ort01
from lfa1
where mandt = :sy-mandt and
upper(name1) like :p1-low
endexec.
loop at i_exec.
write:/ i_exec.
endloop.
form write_into_table.
append i_exec .
endform.