Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sample code to pick up a MAX value from an internal table column?

We know that we can use Select MAX statement to pick up a a max value from a system table, but we are not sure if we can do the same thing for internal table. We've got an internal table itab which looks like:

A------B

x1-----3

x2-----1

x3-----7

x4-----2

We'd be appreciated if some ABAP expert here can show us the sample code to pick up the max value of column B which is 7 from the above internal table itab!

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 10, 2008 12:56 PM

Tags:
Former Member
replied

Try this way

data : v_max_value type i.
sort itab by B descending.
read table itab index 1.
if sy-subrc eq 0.
   move itab-b to v_max_value.
endif.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question