cancel
Showing results for 
Search instead for 
Did you mean: 

Wildcard searching without SQL?

Former Member
0 Kudos

Is there any way to use the "contains" functionality without having to use SQL (wildcard characters perhaps)? For example, if a user enters a name containing "Sa" I would like to return all values with those in it (Sam, Sally, Sarah, etc).

In the filter operator, there is an option to filter using contains. Is that a different version though? I tried doing this @NameLast and it didn't work.

Any help is appreciated. Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you use a JDBC connection (which always creates a SQL statement), then you must use different syntax in your SQL statement: it must contain a LIKE statement.

A regular statement looks like this:

SELECT fields FROM mytable WHERE mycriteria = "sandra"

If you concatenate a wildcard into it, it e.g. looks like

SELECT fields FROM mytable WHERE mycriteria = "sa*"

or

SELECT fields FROM mytable WHERE mycriteria = "sa%"

Which means, it returns all records that have a string sa* or sa%, which is not a wildcard search, because...

...the wildcard search needs a different SQL-syntax. Such a statement looks like this

SELECT fields FROM mytable WHERE mycriteria LIKE "sa*"

or eventually

SELECT fields FROM mytable WHERE mycriteria LIKE "sa%"

So I guess you need to create and change your SQL statement.

If you are not using SQL it depends on your service. If you use an RFC then your RFC must be able to use wildcrads. So when you enter only sa, then the RFC should create the correct statement.

Former Member
0 Kudos

Hi,

for ABAP RFC you can create a native sql syntax:

SELECT fields FROM mytable WHERE mycriteria LIKE "sa%"

for a wildcard.

But you can also check if your (condition) string contains a asterik that this will be replaced with a percent symbol, so that your query "uses" a wildcard.

Best Regards,

Marcel

Answers (0)