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: 

Question about getting the column with smallest value in a table/alv

Former Member
0 Kudos

Hi all,

Is there a way to get the row with smallest value in 1 of the column from an internal table? For example, I had an internal table of 5 rows, and just 2 columns.

Column1 = Round numbers (1,2,3,4,5) and column2 = indicator (X or space). I want the row where column1 is smallest to have X in column2. Is there a way to do this?

3 REPLIES 3

Former Member
0 Kudos

Hi

ITAB has 2 columns f1 and f2

SORT ITAB BY f1.

Read table ITAB index 1.

this record will give you the neede one.

Reward points if useful

Regards

Anji

Former Member
0 Kudos

sort itab by f1 f2 <b>descending.</b>

read table itab index 1.

Former Member
0 Kudos

data : tabix like sy-tabix,

small type i.

sort iatb by f1.

loop at itab.

if itab-f2 = 'X'.

tabix = sy-tabix.

exit.

endif.

endloop.

read table itab index tabix.

write : / itab-f1.

reagrds

shiba dutta