‎2007 Jul 17 7:47 AM
Hi all,
I have say 3 dates .how will find the latest date.
bcoz of i think the logic then it is going very big.is there any simple way....
‎2007 Jul 17 7:53 AM
Hi,
Put all the dates in an internal table <ITAB>
Then SORT ITAB by DATE DESCENDING.
U will get Latest date in first record.
Regards,
‎2007 Jul 17 7:49 AM
hi,
put the 3 dates in an internal table.
sort that internal table.
read the first index.
u will get the latest date.
Rgds
Reshma
‎2007 Jul 17 7:53 AM
Hi,
Put all the dates in an internal table <ITAB>
Then SORT ITAB by DATE DESCENDING.
U will get Latest date in first record.
Regards,
‎2007 Jul 17 7:55 AM
Hi,
1) You can do a number of things, one you can get all of the relevant records and sort the internal table by date and time in decending order, then simply read the first record of the internal table.
2) It depends on the key of the table. Say for example, you have a table like so.
MANDT
KEYFIELD
DATE
TIME
If the key alreays exists, you can use the modify statement to update the record, if it dosn't exists, you need to use the INSERT statement to insert the records.
data: xtab type ztable.
xtab-keyfield = 'ABC'.
xtab-date = '20070207'. " or sy-datum
xtab-time = '221600'. " or sy-uzeit.
insert ztable from xtab.
Make sure to use internal fomat for DATE and TIME
<b>Reward points</b>
Regards
‎2007 Jul 17 7:55 AM
Hi,
take refernce from the foll. code:
data : begin of itab occurs 0,
date like sy-datum,
end of itab.
data : lv_date like sy-datum.
lv_date = sy-datum - 70.
move lv_date to itab-date.
append itab.
lv_date = sy-datum - 120.
move lv_date to itab-date.
append itab.
lv_date = sy-datum - 90.
move lv_date to itab-date.
append itab.
loop at itab.
write : / itab-date.
endloop.
sort itab descending.
read table itab index 1.
write : / itab-date.
Regards,
Himanshu