‎2008 Aug 28 1:16 PM
hi all,
How can we find maximum date among given dates.
Please suggest.
Regards
Reddy
‎2008 Aug 28 1:17 PM
hi,
depends on the data source: for example if the dates are in an internal table, than you can sort the internal table by date descending and the date in the first line will be the highest.
hope this helps
ec
‎2008 Aug 28 1:18 PM
Hi....
You can easily trace this by using IF conditon with GT ( > ) sign.
---naveen.I
‎2008 Aug 28 1:19 PM
Hi,
put the date in an internal table, sort table DESCENDING, and read the first entry.
Regards, Dieter
‎2008 Aug 28 1:19 PM
‎2008 Aug 28 1:20 PM
hi ram redddy .,
if it is from DB table USe MAX(DATE) .
if it is from internal table just Sort table by date descending .
read table itab with key index = 1 .
thanks
Sreenivas Reddy
‎2008 Aug 28 1:20 PM
Hi ramireddy,
If your data is in internal table then sort that internal table descending by date. Now you can easily get the maximun date.
Regards,
Rajitha.
‎2008 Aug 28 1:30 PM
Hi.....
Check this code...
Do like this if those dates in variables...
or half this code.... if those dates in internal tables....
data: date1 like sy-datum,
date2 like sy-datum,
date3 like sy-datum,
date4 like sy-datum,
date5 like sy-datum.
date1 = sy-datum.
date2 = sy-datum - 1.
date3 = sy-datum - 4.
date4 = sy-datum + 10.
date5 = sy-datum + 1.
data: begin of itab occurs 0,
date like sy-datum,
end of itab.
itab-date = date1.
append itab.
clear itab.
itab-date = date2.
append itab.
clear itab.
itab-date = date3.
append itab.
clear itab.
itab-date = date4.
append itab.
clear itab.
itab-date = date5.
append itab.
clear itab.
sort itab descending. <----start from here if your dates in internal tables.
read table itab index 1.
if sy-subrc = 0.
write:/ itab-date.
endif.Thanks,
Naveen.I