cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating the number of days of a year including leap year

Former Member
0 Kudos

Hi all,,

Is their any function module which should calculate the number of days of a year including the leap year, (i.e. for a leap year it should return a value 366 and for rest it should return 365).. If their aren't a function module,, can anyone please tell me the code to implement the above said case,,

Thanx in advance

Ill assign points

regards

Dinesh.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi together,

there is another possible way.

Calculate the difference by a simple abap coding.

data: begin like sy-datum.

data: end like sy-datum.

data: days(6) type n.

concatenate sy-datum(4) '0101' into begin.

end = sy-datum.

days = end - begin.

The system will calculate the corresponding fields, due to referencing DATS data elements (DDIC).

Robert

Former Member
0 Kudos

I took another look, it turnes out FIMA_DAYS_BETWEEN_TWO_DATES_2 considers leap days if you pass the parameter I_STGMETH with the value '2'.

Hope this helps.

Regards,

Petter

Former Member
0 Kudos

I didnt find any spesfic module that would take care of that but I think there is a work around:

Get your days between 2 dates with this function module:

FIMA_DAYS_BETWEEN_TWO_DATES_2

Pass the 2 days as parameters

Lets say this gives you the value 365.

Then, fill a new variable from this FM

FIMA_LEAP_DAYS_BETWEEN_2_DATES

Pass the same 2 days as parameters

Lets say this gives you the value 1.

Add the variables togegether and you should get your correct result 366.

Hope this helps,

Regards,

Petter