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

WILD CARDS

Former Member
0 Likes
2,356

hi,

for a database field CHAR(18), if i fill wild card character i.e *, or placeholders i.e +'s will i have any problem while reading the table

thanks in advance

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
2,034

i THINK YOU HAVE TO CONVERT THE SAP WILDCARD (*) to the sql wildcard (%) if you are using the 'like' comparison with a character CONSTANT, variable or parameter.

eg, select SINGLE * from mara where matnr like 'ABC%'.

But if the variable holding the "*" is a select-option or 'range' you do not need to convert as long as you use 'IN' for the compariosn.

EG, select SINGLE * from mara where matnr IN S_MATNR.

hi,

for a database field CHAR(18), if i fill wild card character i.e *, or placeholders i.e +'s will i have any problem while reading the table

thanks in advance

11 REPLIES 11
Read only

sbhutani1
Contributor
0 Likes
2,034

Hi surendra,

if you are using wild card in your select statement then you have to add 'like' keyword in place of = then it will work fine

Regards

Sumit Bhutani

<b>Ps reward points if helpful</b>

Read only

Former Member
0 Likes
2,034

i have tried using LIKE in select query. but it doesnt fetch any records for '*'. actually * should replace any characters and fetch me all the records. am i right ?

but a '%' works well.

what do u say ?

Read only

Former Member
0 Likes
2,034

I don't think you will have a issue as such.

If you have a WHERE the data is WILD char's, you might have to use the ESCAPE SEQ char.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

former_member186741
Active Contributor
0 Likes
2,035

i THINK YOU HAVE TO CONVERT THE SAP WILDCARD (*) to the sql wildcard (%) if you are using the 'like' comparison with a character CONSTANT, variable or parameter.

eg, select SINGLE * from mara where matnr like 'ABC%'.

But if the variable holding the "*" is a select-option or 'range' you do not need to convert as long as you use 'IN' for the compariosn.

EG, select SINGLE * from mara where matnr IN S_MATNR.

Read only

0 Likes
2,034

hi neil,

how to do that converion.

Read only

0 Likes
2,034

hi,

replace all occurrences of '*' in field with '%'.

replace all occurrences of '+' in field with '_'.

so you get the wildcard for like...

regards,

Stefan Huemer

Read only

0 Likes
2,034

TRY,

REPLACE

FIRST OCCURRENCE OF '*' IN your_VARIABLE

WITH '%'.

Read only

0 Likes
2,034

hi stefan,

yes, now i m clear

thanks

Read only

Former Member
0 Likes
2,034

Hi Surendra,

There wont be any issue in using wildcard characters from the table. You have to use LIKE instead of '=' while doing retrieveing data based on wildcard character from the table. You can also use wild card character for pattern based search using CP (Contain Pattern)in the table.

Cheers,

Vikram

Pls reward helpful replies!!

Read only

Former Member
0 Likes
2,034

HI

GOOD

AS YOU HAVE MENTIONED WHERE DO YOU WANT TO USE THE WILD CARD CHARACTERS ACTUALLY IN THE SELECT STATEMENT OR IN THE DECLARITION OF FIELD TYPE.

IF YOU R ACCESSING THE DATABASE TABLE THROUGH QUERY USING THE WILD CARD CHARACTER LIKE * THAN VERY MUCH YOU CAN DO THIS BUT NOT LIKE + AND IF YOU WANT TO DECLARE THE FIELD LIKE CHAR(*) THAN IT WILL GIVE YOU A ERROR.

THANKS

MRUTYUN

Read only

0 Likes
2,034

i access thru query only