‎2009 Jun 22 2:01 PM
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
‎2009 Jun 22 2:31 PM
Thanks Manish and Suhash
It is working for v but if i enter value like *v then it is not selecting.
‎2009 Jun 22 2:13 PM
Hello Manjari,
What are the values in the variables: i_name & i_desc?
Please revert back.
BR,
Suhas
‎2009 Jun 22 2:13 PM
"name is like m" this is not clear.
Elaborate your question.
Please post example data and expected result.
‎2009 Jun 22 2:21 PM
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
‎2009 Jun 22 2:28 PM
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
‎2009 Jun 22 2:27 PM
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
‎2009 Jun 22 2:28 PM
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.
‎2009 Jun 22 2:31 PM
Thanks Manish and Suhash
It is working for v but if i enter value like *v then it is not selecting.
‎2009 Jun 22 2:36 PM
*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
‎2009 Jun 22 2:34 PM
Hi Advait
Thanks first of all but
I cannot create range for i_name and i_desc.
‎2009 Jun 22 2:37 PM
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.