04-15-2011 10:17 AM
Hi experts,
Can any body tell me how to get last three years from current year using FM.
Which function module is suitable for this?
2011- need to get 2008 2009 2010
Thanks in advance,
Veena.
Moderator Message: Basic Date-related questions are not allowed.
Edited by: kishan P on Apr 15, 2011 2:57 PM
04-15-2011 10:22 AM
Dont you think you can write a simple ABAP code to do this instead of searching for a function module?
Vikranth
04-15-2011 10:23 AM
hi,
I don't think there is any requirement for any FM for this.
You can take the sy-datum and extract the year. Then subtract 1, 2 and 3 from it will give the last three years.
sy-datum+0(4) will give the current year.
04-15-2011 10:27 AM
at first you need a proper definition what the last three years means.
If i give you todys date 04/15/2011 what do you expect ? 05/14/2008 - 04/15/2011 ? or just 05/14/2008
or maybe really calculated 1096) days back? Do you need a interval or all the days between then and now or what exactly do you need?
Once you know that you will have done a short abap within 5 minutes which does what you need.