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

Internal table

Former Member
0 Likes
854

Hi All,

I am having one internal table with three fields i.e f1, f2, f3. Now my requirement is i have to display the record from internal table in which f2 value is maximum.

regards

shashikanth naram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
832

Hi,

SORT your internal table in descending order by F2.

read the first record.

EX; SORT itab by F2 DESCENDING. Now max. value will come in first.

READ the value.

LOOP AT ITAB.

ON CHANGE OF itab-f2.

READ ITAB WITH KEY ..........

ENDON.

ENDLOOP .

8 REPLIES 8
Read only

Former Member
0 Likes
833

Hi,

SORT your internal table in descending order by F2.

read the first record.

EX; SORT itab by F2 DESCENDING. Now max. value will come in first.

READ the value.

LOOP AT ITAB.

ON CHANGE OF itab-f2.

READ ITAB WITH KEY ..........

ENDON.

ENDLOOP .

Read only

Former Member
0 Likes
832

sort internal table by f2 and then use select upto 1 row statement

Read only

Former Member
0 Likes
832

Hi Shashi,

Here is the logic.

1. Create 2 workarea (WA1 and WA2 )of the same type .

2. Now Loop at it_final,

Loop at itab.

If itab-f2 > wa1-f2.

wa2 = itab.

Endif.

wa1 = wa2.

Endloop.

Write:/ ' Maximum Value' , wa2-f1, wa2-f2, wa2-f3.

&**************Reward Point if helpful*****************&

Read only

Former Member
0 Likes
832

Hi shashikanth,

1. sort the internal table itab by f2 in descending order.

2. read the first line, gives the maximum value.

Ex.

Sort itab by f2 descending.

read table itab index.

reward if found helpful.

Regards,

Boobalan Suburaj

Read only

Former Member
0 Likes
832

Hi,

sort the internal table with descending order by the field f2 and then use read table to get the first record.

Thanks,

Arunprasad.P

Read only

Former Member
0 Likes
832

Hi

Sort your itab by desecding f2.

than: read itab index 1.

write:f1,f2,f3.

vipin

Edited by: Vipin on Jun 23, 2008 9:44 AM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
832

sort itab by f2 descending.

read table f2 index 1.

write itab.

Read only

Former Member
0 Likes
832

Hi,

You can do as below :



SORT ITAB BY F2 DESCENDING.

READ TABLE ITAB INDEX 1.

WRITE : ITAB-F1, ITAB-F2, ITAB-F3.

Thanks,

Sriram POnna.