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 card search in a range

0 Kudos
759

Hi All,

I have a select option of a alpha numeric field..

I don't know the length of the field..

Now if i have to search

*A*B*

in the range, how this could be achieved?

E.g.
Range-->

Low --> A

High --> 100

Search word : *B*4*

How can I achieve this?

Note: It is not a database table, it's internal table search.

Regards

Yadesh

7 REPLIES 7

raymond_giuseppi
Active Contributor
0 Kudos
138

I don't actually understand your requierment, just try a

LOOP AT itab ASSIGNING <record> WHERE field IN range.

Regards,

Raymond

0 Kudos
138

Hi Raymond,

example would be

I have a select option lets S_BUKRS
in which I have filled a range...
A to 9999

Now I have to find all the entries in this range which have this wild card pattern
example --> *B*4* or *4 or any thing which user might like...

Regards,

Yadesh

0 Kudos
138

You could add the wildcard in the WHERE option :

LOOP AT itab ASSIGNING <record> WHERE field IN range AND field CP wildcard. 

Regards,

Raymond

0 Kudos
138

Contain pattern will work for B, how that will work for B*4

If I have B*4 it mean B should be the first letter and 4 should be the last letter of the word which I belive will not hapen..

Second..If I pass B*4, it will look for B*4 only and it will not consider the star in between..

I want the search to be like we do it on DB.. using LIKE..

Consider when we look for things in tarnsaction SE37 or SE38?

0 Kudos
138

Test it, it should work. CP is very similar to LIKE. (CP not CS, read CO, CN, CA, NA, CS, NS, CP, NP)

Regards,

Raymond

0 Kudos
138

I don't have any internal table.. I have a work area.. where I have a low value and a high value..
I don't know what I will be having their as value..

now regarding the search term --
I have a list of values that have to scanned from that range..that could have wild character..

For example..
In my work area, I have value '100' as low and 'A' as high.

if in the search term, I have 17, I could check whether that will lie in the range..
If i have search tearm 10003 then i could check whether this will lie in the range...


Now if I have to look for value  *4 in this range, how can that be done.

Regards,

Yadesh

Former Member
0 Kudos
138

Hi Yadesh,

I would recommend you to use regular expressions.

That is one of the best ways to find a pattern in a string.

Regards,

Prashant