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

comparsion value

Former Member
0 Likes
685

Hi all

i have an internal table and a declare value1. What is the code to compare this 2 values? i want to loop thru the table and check row by row with value1

assume itab is the internal table

i want to compare the below value. Is my syntax right?

if itab-adminno <> value.

MESSAGE e002(ZMSGGARY) .

endif

4 REPLIES 4
Read only

Former Member
0 Likes
666

Hi,

If you have declared the internal table without header line..Then you have to use a work area.

DATA: WA LIKE LINE OF ITAB.

LOOP AT ITAB INTO WA.

if WA-adminno <> value.

MESSAGE e002(ZMSGGARY) .

endif.

ENDLOOP.

Thanks

Naren

Read only

Former Member
0 Likes
666

Hi,

Yes the code is right.

Regards,

Atish

Read only

Former Member
0 Likes
666

Hi,

The code is correct. if u r looking for an optimized code u make use of Read command.

for example

read table itab into wa_itab where admino = value.

after that check the sy-subrc.

Regards,

Maneesh Chandran

Read only

gopi_narendra
Active Contributor
0 Likes
666

Check this code Gary.


loop at itab.
  if itab-adminno NE value1." hope this is what you declared value1 and not value
    message e002(ZMSGGARY).
  endif.
clear : itab.
endloop.

Regards

Gopi