Application Development 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: 

WILD CARDS

Former Member
0 Kudos

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

former_member186741
Active Contributor
0 Kudos

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.

11 REPLIES 11

sbhutani1
Contributor
0 Kudos

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>

Former Member
0 Kudos

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 ?

Former Member
0 Kudos

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

former_member186741
Active Contributor
0 Kudos

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.

0 Kudos

hi neil,

how to do that converion.

0 Kudos

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

0 Kudos

TRY,

REPLACE

FIRST OCCURRENCE OF '*' IN your_VARIABLE

WITH '%'.

0 Kudos

hi stefan,

yes, now i m clear

thanks

Former Member
0 Kudos

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!!

Former Member
0 Kudos

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

0 Kudos

i access thru query only