Skip to Content
author's profile photo Former Member
Former Member

FM TO ADD YEARS TO CURRENT DATE - URGENT

Hi All,

I need a FM which will calculate the future date for the given date and year.

say, current date = 06/19/2008 and nyear = 2.

the fm should calculate and produce the result as 06/19/2010.

All quick inputs in this regard will be great help and highly appreciated.

Thanks,

Vaishnavi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 07:00 AM

    RP_CALC_DATE_IN_INTERVAL

    Add/subtract years/months/days from a date

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 07:00 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 07:01 AM

    hi try

    DATE_CREATE

    REPORT zcs_date_create.

    PARAMETERS : date TYPE dvalut, " input date

    dates(2) TYPE n, " dates to be increased

    months(2) TYPE n, " months to be increased

    years(4) TYPE n, " years to be increased

    v_tag TYPE c, " parameter to get last day of that month

    in output date v_dayinc(2) TYPE n. " this is used to increase day of given date in the output

    DATA: v_date TYPE dvalut,

    v_day (2) TYPE n. " it returns the day of the given date

    CALL FUNCTION 'DATE_CREATE'

    EXPORTING

    anzahl_jahre = years

    anzahl_kaltage = dates

    anzahl_monate = months

    anzahl_tage = v_dayinc

    datum_ein = date

    ultimo_setzen = v_tag

    IMPORTING

    datum_aus = v_date

    e_tt = v_day.

    WRITE:/ 'given date', date.

    IF v_tag = ' '.

    WRITE:/ 'required date',v_date.

    ELSEIF v_tag = 'X'.

    WRITE:/ 'last date of that month in the output date ', v_date.

    ELSE.

    EXIT.

    ENDIF.

    IF v_dayinc IS INITIAL.

    WRITE:/ 'day of given date', v_day.

    ELSE.

    WRITE:/ 'after incremented of',v_dayinc,'of given day',v_day.

    ENDIF.

    regards

    prasanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 07:02 AM

    Hi,

    Please use FM RP_CALC_DATE_IN_INTERVAL.

    Input the date in Date field and SIGNUM should be '+' and inout years as '02'.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 07:05 AM

    Hi,

    Try

    use FM RP_CALC_DATE_IN_INTERVAL

    codecall function 'RP_CALC_DATE_IN_INTERVAL'

    exporting

    date = '06/15/2006'

    days = 14

    months = 0

    signum = '+'

    years = 0

    importing

    calc_date = wa_date.

    Reward pts if usefull.

    regards,

    dhan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.