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

SEARCH pattern

Former Member
0 Likes
1,035

Hello Experts,

I have text parameter on selection screen. if the text entered as ad then it should give all possible strings which will containg "ad".

I am using SEARCH statement but it is not working with ad or ad or ad. It is giving me blank output.

I have all the data in the internal table and just want to display records which will have this kind of pattern.

Appreciate your help.

Thanks in advance

Saurabh

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
861

Hi,

I donot think search is required here. Instead of parameters declare it as select option with no intervals and extension ( looks similar to parameter ). Then use a loop statement like.

loop at it where field in s_so1.

endloop.

BR

keshav

5 REPLIES 5
Read only

Former Member
0 Likes
861

Hi,

Move the values from the internal to a range table and provide information like below.

ra_data type range of ty_data.

wa_data-sign = 'I'
wa_data-info = 'CP'
wa_data-low = wa_itab-pattern
append wa_data to ra_data.

Then use search statement in this range table.

SEARCH 'ad' IN ra_data.

Else try like below.

FIND ALL OCCURRENCES OF REGEX 'ad' 
  IN TABLE itab 
  RESULTS results.

Hope this works.

Read only

Former Member
0 Likes
861

when you are at programming it anyway, let you be told that SEARCH is obsolete. Adopting to the modern times you should use FIND instead.

Read only

SharathYaralkattimath
Contributor
0 Likes
861

Try this,


DATA result_tab TYPE match_result_tab.

FIND ALL OCCURRENCES OF REGEX '(ad)' IN TABLE t_table
RESULTS result_tab.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
862

Hi,

I donot think search is required here. Instead of parameters declare it as select option with no intervals and extension ( looks similar to parameter ). Then use a loop statement like.

loop at it where field in s_so1.

endloop.

BR

keshav

Read only

0 Likes
861

nice solution, just dont forget to check if s_so1 is empty before doing so, since an empty select option states always correct.