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: 

How can I put asterisk in the beginning and end of a search parameter..?

Former Member
0 Kudos

Hi!

I'm developing a program for a user where he wants a search parameter for the description about some purchase orders....

The problem is if the user want to make a search for any word he need to put asterisk in the beginning and end of the word because if the user don't put the asterisk the search will not find anything because the program don't know if the word is in the beginning of the description or in the end or in the middle...

How can I put one asterisk in the beginning and end of the search topic entered by the user internally in the program..? I was thinking using the concatenate function but for this will not work because the program think that the asterisk is part of the word and not..

The search parameter of the Description is in range.. (Select-Options).

Thanks for your help!!

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

If its a seect option then the search pattern will handled automatically.

Only thing you have to make sure is whether the text case ( Upper/Lower ) matches the table entires.

If you want to add it in the begining and end then , loop at select-options and then concatenate.


loop at so.
clear lv_str.
so-option = 'CP'.
so-sign = 'I'.
if so-high is not initial.
concatenate '*' so-high '*' into lv_str.
clear so-high.
so-high = lv_str.
endif.
clear lv_str.
concatenate '*' so-low '*' into lv_str.
clear so-low.
so-low = lv_str.
condense :so-low,so-high.
modify so.
endloop.

Edited by: Keshav.T on Jul 7, 2010 6:24 PM

5 REPLIES 5

kesavadas_thekkillath
Active Contributor
0 Kudos

If its a seect option then the search pattern will handled automatically.

Only thing you have to make sure is whether the text case ( Upper/Lower ) matches the table entires.

If you want to add it in the begining and end then , loop at select-options and then concatenate.


loop at so.
clear lv_str.
so-option = 'CP'.
so-sign = 'I'.
if so-high is not initial.
concatenate '*' so-high '*' into lv_str.
clear so-high.
so-high = lv_str.
endif.
clear lv_str.
concatenate '*' so-low '*' into lv_str.
clear so-low.
so-low = lv_str.
condense :so-low,so-high.
modify so.
endloop.

Edited by: Keshav.T on Jul 7, 2010 6:24 PM

former_member536879
Active Contributor
0 Kudos

Hi carlos,

The same way what keshav told you.

If it is a parameter also you can do the same thing.

First concatenate and then pass that concatenated string in to the parameter.

With Regards,

Sumodh.P

0 Kudos

Thanks keshav!

OK... and if I concatenate the asterisk latter I can make this search?

In the code desc_search is the select_option that I tell u. I use the DESCRIBE to see first if it is not initial... if desc_search have an entry then access the DELETE to remove all the records that are diferent from desc_search.. This desc_search will have the word with the asterisk... and the question is if it works if I use the concatenate before this... anyway I will try but I think that if I use the concatenate the program confuse and take the asterisk as part of the word..

DESCRIBE TABLE desc_search LINES desc_count.

  IF desc_count IS NOT INITIAL.

    DELETE core_table WHERE desc NOT IN desc_search.

  ENDIF.

Let u know if works!!

Thanks!

0 Kudos

so-option = 'CP'. "<--Contains Pattern

so-sign = 'I'.

so-option = 'EQ'. "<--Equals " This will consider it as as single word

so-sign = 'I'.

0 Kudos

It Works!! Thanks a lot!!!!