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 to use like operator in loop

Former Member
0 Kudos

Hi I am trying to use like operation in loop condition. the code is as follows:

loop at lt_mara into l_mara where l_mara like '%XXX'.

-


endloop

when i have the like operator like above its giving me an error that i cannot use like operator. Is there anyway that i can use like operation in loop at condition,

Thanks in advance

2 REPLIES 2

Former Member
0 Kudos

you can try ranges with "CP", this should work for you.

removed by moderator

Regards,

Prabhu Rajesh

Edited by: Durairaj Athavan Raja on Aug 3, 2008 8:47 AM

former_member188685
Active Contributor
0 Kudos

using the ranges with CP option we can do that..

Populate the ranges mentioned below..

data: r_matnr type range of matnr,
        w_matnr like line of r_matnr.
w_matnr-low = '%XXX'.
w_matnr-sign = 'I'.
w_matnr-option = 'CP'.
append w_matnr to r_matnr.
loop at lt_mara into l_mara where matnr in r_matnr.

--------------------------------------------------------------------------------
endloop

Regards

Vijay Babu Dudla