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: 

Adding 2 Months to sy-datum .

Former Member
0 Kudos
3,964

Hi ,

How can I add 2 months to sy-datum?

Eg:

if system date is 01.10.2008,

then the date should be 01.12.2008.

Please let me know this since it is very urgent.

Regards,

Rabiya.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
501

HI

Use this FM BKK_ADD_MONTH_TO_DATE

pass the no of months and date

Function module BKK_ADD_MONTH_TO_DATE

Import parameters Value

MONTHS 2

OLDDATE 10.02.2008

Export parameters Value

NEWDATE 10.04.2008

Or use

Function module ISP_ADDING_MONTHS_TO_DATE

Import parameters Value

MONTHS 2

START_DATE 10.10.2008

Export parameters Value

END_DATE 10.12.2008

regards

Shiva

5 REPLIES 5

Former Member
0 Kudos
502

HI

Use this FM BKK_ADD_MONTH_TO_DATE

pass the no of months and date

Function module BKK_ADD_MONTH_TO_DATE

Import parameters Value

MONTHS 2

OLDDATE 10.02.2008

Export parameters Value

NEWDATE 10.04.2008

Or use

Function module ISP_ADDING_MONTHS_TO_DATE

Import parameters Value

MONTHS 2

START_DATE 10.10.2008

Export parameters Value

END_DATE 10.12.2008

regards

Shiva

Former Member
0 Kudos
501

Hi,

Date:01.10.2008

v_var = date+3(2).

v_var1 = v_var.

v_var1 = v_var1 + 2.

replace first occurence of v_var in date with v_var1.

try this..

Regards,

Karthick.

RemiKaimal
Active Contributor
0 Kudos
501

Hi,

Use the FM : RE_ADD_MONTH_TO_DATE

Usage :


DATA new_date  LIKE sy-datum.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
  EXPORTING
    months  = '2'
    olddate = sy-datum
  IMPORTING
    newdate = new_date.

new_date will hold your new date.

Cheers,

Remi

Former Member
0 Kudos
501

Hi,

By using following function module you can add or delete months to the given input in exporting parameter.

DATA: VAR1 TYPE SY-DATUM.

  • This gives the previous month and next month

CALL FUNCTION 'HR_PT_ADD_MONTH_TO_DATE'

EXPORTING

dmm_datin = sy-datum

dmm_count = '2'

dmm_oper = '+' " Operation (add/subtract)

dmm_pos = 'B' " Set date in the beginning or end of month

IMPORTING

DMM_DAOUT = VAR1

EXCEPTIONS

UNKNOWN = 1

OTHERS = 2.

WRITE:/ VAR1.

Reward points,if it is useful.

Regards,

Chandu.

Former Member
0 Kudos
501


Try FM RP_CALC_DATE_IN_INTERVAL. 

Pass 
DATE = <sy-datum>
DAYS = '00'
MONTHS = '01'
SIGNUM = '+'
YEARS = '00'

And the FM will return the calculated date in CALC_DATE variable.

Hope this helps.

Thanks,

Balaji