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

Select data like a Pattern from Internal table

Former Member
0 Likes
2,412

Hi,

I want to select data from an internal table but data is like a Pattern

for that i have used

LOOP AT lt_rfc INTO wa_rfc WHERE bezeich CP i_name

AND beschr CP i_desc

AND datab LE sy-datum

AND datbis GE sy-datum.

but in case the name is like m it is not searching the relavent data.

Here I cannot use LIKE it is giving error LIKE is not supported.

Plzz Help me.

Regards

Manjari

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,925

Thanks Manish and Suhash

It is working for v but if i enter value like *v then it is not selecting.

10 REPLIES 10
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,925

Hello Manjari,

What are the values in the variables: i_name & i_desc?

Please revert back.

BR,

Suhas

Read only

Former Member
0 Likes
1,925

"name is like m" this is not clear.

Elaborate your question.

Please post example data and expected result.

Read only

Former Member
0 Likes
1,925

Suppose in theinternal table name and description are like

Name Desc

Lalita Verma CEO US

Tina Verma MD

i_name is an import Parameter if it is v then it should select both the entries.

Regards

Manjari

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,925

Hello Shital,

I think your understanding of the operator CP is wrong.

If you want the input 'v' to be true for both the entries, then you need to use wildcard characters for this.

Pass the value 'v' with CP operator & then check.

BR,

Suhas

Read only

Former Member
0 Likes
1,925

Hi,

Create a range for bezeich and beschr , lets say r_bezeich and r_beschr , populate the ranges , use the options as CP and sign as 'I' and the values i_name and i_desc.

Now while looping, use the in operator.



LOOP AT lt_rfc INTO wa_rfc WHERE bezeich in r_bezeich
AND beschr in r_beschr
AND datab LE sy-datum
AND datbis GE sy-datum.

Hope this helps.

regards,

Advait

Read only

Former Member
0 Likes
1,925

Check this example code. The pattern string should contain 'v' instead of just 'v'


DATA: BEGIN OF wa,
a(20) TYPE c,
END OF wa.
DATA it LIKE TABLE OF wa.

wa-a = 'Lalita Verma'.
APPEND wa TO it.

wa-a = 'Tina Verma'.
APPEND wa TO it.

LOOP AT it INTO wa WHERE a CP '*v*'.
  WRITE:/ wa-a.
ENDLOOP.

Read only

Former Member
0 Likes
1,926

Thanks Manish and Suhash

It is working for v but if i enter value like *v then it is not selecting.

Read only

0 Likes
1,925

*v implies that the name ends with v, so perhaps there is no value that ends with v in you list of values.

v* would imply that the value starts with v and v would mean that v comes anywhere in the string.

So based on your requirement you need to decide what pattern you want to use.

Kind regards,

Advait

Read only

Former Member
0 Likes
1,925

Hi Advait

Thanks first of all but

I cannot create range for i_name and i_desc.

Read only

Former Member
0 Likes
1,925

Manjari;

  • should be on both sides of v, as it indicates that there may or may not be some characters before or after literal v. check example code is posted before.