Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM for getting Last 3 years

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

Dont you think you can write a simple ABAP code to do this instead of searching for a function module?

Vikranth

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.