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: 

if i input present date i need 2 months back starting date

Former Member
0 Kudos

Hi Guru's

Can any one tell me the FM to get past 2 months date if i enter present date.

For Eg. Input is 14/10/2008

output should be 01/08/2008

thanks in advance

5 REPLIES 5

milusai
Participant
0 Kudos

RP_CALC_DATE_IN_INTERVAL

Former Member
0 Kudos

HI,

Try FM CALCULATE_DATE

Regards,

Amit

Former Member
0 Kudos

hi..

use the function module:

HR_HK_ADD_MONTH_TO_DATE

CALL FUNCTION 'HR_HK_ADD_MONTH_TO_DATE'
  EXPORTING
    DMM_DATIN       = p_date
    DMM_COUNT       = '2'
    DMM_OPER        = '-'
*    DMM_POS         =
* IMPORTING
*   DMM_DAOUT       =
* EXCEPTIONS
*   UNKNOWN         = 1
*   OTHERS          = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

regards,

Padma

Former Member
0 Kudos

Hi Ranjith,

Try this...

data:
new_date like sy-datum,
month(2).

parameters:
date like sy-datum.

month = date+4(2).

if month eq '01'.
  new_date(4)   = date(4) - 1.
  new_date+4(2) = '11'.
  new_date+6(2) = '01'.

elseif month eq '02'.
  new_date(4)   = date(4) - 1.
  new_date+4(2) = '12'.
  new_date+6(2) = '01'.

else.
  new_date(4)   = date(4).
  new_date+4(2) = date+4(2) - 2.
  new_date+6(2) = '01'.

  endif.
  write : / new_date.

Regards,

Rajitha.

Former Member
0 Kudos

hii

try using following FM

HR_JP_ADD_MONTH_TO_DATE -Add or Subtract Months to a Date

HR_PT_ADD_MONTH_TO_DATE-Add or subtract months to a date

regards

twinkal