‎2006 Dec 04 7:13 AM
Hi all,
I have a Z table with a field with numeric values.
I need to get the highest value from that field.
I feel it'll be a performance issue to select all records & search the highest value by looping.
So, does anyone know any function module which does the same..?
‎2006 Dec 04 7:18 AM
You can select all the records into an internal table and then sort the internal table on the numeric field descending.
Regards
Mohamed Mansoor
‎2006 Dec 04 7:18 AM
You can select all the records into an internal table and then sort the internal table on the numeric field descending.
Regards
Mohamed Mansoor
‎2006 Dec 04 7:18 AM
1. SELECT using ORDER BY clause into Table directly and read the first entry
2. SELECT into a SORTED Table directly and read the first entry
3. SELECT into a table, SORT manually using SORT command and then read the first entry.
SORT has to happen by the field you are looking for.
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Dec 04 7:18 AM
Hi,
you may use Select with MAX.
SELECT MATNR MAX(mblnr) into table itab
from mseg
group by matnr
where matnr in s_matnr.
Regards,
Amit
‎2006 Dec 04 7:19 AM
Hi,
Select MAX( <col> ) INTO lv_max
FROM ztable.
DATA: lv_max TYPE ztable-<col>.
Regards,
Goutham
‎2006 Dec 04 7:19 AM
hi,
Select all entries of Z table to an internal table.
Sort itab in the descending fashion wrt the field you are looking for highest value
Then you can read the itab with index 1 and that is the highest value of that particular field
‎2006 Dec 04 7:22 AM
Just use a select statement like :
select max( seatsmax ) into l_max from sflight.
‎2006 Dec 04 7:25 AM