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

wild car in internal table loop

Former Member
0 Likes
4,298

Hi,

This is for NW 7.0 EHP1 on Oracle.

Can I use wild card search criteria like '%ABC%' in internal table loop as shown below.

LOOP AT where itab1-objname LIKE '%ABC%'.

END.

The above is just sample and it is not a correct statement as it gives me syntax error. I cannot use LIKE in loop.

Is there is any other smart idea about it.

I hope my question is clear.

Your <<removed>> responce will be greatly appreciated.

Regards,

Sume

Edited by: Rob Burbank on Jul 23, 2010 3:41 PM

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,686

You can't use LIKE, but try CP(contains pattern).

LOOP AT itab where objname CP '*ABC*'. 
ENDLOOP.

Regards,

Rich Heilman

Edited by: Rich Heilman on Jul 23, 2010 4:52 PM

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,687

You can't use LIKE, but try CP(contains pattern).

LOOP AT itab where objname CP '*ABC*'. 
ENDLOOP.

Regards,

Rich Heilman

Edited by: Rich Heilman on Jul 23, 2010 4:52 PM

Read only

0 Likes
1,686

It seems like my logic is sorted out with CP. Thank you for the help.

I still could not use LIKE in loop at. I will be curious how you can use it in internal table.

Please let me know.

Regards,

SC

point awarded.

Read only

0 Likes
1,686

Sorry, I meant you CAN'T use LIKE.

Regards,

Rich Heilman

Read only

luis_quispe
Explorer
0 Likes
1,686

Hi,

You can create a range variable and fill it with:

data: v_rango type range of campo with header line.

v_rango-sign = 'I'.

v_rango-option = 'CP'.

v_rango-low = 'ABC'.

v_rango append.

For performance you have to create the internal table index (WITH KEY)

LOOP AT itab WHERE IN v_rango field

:

:

regards

Lquispe