cancel
Showing results for 
Search instead for 
Did you mean: 

select with a wildcard

Former Member
0 Kudos

So I've got this internal table i_tab. One of the values for field1 of i_tab could be 'VP*'.

Afterwards, they do a select:

select cretime

into table i_table

from apqi

for all entries in i_tab

where groupid eq i_tab-field1.

Of course, nothing shows up, because the * is supposed to be a wildcard, and there is no groupid 'VP'. How can I make a selection so that the wildcard works? (Every groupid that starts with VP?) I can't change the * to a %.

Accepted Solutions (1)

Accepted Solutions (1)

andreas_mann3
Active Contributor
0 Kudos

Hi,

1) select cretime

into table i_table

from apqi

for all entries in i_tab

where groupid like 'VP*'.

2)

ranges r_id for apqi-groupid.

r_id-low = 'VP*'.

r_id-sign = 'I'.

r_id-option = 'CP'.

append r_id.

select cretime

into table i_table

from apqi

for all entries in i_tab

where groupid in r_id.

Andreas

Former Member
0 Kudos

The second solution seems to be more effective.

( I answer too quickly )

But for the range only few entries must be used.

Sincerely

Christophe Blineau

Answers (5)

Answers (5)

Former Member
0 Kudos

First of all, thanks for the quick and great replies.

The answers given by Christophe Blineau and Anjali Devi and the first answer by Andreas Mann wouldn't work for me. The 'VP*' is not a value I can place in the select literally, because it is a value from an internal table, and there are many more records with wildcards in that table.

I could try to work out the two other answers, to see if they would work. I don't fully understand what the 'aaaaaaaaaa' is for though.

Mind you, there are entries that have a * wildcard, and there are others that don't.

andreas_mann3
Active Contributor
0 Kudos

Hi Christophe,

i think, your problem is solved.

so pls reward points and close this thread.

thanks and regards

Andreas

Former Member
0 Kudos

Hi,

Check this link:

Regards,

Anjali

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Just try this.

ranges r_field for apqi-groupid.

loop at i_tab into wa.

*Since you specified two letter and since groupid is of width 12, I am using 10 letters 'aaaaaaaaaa' here.

concatenate wa-field1 'aaaaaaaaaa' into r_field-low.

r_field-option = 'EQ'.

r_field-sign = 'I'.

append r_field.

endloop.

select cretime

into table i_table

from apqi

where groupid in r_field1.

Get back for clarifications.

Kindly reward points if it is useful by clciking the star on the left of the reply.

Message was edited by: Jayanthi Jayaraman

Message was edited by: Jayanthi Jayaraman

Former Member
0 Kudos

If you want to do this, have a look at :

select * from TABLE where XXXX like 'YYYY%%'.

Mind the performance, it might be slow.

Sincerely

Christophe Blineau