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

10|10000 characters needed characters exceeded

### Related questions

Former Member
Posted on Jun 19, 2008 at 07:00 AM

RP_CALC_DATE_IN_INTERVAL

10|10000 characters needed characters exceeded
• Former Member
Posted on Jun 19, 2008 at 07:00 AM
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

10|10000 characters needed characters exceeded
• Former Member
Posted on Jun 19, 2008 at 07:02 AM

Hi,

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

Thanks,

Sriram Ponna.

10|10000 characters needed characters exceeded
• 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