Current date + 1 year

Hi,
Can anyone please tell me what is the easy method to calculate current date + 1 year?
Is there any function module available?
Thanks..
Swetha.

Beware of Leap Years.
I Tried this and it works
data date type sy-datum.
data i_date type sy-datum value '20080229'.
CALL FUNCTION 'ADD_TIME_TO_DATE'
  EXPORTING
    I_IDATE                     = i_date
    I_TIME                      = '1'
    I_IPRKZ                     = '3'
*   I_RDMHD                     =
IMPORTING
   O_IDATE                     = date
* EXCEPTIONS
*   INVALID_PERIOD              = 1
*   INVALID_ROUND_UP_RULE       = 2
*   INTERNAL_ERROR              = 3
*   OTHERS                      = 4
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 date.
i_iprkz = 3 means years and i_time is the increase

Similar Messages

  • Show Current Date in Year Format (and now - 1, etc.)

    Our form has some column headers that need to change each year, the headings are current year (2010) + previous 3 years.  Am trying to programatically add the titles to eliminate modifying the form just to change the year, but not finding how to accomplish, and was checking out some date samples found, but no success yet.  My question is 2 part - how/where do I put code, I don't need the user to enter anything, just want a column header.  This example below is where I copied the idea from a sample and tried to adjust, it's on the calculate event of a date/time field, and I get an error message that says 'the display pattern "date-{MM/DD]" is incompatible with the object's data format.  Define a compatible Display pattern.  This display pattern error is the 2nd part of the question.  How do I display only the 4 digit year?
    year1.rawValue
    = num2date(date(), "YYYY")
    How do I accomplish this - am newbie on this!  Thank you very much!

