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: 

FM TO ADD YEARS TO CURRENT DATE - URGENT

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

RP_CALC_DATE_IN_INTERVAL

Add/subtract years/months/days from a date

5 REPLIES 5

Former Member
0 Kudos

RP_CALC_DATE_IN_INTERVAL

Add/subtract years/months/days from a date

Former Member
0 Kudos

Reward Points..

prasanth_kasturi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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