09-28-2008 8:16 AM
Hi experts,
I have many dates in an internal table.How to find min and max dates of these.
Is there any FM or i have to write logic.
Please help.
Krishan
09-28-2008 8:44 AM
Hi Krishan,
Adding to pavan ans....
SORT itab BY date.
DESCRIBE TABLE itab LINES l_lines. "Get total number of lines in itab.
READ TABLE itab INTO wa INDEX 1 TRANSPORTING date. "Read first entry
Here wa-date have Min date value.
READ TABLE itab INTO wa INDEX l_lines TRANSPORTING date. "Read last entry
Here wa-date Have Max date value.
Thanks,
Vinod.
09-28-2008 8:20 AM
HI
I don't know about the FM but the logic is very simple all you have to do is sort the internal table in Ascending order by DATE the first index, I mean the first entry in the table will be the min and the last entry in the internal table will be the Maximum.
Regards
Pavan
09-28-2008 8:56 AM
09-28-2008 8:44 AM
Hi Krishan,
Adding to pavan ans....
SORT itab BY date.
DESCRIBE TABLE itab LINES l_lines. "Get total number of lines in itab.
READ TABLE itab INTO wa INDEX 1 TRANSPORTING date. "Read first entry
Here wa-date have Min date value.
READ TABLE itab INTO wa INDEX l_lines TRANSPORTING date. "Read last entry
Here wa-date Have Max date value.
Thanks,
Vinod.
09-28-2008 8:56 AM
09-28-2008 8:45 AM
Hi,
You can do as below :
"Get the max date
sort itab by date descending.
Read table itab index 1.
write : /itab-date. "MAx date.
sort itab by date ascending.
Read table itab index 1.
write : /itab-date. "Min date.
Thanks,
Sriram Ponna.