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

Greater value in internal table rows.

Former Member
0 Likes
902

Hi,

I want find which row contains greater value in internal table.

like i am having

2

4

6

7

9

I wnat to get the row containing value 9.

I am not getting how to code.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
865

sort the decending order and take the first record....

4 REPLIES 4
Read only

Pawan_Kesari
Active Contributor
0 Likes
865

loop at itab.
  if itab-value > maxval .
      lv_index = sy-index .
      maxval = itab-value .
  endif.
endloop.
Read only

0 Likes
865

what is this max value.

I dont know which value is maximum.

have to search in internal table for maximum value

Read only

Former Member
0 Likes
866

sort the decending order and take the first record....

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
865

Sort the table in descending order by that field, and read the first record.

data: begin of itab occurs 0,
         number type i,
        end of itab.

....

sort itab by number descending.
read table itab index 1.
if sy-subrc = 0.
  write:/ itab-number.
endif.

Regards,

Rich Heilman