2006 Oct 24 4:01 PM
hi experts,
i got the dates in the internal table, how can i caluculate first oldest date and second oldest date.
Thanks and regards,
praveen
2006 Oct 24 4:02 PM
sort ...
just because SAP store the date with year first, month second ... you can sort the date to have the first and the second ..
Fred
Am I missing something? Shouldn't it be <b>ascending</b>?
Rob
2006 Oct 24 4:02 PM
2006 Oct 24 4:02 PM
sort ...
just because SAP store the date with year first, month second ... you can sort the date to have the first and the second ..
Fred
2006 Oct 24 4:03 PM
sort itab by date descending.
read table itab index 1.
itab-date is the oldest.
read table itab index 2.
itab-date is the 2nd oldest.
2006 Oct 24 4:03 PM
Hi praveen,
sort the internal table by the date up or down.
than you can loop and gets the result.
Regards, Dieter
2006 Oct 24 4:04 PM
Hi, first sort your internal table by the date in descending order.
sort itab by datum descending.Then simply read the first two lines to get the dates.
read table itab index 1.
if sy-subrc = 0.
Write:/ 'This is the first oldest date', itab-datum'.
endif.
read table itab index 2.
if sy-subrc = 0.
Write:/ 'This is the second oldest date', itab-datum'.
endif.Regards,
Rich Heilman
2006 Oct 24 4:04 PM
2006 Oct 24 4:05 PM
Hi,
You can use
SORT ITAB BY DATE DESCENDING.
READ TABLE ITAB INDEX 1. "To get the first oldest date.
READ TABLE ITAB INDEX 2. "To get the second oldest date.
Thanks,
Naren
2006 Oct 24 4:20 PM
Am I missing something? Shouldn't it be <b>ascending</b>?
Rob
2006 Oct 24 9:09 PM
Hi Praveen
Rob is right..
It should be Asscending
since descending will give latest dates and not the oldest dates
Just take care while coding...
2006 Oct 24 9:38 PM
2006 Oct 24 10:04 PM
So if management asked you to archive the oldest documents you would ask if they meant "farthest away from current, or the most current"?
Rob
2006 Oct 24 10:22 PM
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |