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

LOOP AT internal table with WHERE clause

Former Member
0 Likes
7,953

Hi @ll

I have the bellow statement and I need the LIKE but from syntax point of view this is not allowed. How can I find a field with a proximate content.

LOOP AT itab_report_test WHERE sdata LIKE 'It works good, change'.

Thanks for your help in advance

/Kamran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,998

Try with %

LOOP AT itab_report_test WHERE sdata LIKE '%It works good, change%'.

Otherwise..


LOOP AT yourtable.
  CHECK yourtable-sdata CS 'It works good, change'
*  process
ENDLOOP.

Edited by: Paul Chapman on Apr 23, 2008 6:17 PM

Then you will need to try the 2nd option I provided.


loop..
  check field CS 'xxxx'.
*  process
endloop.

7 REPLIES 7
Read only

Former Member
0 Likes
1,999

Try with %

LOOP AT itab_report_test WHERE sdata LIKE '%It works good, change%'.

Otherwise..


LOOP AT yourtable.
  CHECK yourtable-sdata CS 'It works good, change'
*  process
ENDLOOP.

Edited by: Paul Chapman on Apr 23, 2008 6:17 PM

Read only

0 Likes
1,998

Hi,

when I write this

LOOP AT itab_report_test WHERE sdata LIKE '%It works good, change%'.

it then says

Relational operator "LIKE" is not supported.

Regards

Read only

0 Likes
1,998

Then you will need to try the 2nd option I provided.


loop..
  check field CS 'xxxx'.
*  process
endloop.

Read only

0 Likes
1,998

Thanks it helped.

/Kam

Read only

Former Member
0 Likes
1,998

hi check this..

loop at itab where sdata like '*'.

endloop.

regards,

venkat.

Read only

Former Member
0 Likes
1,998

Hi,

LIKE operator is not allowed in LOOP statement.

do like this..

Loop at itab.

find first occurrence of 'Its works good, change' in itab-sdat.

if sy-subrc = 0.

do ut thing.......

endif.

endloop.

Regards

Syed A

Read only

Former Member
0 Likes
1,998

Hello,

Instead of


LOOP AT itab_report_test WHERE sdata LIKE 'It works good'

Try something like :


LOOP AT itab_report_test WHERE sdata CS 'It works good'.

Regards

Greg Kern