Application Development and Automation 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: 
Read only

FUNCTION MODULE TO ADD MONTHS TO A DATE

former_member632991
Active Contributor
0 Likes
33,762

hi

what is the function module to add months to a date.

i am using HR_PSD_DATES_ADD_MONTHS .

but if i am passing 31.1.2008 and adding 12 months then it is giving

31.1.2009 but it shud give 30.1.2009

11 REPLIES 11
Read only

Former Member
0 Likes
10,630

Hi sonika,

1. u can also use HR_JP_ADD_MONTH_TO_DATE

2. Normally

3. 31.01.2008 + 1 year

=

31.01.2009

4. But, if u want 30.01.2009,

then u can simply

do

date = date - 1.

(where date contains the calcualted figure of 31.01.2009)

regards,

amit m.

Read only

Former Member
0 Likes
10,630

Hi sonika,

use any of the following fms to add months to date..

u just have to pass two parameters..the months to be aDDED AND THE DATE

BKK_ADD_MONTH_TO_DATE

/BEV3/CHPS__ADD_MONTH_TO_DATE

with regards,

all the best,

sampath

*award if helpful and close the thread

Read only

Former Member
0 Likes
10,630

Hi Sonika,

<b>Run the below code to get u r result</b>

<b>Report zex33.

parameter : p_date(10),

p_months like T5A4A-DLYMO.

data : p_format type XUDATFM value 1,

date type datum,

v_dates like sy-datum.

CALL FUNCTION 'DATE_STRING_CONVERT'

EXPORTING

DATE_FORMAT = p_format

DATE_STRING = p_date

  • START_DATE = SY-DATUM

IMPORTING

RESULT_DATE = date.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = date

days = 0

months = p_months

signum = '+'

years = 0

importing

calc_date = v_dates.

write : / v_dates.</b>

give input as

p_date : 31.01.2008

p_months : 12

Read only

Former Member
0 Likes
10,630

try this

RE_ADD_MONTH_TO_DATE

Read only

Former Member
0 Likes
10,630

try this

RE_ADD_MONTH_TO_DATE

Read only

Former Member
0 Likes
10,630

Hi,

I hope one of the following FM's will solve your problem.

<b>RP_CALC_DATE_IN_INTERVAL :</b> Add/subtract years/months/days from a date

<b>MONTH_PLUS_DETERMINE :</b> Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.

<b>RE_ADD_MONTH_TO_DATE :</b> Can add/subtract months to/from date.

Reward points if the answer is helpful.

Regards,

Mukul

Read only

Former Member
0 Likes
10,630

would you please be so nice to explain to me brainless bugger why you intend to get the 30.01.2009?

in my eyes the 31.01.2009 is quite fine.

12 month = 1 year = 365 days. since it´s 2008 we´re talking about it´s even 366 days (29 days february).

maybe thats why you get the 31.01.2009?

what is the difference between adding 12 month and a year?

Read only

0 Likes
10,630

Hi Florian,

YOu are spot on. She might have got confused with the leap year thingie.

Regards,

ravi

Read only

Former Member
0 Likes
10,630

use the FM RP_CALC_DATE_IN_INTERVAL

Read only

former_member632991
Active Contributor
0 Likes
10,630

.

Read only

Former Member
0 Likes
10,630

Hi Sonika,

Please Refer below Link

Regards,

Pritesh Raut