11-14-2007 8:32 PM
Hi All,
Is there any function to find the maximum number .For instance I have 10 numbers.Can I find the maximum number out of it using any function ( Not function module ).
Regards,
Vishu.
11-14-2007 8:34 PM
If they are in internal table you can use the SORT DESCENDING ..
Like:
SORT ITAB BY NUMBER DESCENDING.
READ ITAB INDEX 1.
WRITE : ITAB-NUMBER. " << HIGHEST NUMBER
Regards,
Naimesh Patel
11-14-2007 8:35 PM
Hi,
Where is the data stored? Is it in database table?
If it is you can use SELECT statement with aggregate (MAX) or SELECT statement with sort key (ORDER BY).
If it is stored in internal table then you can sort the internal table with descending order then read the first record.
Regards,
Ferry Lianto
11-14-2007 8:38 PM
No it is not in the database table.I just have 10 numbers in my program.I want the highest number of it without passing them into an internal table and sorting them out.
11-14-2007 8:38 PM
Vishwanath,
sort and then display the last number. Small example.
REPORT zforum140 .
data : begin of itab OCCURS 0,
data1 type c.
data: end of itab.
data: n type i.
do 5 TIMES.
n = n + 1.
itab-data1 = n.
append itab.
enddo.
sort itab by data1.
n = itab-data1.
write:/ n.
Regards
Aneesh.
11-14-2007 8:41 PM
Hi Vishu,
Can you show your codes to build those 10 numbers?
Regards,
Ferry Lianto