cancel
Showing results for 
Search instead for 
Did you mean: 

Selection smallest year for NPV

Former Member
0 Kudos
39

Hi *,

i am trying to create a Net Present Value function.

Therefor, I need the smallest year in my selection.

Does anybody know, how to get the smallest year in a selection.

e.g.: 2005, 2006, 2007 ....

So i need 2005 as basic year ... how can I select that ??

Here is a little code example from my function:


FOREACH S_FISCYEAR.
IF T_YEAR_FIRST >= T_YEAR_ACT.
      IF T_YEAR_ACT < T_YEAR_FIRST AND T_YEAR_ACT > T_YEAR_LAST.
         T_YEAR_FIRST = T_YEAR_ACT .
         S_AMOUNT = { 0AMOUNT, MY_FISCYEAR }.
      ENDIF.
ENDIF.


     T_YEAR_CALC = T_YEAR.

    IF T_YEAR_CALC >= 0.
     T_YEAR_CALC = T_YEAR_CALC + (FLOATYEAR - T_YEAR_SMALL).
   ENDIF.
ENDFOR.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I mean the lowest year. But the selection is not always a specific number of years.

It could be 2001 until 2003 or it could be 2004 - 2010 ..!

What I need is a function in my code to keep the lowest year all the time.

I am using IP.

Former Member
0 Kudos

Mike,

Do you mean the lowest year or the earliest year of the selection? Is your selection always a range and is there a specific number of years in the selection?

BTW, are you using BPS or IP?

Former Member
0 Kudos

Hi,

I mean the lowest year. But the selection is not always a specific number of years.

It could be 2001 until 2003 or it could be 2004 - 2010 ..!

What I need is a function in my code to keep the lowest year all the time.

I am using IP.

Former Member
0 Kudos

I dont know what do you mean by smallest year.

IN a block of 4 years, the leap year is the longest and rest all ordinary year.

Also, if you know the know the no of years the inevstment is to go and the cashflow years, then you can hardcode that "smallest" year in the NPV fox .

Or you may have to write a custom ABAP and check for conditions and possibilities and apply the results.

Ravi Thothadri