Finding a function to get leap year

Hi everybody!
I need a function or code to find  if a year is  leap year or normal year.
Thanks a lot of!
DM

Here is some code that I had in my bag of tricks.
report zrich_0001 .
parameters: p_datum type  sy-datum.
* check if it is a leap year.
data: march1 type sy-datum.
data: last_day_feb type sy-datum.
march1 = p_datum.
march1+4(4) = '0301'.
last_day_feb = march1 - 1.
if last_day_feb+6(2) = '29'.
write:/ 'This is a leap year'.
endif.
Regards,
Rich Heilman

Similar Messages

  • Function CALCULATE_DATE and  leap year

    Hi,
    I need to substract some months from a date. I tried to use the standard function CALCULATE_DATE but it has a proble with leap years. If I execute it with the following parameters:
    CALL FUNCTION 'CALCULATE_DATE'
         EXPORTING
              days        = '0'
              months      = '-24'
              start_date  = '20080229'
         IMPORTING
              result_date = X.
    The value that I get in X is '00000000' because 2006 isn't a leap year. The problem is that the function doesn't know how to deal with this. The solution is very easy, buy if it's possible I would like to use a standard function.
    Do you know if there are any standard function that has no problems with leap years?
    Thanks and kind regards,
    Marcela.

    Hi Marcela,
    Welcome to SDN.
    You can try this FM <b>RP_CALC_DATE_IN_INTERVAL</b>.
    data: wa_date like sy-datum.
    call function 'RP_CALC_DATE_IN_INTERVAL'
             exporting
                  date      = '20080229'
                  days      = 0
                  months    = 24
                  signum    = '-'
                  years     = 0
             importing
                  calc_date = wa_date.
    Hope this will help.
    Regards,
    Ferry Lianto

  • Function for getting password with *** from the cmd?

    Hey all,
    i am trying to find a function to get a password from the user using the command prompt in a hidden way... e.g. i want the function to take the password from the user but simultaneously apear * on the screen..?
    is any function doing that ?
    thx a lot!

    Java SE 6 has a new class Console that does not echo password input. It does not print *, it prints nothing, which is tradition of console app.
    http://java.sun.com/javase/6/docs/api/java/io/Console.html

  • Get previous year from leap year

    Hi all,
    I'm stuck here trying to get the previous year for the current year, I tried these function module but didn't work, CCM_GO_BACK_MONTHS and CALCULATE_DATE.
    The problem is, in the leap year, there's Feb 29th, so I want to get 1 year before the date I enter, 2008 is a leap year, when I entered feb 29th 2008, then used the FM, then it showed me Feb 29th 2007, but 2007 doesn't have Feb 29th.
    Any advice? thanks!

    Try                                                                               
    /SAPNEA/J_SC_CALENDAR          Calendar
    /SAPNEA/JSC_LEAP_YEAR          Leap year check between two date
                                                                                    EAU0
    ISU_LEAP_DAYS_BETWEEN_2_DATES
                                                                                    FF04
    FIMA_LEAP_DAYS_BETWEEN_2_DATES
                                                                                    FV02
    LEAP_DAYS_BETWEEN_TWO_DATES                                  
    You can also look at class "CL_HRSEN00_LEAP_DAY_TOOLS"
    ^ Saquib

  • How to find leap year in sql query

    How to find leap year in sql query

    Select
    CASE
      WHEN result = 0 THEN 'Leap_Year'
      WHEN result <> 0 THEN 'Not_A_Leap_Year'
    END
    From (Select mod((EXTRACT(YEAR FROM DATE '2013-08-24')), 4) result FROM DUAL);

  • I have had Adobe XI for about two years and My harddrive just crashed. My backups were part of the failure so I can't get it back. I purchased it from a third part supplier and it was a download. I need to find out how to get it restored. I can send scree

    I have had Adobe XI for about two years and My harddrive just crashed. My backups were part of the failure so I can't get it back. I purchased it from a third part supplier and it was a download. I need to find out how to get it restored. I can send screen shots of all of the drive location where the drive is still good and I can see my Adobe Acrobat pro information, but the download itself is missing. NEXT STEP?

    If you are talking about Reader (you did post in the Reader forum), then just download http://get.adobe.com/reader/enterprise. However Reader is free not purchasable. You can download a trial then install using your serial number, which if you didn’t register or write down somewhere you will be out of luck to track down.
    Download a free trial or buy Adobe products | Adobe downloads

  • Any function module for getting fiscal year week numbers

    can any one provide me function module for getting fiscal year week numbers ? if no function module please let me know work around.
    Thanks!
    Lakshmikandh

    hi,
    Use FM <b>'DATE_GET_WEEK'</b>...
    parameter D1 LIKE SCAL-DATE.
    Data w like scal-week.
    CALL FUNCTION <b>'DATE_GET_WEEK'</b>
    EXPORTING
    date = D1
    IMPORTING
    WEEK = W
    EXCEPTIONS
    DATE_INVALID = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write W+4(2).
    Regards,
    Santosh

  • Function to get all the months name of a year from dual

    HI GURUS
    Is there any function to get all the months name of a year from dual
    thanks in advance

    What about this --
    satyaki>
    satyaki>select months_name
      2  from (
      3         select to_char(add_months(trunc(sysdate,'YEAR'),rownum-1),'MONTH') months_name
      4         from dual
      5         connect by rownum<=12
      6       );
    MONTHS_NAME
    JANUARY
    FEBRUARY
    MARCH
    APRIL
    MAY
    JUNE
    JULY
    AUGUST
    SEPTEMBER
    OCTOBER
    NOVEMBER
    MONTHS_NAME
    DECEMBER
    12 rows selected.
    satyaki>Regards.
    Satyaki De.

  • Function to get starting date of financial year ??

    Hi,
       what is the Function to get starting date of financial year. I am developing a inventory report, for that i need; start of the factory opening date. Is that factory n financial year are in the same date.
    Thanks,
    Senthil

    SEE THIS FMS.
    TSTR_PERIODS_FACTORYCALENDAR
    FACTORY_CALENDAR_GET
    RH_READ_CALENDAR

  • How to find the given year is a leap year

    Hi Experts,
    In my code "my date " value should be dynamic,it's not hard coded.In that case how can I found it is a leap year or not?
    Please advice me with coding.
    DATA: mydate TYPE d.
    mydate = '20040301'.
    mydate = mydate - 1.
    IF mydate+6(2) = '29'.
      WRITE 'A leap year'.
    ELSE.
      WRITE 'No leap year'.
    ENDIF.
    Regards,
    Sam.

    hiii
    use following code
    PARAMETERS:
              p_num(4) TYPE i.
    DATA:
          w_num type i.
          w_num = p_num.
           CALL FUNCTION 'Y_DATE'
             EXPORTING
               w_num           = p_num
              W_TEMP          = 4
              W_TEMP1         = 100
    *        IMPORTING
    *          W_MOD           =
    *          W_MOD1          =
    *        EXCEPTIONS
    *          ERROR_MOD       = 1
    *          OTHERS          = 2
           IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
    FUNCTION Y_DATE.
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(W_NUM) TYPE  I
    *"     REFERENCE(W_TEMP) TYPE  I DEFAULT 4
    *"     REFERENCE(W_TEMP1) TYPE  I DEFAULT 100
    *"  EXPORTING
    *"     REFERENCE(W_MOD) TYPE  I
    *"     REFERENCE(W_MOD1) TYPE  I
    *"  EXCEPTIONS
    *"      ERROR_MOD
    w_mod = w_num mod w_temp.
    w_mod1 = w_num mod w_temp1.
         if w_mod = 0 or w_mod1 = 0.
            write:/ w_num ,'is Leap Year'.
         else.
            write: w_num ,'is Not Leap Year'.
         endif.
    ENDFUNCTION.
    regards
    twinkal

  • Function Module to find the Begin Date of the Year

    Hi Experts,
    Could you let me know if there is a FM to find the "Begin Date of the Year".
    I appreciate your help.
    Thanks a lot.

    Hi,
    Do you want the Begin date of the <b>current</b> year..Try this..
    DATA: V_DATE TYPE SY-DATUM.
    V_DATE = SY-DATUM.
    V_DATE+4(4) = '0101'.
    WRITE: / 'Beginning date of the year ' , v_date.
    If you are mentioning about the Fiscal year..Then you can use the FM PERIOD_DAY_DETERMINE
    Thanks,
    Naren

  • When I tried to import fro my camera, I cant get the last day to import. Could  it have anything to do with Feb 29,2011 being Leap Year?

    When I tried to import  from my camera, the last day did not import, I keep retrying, but will not import. Could it have anything to do with the date Feb 29, 2012 as it was Leap Year?

    OK Texas, so nothing strange with the calendar (unless you folk have seceded since the last time I checked the news )
    Image Capture is an Apple App that comes with the OS. Allows you to do a bunch of things. Import pictures from your camera is one. Open the app with your camera connected. If you have Aperture set to open when the camera is connected just close Aperture and then open Image Capture.
    You'll see the camera and it should show you the images on the camera card. See if the images from the 29th show up.
    post the results.
    regards

  • Reg : Leap Year

    Hi All,
      Is there any function module to find, whether the
      given year is a Leap year or not? Please tell me.
      Thanks in advance.
    Thanks&Regards,
    Siri.

    hi srilatha
    I'm not sure if sap delivers such a function module but writing one yourself should be quite easy.
    Posibility one: implement the correct algorithm
    leap years are years which can be divided by 4 (e.g. 2004) but are no centuries (e.g. 1900). But years which can be devided by 400 are leap years although they are centuries (e.g. 2000 was a leap year).
    Posibility two: try the following (bases on the fact that sap can calculates the leap years correct in the date datatype)
    - define a function module
    - importing parameter iv_year (NUMC 4)
    - exporting parameter ef_leap_year (CHAR 1)
    - coding
    data:
    lv_date like sy-datum value '00000228'.
    lv_date(4) = iv_year. " set the year to the date
    ADD 1 TO lv_date. " calculate the next day
    IF lv_date+4(4) EQ '0229'. " get the MMDD part of date
    ef_leap_year = 'X'. " yes it is a leap year
    ELSE.
    ef_leap_year = ''. " no it is not a leap year
    ENDIF.
    or check this one
    FM DATE_CHECK_PLAUSIBILITY will check if a date is valid. You can either use this FM to check 28.02.xxxx for a given year, or copy the piece of coding which checks for a leap year.
    You can use FM NUMBER_OF_DAYS_PER_MONTH_GET by passing '02' as month and YEAR.
    Regards,
    naveen

  • Unable to generate the file report pdf on 29 february 2012 or during any leap year day...

    hii this is manab......
    sir/mam i have face the following error in 29 february 2012 for my overall company report .But i can easily get the
    report of another department on 29feb 2012....but when i try generate the overall report of my comapany then i find the errors
    REP-1401: 'cf_mc_prod_lyrformula': Fatal PL/SQL error occurred.
    ORA-01839: date not valid for month specified
    The following is the logfile.........
    ...........................................................................................log file................................................................................................................
    HPCL Custom Application: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    HPCCMDS module: HPC Modified CMD Report
    +---------------------------------------------------------------------------+
    Current system time is 04-SEP-2013 11:37:20
    +---------------------------------------------------------------------------+
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    Arguments
    P_MILL='NPM'
    P_TRANSACTION_DATE='2012/02/29 00:00:00'
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.US7ASCII
    REP-1401: 'cf_mc_prod_lyrformula': Fatal PL/SQL error occurred.
    ORA-01839: date not valid for month specified
    Report Builder: Release 6.0.8.24.0 - Production on Wed Sep 4 11:37:20 2013
    (c) Copyright 1999 Oracle Corporation.  All rights reserved.
    Enter Username:
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Program exited with status 1
    Concurrent Manager encountered an error while running Oracle*Report for your concurrent request 11426643.
    Review your concurrent request log and/or report output file for more detailed information.
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed
    Current system time is 04-SEP-2013 11:59:23
    +---------------------------------------------------------------------------+
    kindly give me solution .....i have e-business suite 11i
    internet explorer latest version...

    Hi,
    Please confirm whether this is a custom or standard report.
    If this is a custom report, then probably the respective issue has not been handled by exception handling.
    Also please refer note:
    How to check if version 11.5.10.2 is certified to Handle Leap Years (Doc ID 549937.1)
    Thanks &
    Best Regards,

  • How to Calculate Leap Year ago in OBIEE 11g

    Hi Gurus,
    I have one fact table and having one measure column. I have to calculate current year and Last year.
    Using Time series function (Todate,Ago) have calculated current year as well last year also.
    The problem is Current year is showing correct value only but Last year was showing wrong data.
    We found the problem is Leap year, last year FEB month is having 29 dates. Due to this we are getting wrong date.
    Kindly suggest me how to achieve this requirement.
    Thanks

    Hi Gurus,
    How to resolve Leap Year calculation in OBIEE 11g.
    The problems is Year Ago column.
    Please suggest me how to resolve this.
    Thanks

