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: 

comparsion value

Former Member
0 Kudos
51

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

Former Member
0 Kudos
32

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

Former Member
0 Kudos
32

Hi,

Yes the code is right.

Regards,

Atish

Former Member
0 Kudos
32

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

gopi_narendra
Active Contributor
0 Kudos
32

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