09-08-2009 12:54 PM
Hi gurus,
I have this table with 2 fields startdate and finishdate :
startdate finishdate
01.01.2009 06.01.2009
02.02.2009 07.02.2009
03.03.2009 08.03.2009
04.04.2009 09.04.2009
I would like to determine :
the minimum date in field startdate
the maximum date in field finishdate.
What is the best way to do that ? Perhaps any functionmodule suggestions ?
Thanks in advance friends,
Abjuh.
Edited by: Abjuh Nahasapee on Sep 8, 2009 1:54 PM
09-08-2009 1:07 PM
Hi Abjuh,
if you have internal table with two fields then
first thing sort your internal table with start date ascending
and then take that date into a variable
second thing sort your internal table with end date descending
and then take that date into another variable.
Regards,
Vijay
09-08-2009 1:01 PM
Hi,
If its a database table, use the aggregate functions,
select max( startdate ) into itab from DBtable.
If its a internal table use sort by descending.
sort itab by startdate descending.
The first record will have the max start date.
Similarly you can do the same for finishdate.
Regards,
Vikranth
09-08-2009 1:02 PM
while fetching it from the data base use aggregate functions.
SELECT MAX( date ) FROM mara INTO max_date
WHERE mtart = 'HALB'.
09-08-2009 1:03 PM
Hi,
If you have data in internal table,
sort itab by startdate.
and then read the index 1 record for getting minimum date.
sort itab by finishdate descending.
and then read the index1 record for getting maximum date.
09-08-2009 1:07 PM
Hi Abjuh,
if you have internal table with two fields then
first thing sort your internal table with start date ascending
and then take that date into a variable
second thing sort your internal table with end date descending
and then take that date into another variable.
Regards,
Vijay
09-08-2009 1:12 PM
Wow, thx for the fast replies guys ...
These are all really good hints !
Awarded points !
it was concerning an internal table btw.
BR,
ABjuh