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: 

Calculating leap year

Former Member
0 Kudos

Hi all,

I want to find out which years are leap years, so that i can use it in my days calculation for a year.

Regards,

Kaustubh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Divide the date by 4 if you get the reminder is 0 then it is the leap year.

Edited by: avinash kodarapu on Dec 10, 2008 12:11 PM

5 REPLIES 5

Former Member
0 Kudos

Hi,

Divide the date by 4 if you get the reminder is 0 then it is the leap year.

Edited by: avinash kodarapu on Dec 10, 2008 12:11 PM

arjun_thakur
Active Contributor
0 Kudos

hi,

try this code:

DATA: mydate TYPE d.

mydate = '20040301'.

mydate = mydate - 1.

if mydate+ 6(2) = '29'.

write 'It is a leap year'.

else.

write 'it is not a leap year'.

endif.

i hope it works.

former_member1245113
Active Contributor
0 Kudos

Hi,

Try the FMs

/SAPNEA/J_SC_CALENDAR

/SAPNEA/JSC_LEAP_YEAR Leap year check between two date

ISU_LEAP_DAYS_BETWEEN_2_DATES

FIMA_LEAP_DAYS_BETWEEN_2_DATES

LEAP_DAYS_BETWEEN_TWO_DATES

Regards

Ramchander Rao.K

former_member209217
Active Contributor
0 Kudos

Hi Kaustubh,

Check this function module.

/SAPNEA/JSC_LEAP_YEAR

It is used for Leap year check between two dates.

Regards,

Lakshman.

Former Member
0 Kudos

Hi

see the function module ' LEAP_DAYS_BETWEEN_TWO_DATES' or FIMA_LEAP_DAYS_BETWEEN_2_DATES.

see the code..below..

FUNCTION FIMA_LEAP_DAYS_BETWEEN_2_DATES.

VALUE(I_DATUM_VON) LIKE VTBBEWE-DBERVON

EXPORTING

VALUE(E_TAGE)

STATICS: JAHR TYPE I,

TAGE_VON TYPE I,

TAGE_BIS TYPE I.

IF I_DATUM_VON+4(2) < CON_MARCH.

JAHR = I_DATUM_VON+0(4) - 1.

ELSE.

JAHR = I_DATUM_VON+0(4).

ENDIF.

TAGE_VON = JAHR DIV 4 - JAHR DIV 100 + JAHR DIV 400.

IF I_DATUM_BIS+4(2) < CON_MARCH.

JAHR = I_DATUM_BIS+0(4) - 1.

ELSE.

JAHR = I_DATUM_BIS+0(4).

ENDIF.

<b>

TAGE_BIS = JAHR DIV 4 - JAHR DIV 100 + JAHR DIV 400.</b>

E_TAGE = TAGE_BIS - TAGE_VON.

ENDFUNCTION.