Maybe you are looking for

  • JDBC Receiver CC Error

    Hi, I have configured JDBC Reciever Adapater and i have given the paramenter like following - JDBC Drvier : com.microsoft.sqlserver.jdbc.SQLServerDriver Connection : jdbc:sqlserver://<dbServer>:14330;databaseName=<dbName> (Note - with the above detai

  • After reinstall my magic mouse and keyboard are not working properly

    so i've had various problems with my mac so did a clean reinstall, now my magic mouse wont scroll and my the f buttons on my wireless keyboard don't work ie volume buttons, i've checked the system preferences and all is well there, any ideas???? i ha

  • How can I reproduce this layout?

    Hello everyone, I'm very new and green to photoshop and indesign. Can anyone please tell me how I can reproduce this layout, with the text following the curve of the man's frame? My friend who did it says she drew the curve in using the pen bezier to

  • Active / Inactive Users on Shared Services

    Hi All, I have been trying to migrate Hyperion Shared Services 9.3.1 to 9.3.3 Now, once the migration has been successful, I try to log back using the Native User credentials. However, it fails, and I log in as an MSAD user. Now, once logged inside,

  • Owners Enabled - No

    Hi! I was looking at the info for my iPod's disk, and noticed that under "Owners Enabled", it said "No". So what I'm wondering is, should permissions be turned on for iPods? Why, or why not?