A: Show Current Date in Year Format (and now - 1, etc.)

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

  • Help creating a formula which returns current date last year

    I need help creating a formula which returns the current date last year. I also need it to work during leap years.
    Any ideas?

    Hi Dagros,
    I'm lucky to be a universe designer, I have to do this only once
    The easiest way would probably be to use
    =RelativeDate(CurrentDate();-365)
    So subtractiing 365 to get the same date last year,
    but you would need some extra logic for the years with a feb 29 in those 365 days.
    =If FormatDate(RelativeDate(CurrentDate();-365);"dd") = FormatDate(CurrentDate();"dd")
    Then RelativeDate(CurrentDate();-365)
    Else RelativeDate(CurrentDate();-366)
    Another question to ask is if you really want the same date last year, or if you also want a really 'same day' so monday compared to monday etc. in this case you would just subtract 364 days and get the day 52 weeks back...
    Good luck,
    Marianne

  • Current date - 1 year in OBIEE

    Hi Friends,
    I have a  SR date column in OBIEE. Every day service requests will be submitted.  I want to put a filter on the report  every time when someone opens the report. I should always pull SR dates  between current date and  last year current date...In short, I want to see all the SR's from curret date to last year....
    Thanks
    V

    Put filter on open date as greater than or equals to timestampadd(sql_tsi_year,-1, curent_date)
    btw: what news on this?
    https://forums.oracle.com/thread/2572036
    if helps mark

  • Current date - 2 years

    Hi
    I need to get one of the report header column  like  current year - 2 based on the current date.
    For suppose format is like below
    2010 03
    if todays date is  10/03/2012
    I need to display  2010 03
    There is no source for  date column .
    I am using xir4 and Bex Query is the source.
    Can any body help me/
    Thanks.

    Hi,
    Try with relativedate function.
    like =relativedate((currentdate);-2) by this you will get two year back date.
    =formatdate(relativedate((currentdate);-2);"YYYYmm")
    or first get year then month by relative date function and use  concatenation.
    =formatdate(relativedate((currentdate);-2);"YYYY")
    =formatdate(relativedate((currentdate);-2);"mm")
    Thanks,
    Amit

  • Current date month year in flex

    can anyone let me know how to get current system date in flex
    and how to compare seleted date and system date in flex
    thanks in advance

    below is the example code which get the date, month and year
    when you try to access the month it return less than one (if you try to get the month when the month is set to jan it return zero ) while displaying we need to increment as months starts from one
    import mx.controls.Alert;
    public function init():void
    var dt:Date= new Date();
    Alert.show("date : "+dt.getDate().toString()+"\nmonth : "+Number(Number(dt.getMonth().toString())+1) +"\nYear : "+dt.getFullYear().toString());
    if this post answers your question or helps, please mark it as such

  • Newbie: how to create a dynamic select list of the current date + 5 years

    Hi - I'm a JSP newbie (coming from a PHP background), and am trying to create a select list that contains the current year, plus 5 years. So, the list when generated (today), would display:
    2007
    2008
    2009
    2010
    2011
    2012
    Obviously, the code would need to generate inside the option tags, as well as in the value property of the option tag.

    function addit(){
              var val = 2012; //you can take this from js date object and strip it off
              for (var i=2007; i <= val;++i){
                   addOption(document.getElementById("mycombo"), i, i);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = text;
         optn.value = value;
         selectbox.options.add(optn);
    }without hardcoding:
    function addit(){
              var dd = new Date();
              var yearnow = dd.getFullYear();
              for (var i=yearnow; i <= yearnow + 5 ;++i){
                   addOption(document.getElementById("mycombo"), i, i);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = text;
         optn.value = value;
         selectbox.options.add(optn);
    in your jsp:
    <body onload="addit();">
    <form>
    <select name="mycombo">
    <option> Select year</option>
    </select>
    </form>
    </body>
    Message was edited by:
    skp71
    Message was edited by:
    skp71

  • Fixed report period based on current date

    I want to create a report containing records over a fixed period without using a date parameter. As a example I would like the report to continually draw on data that is no more than say ten years from the current date.
    E.g. Current date (xx/xx/2008) to (Current date - 10 years) or xx/xx/1998 then next year the formula would automatically adjust to current date (xx/xx/2009) to (Current date - 10 years) or xx/xx/1999.
    I am only a novice when it comes to designing reports so please bear that in mind.

    Hi,
    Create a RecordSelectionFormula and subtract 10 years from the current date with the DateAdd formula.
    E.g.
    //DateAdd (intervalType, nIntervals, startDateTime)
    {Table.Date} > DateAdd ("yyyy", -10, CurrentDate)
    The DateAdd function has more interval types, so you can subtract months, days, hours as well. Check the CR help file and search for DateAdd for details.
    Cheers,
    Fritz

  • How to fetch year till date value for earning for current ,last and year

    hi,
    how to fetch year till date value for earning for current ,last and year before that from payroll result
    plz reply soon,
    pratyush

    Dear Pratyush,
    Pick this from CRT.
    Use LDB PNPCE & Fire event GET PAYROLL &
    then you can pick from CRT.
    Hope this helps.
    Kindly reward in case useful.
    Regards & Thanks,
    Darshan Mulmule

  • UIX 2.1.21: Date OnBlurValidator automatically add current month or year?

    Would be nice if the OnBlurValidator for a UIX Date field could automatically add a missing month or year.
    e.g. Format dd.mm.yyyy
    When the user enters 01.01. the current year could be added automatically.
    Or when the users only enters 01. the current month and year could be added.
    Would be a nice feature additionally to the already existing lenient-date-formats = true.
    Really great would be to allow entering values like "now" / ".", "yesterday" / "-" or "tomorrow" / "+" that are evaluated to the according dates (of course internationalized).
    Thanks, Markus

    hey mill1640,
    Did you ever get your iPhone to register with iTunes? I just upgraded as well to Snow Leopard, and my my isn't recognized at all also.
    If you did get this resolved, I would appreciate a little suggestion in the right direction.
    Many thanks,
    Josh

  • FM to calculate date month & year six months previous to the current date

    Hi All,
    Is there any function module or code to calculate date month & year six months previous to the current date.
    Thanks in advance.

    hi,
    try this
      data : date1 like vbak-erdat.
    data : q type numc3.
    selection-screen : begin of block blk2 with frame title text-001.
    parameters : n like q.
    selection-screen : end of block blk2.
    if n > 0.
    CALL FUNCTION 'CCM_GO_BACK_MONTHS'
             EXPORTING
               CURRDATE         = sy-datum
               BACKMONTHS       = n
           IMPORTING
              NEWDATE          = date1
    selection-screen: begin of block blk1 with frame title text-001.
    select-options :  s_date for vbak-erdat default 'NEWDATE'  to 'sy-datum' no-display.
    selection-screen : end of block blk1.
    write : date1.
    Reward with points if helpful.

  • Adding a year to the current date field

    Hello,
    Can any one please help on how to add a year to the current date field.
    e.g 7/19/2011 plus a year = 7/19/2012
    Thanks,
    Han Dao

    If you had a field DateTimeField1 and wanted to display the following year in DateTimeField2, you could do the following in JavaScript;
    var d1 = util.scand("yyyy-mm-dd", DateTimeField1.rawValue);
    if (d1 !== null)
    d1.setFullYear(d1.getFullYear()+1);
    DateTimeField2.rawValue = util.printd("yyyy-mm-dd", d1);
    Good luck
    Bruce

  • FM to find date 1 year prior to current date.

    Hi All,
    Can anyone suggest a Function Module to fetch the date 1 year prior to current date?
    Thanks in advance,
    Anjum.

    Hi,
    these r the variable names we can use it in reporting side..
    i have given the link for all the sap exit variables..
    http://help.sap.com/saphelp_nw70/helpdata/EN/99/ae22419e2ab167e10000000a155106/frameset.htm
    0CYTCD - is the variale name can be used for 1st date to current date of the year
    i think u r also looking for the same..
    for any further clarifications please reply to this message
    Regards,
    Vijay.

  • Web-Outlook appointments which are one year before the current date are removed

    Hi,
    my Web-Outlook works fine with my iPHONE4s but the appointments which are one year befoer the current date are removed.
    Is there an option to keep all appointments?
    regards
    Andreas

    For the OST problem, delete the OST file and let Outlook create a new one.  But your problem may be that Outlook connects to Exchange 2013 using Outlook Anywhere only--MAPI RPC is gone--and for that you need a valid certificate.  So the self-signed
    certificate is likely your main problem.
    For a self-signed certificate to work, you must add it to every client as a trusted certificate.  That is hard to do with mobile devices, which is why it's recommended to obtain a certificate from a trusted public certificate authority.  You'd
    probably find Go Daddy to be reasonably priced, and there are others.
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • Posting a full years worth but only display current date

    i am wondering how i go about posting my rss feed for the whole year but only allow itunes to read the current date? i understand from research that it takes the most current date and uses that as the first. but if i wanted to display September's 06 podcast in September and not July's 07 then how would i do that. i have seen some software that you can purchase that will do this for you, but i would rather code it my self or with the help of others. does anyone have any ideas on how this is done? or have you done it your self. any thoughts or ideas are very welcomed.

    not quite. i have cooking videos that i would like to be availbe new episode every 2 weeks. so my rss feed is set up with 27 diferent items, because 52/2=27 52 is the number of weeks. any who so there are 27 diferent items in the rss feed all with the diferent dates. (item 1= aug 30, item 2=sept sept 13, item 3= sept 27....) but on sept 13 the only items that should display would be the aug 30th and the sept 13th. but when sept 27th roles around all prev. are displayed includeing the new sept 27th episode.
    i understand that i can just reupload the rss feed and ping the system. but i am just trying to see if i can do this automated style for ease of use and to be able to concentrate on other things.
    thank you for your quick reply.

  • Maybe you are looking for

    • HT1349 how to delete multiple items in itunes

      how to delete multiple items in itunes

    • IWeb PDFs

      How do I add a pdf link to my website so that when clicked on it always opens the pdf in a new window, regardless of right-click or left-click or how any individual visitor's browser preferences are set? -- Thanks.

    • Mail won't launch under OS 10.4.7

      I just upgraded from 10.3.9 to 10.4.7...installed all updates, repaired permissions, etc. When I launch Mail, I get this error message: Link (dyld) error: Symbol not found: _DeleteSeenPOPMessagesCompleted Referenced from: /Applications/MALTX_r10c2/Ma

    • A few keys not working - faulty keyboard?

      Hi, A friend of mine (honest!) spilt a v.small amount of water on her keyboard on her 2.16ghz 17" MBP and decided to dry it out using a hair dryer. One melted keyboard later and I was asked to replace her keyboard for her. So having bought and fit a

    • Mail suggestion

      Is there a suggestion box on this site? I have one for Mail. If I remember correctly, in 10.4 or 10.5 you could designate incoming mail as Junk by just dragging it to the Junk mailbox. That no longer works. I would like that to be restored. The advan