‎2007 May 24 8:00 AM
I have a date field..
In that I want to subtract some months..
Date1 = 27.05.2007
Month = 3 months
Date2 = 27.02.2007
Help me to proceed this logic with function module.
...What is the function module to get this liogic.
‎2007 May 24 8:04 AM
Hi!
Use this Function Module
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
Subtract the months u want ..........
regards........
‎2007 May 24 8:01 AM
Hi,
I don't think any FM available for your purposes.
But you can try something like this.
DATA: BEGIN OF ITAB OCCURS 0,
SPMON TYPE UMC_Y_VALIDFR,
END OF ITAB.
PARAMETERS PSPMON TYPE UMC_Y_VALIDFR DEFAULT '2007004'.
START-OF-SELECTION.
ITAB-SPMON = PSPMON.
DO 12 TIMES.
IF ITAB-SPMON+4(3) = '000'.
ITAB-SPMON+4(3) = '012'.
ITAB-SPMON(4) = ITAB-SPMON(4) - 1.
ENDIF.
APPEND ITAB.
ITAB-SPMON = ITAB-SPMON - 1.
ENDDO.
READ TABLE ITAB INDEX 12.
WRITE: / ITAB-SPMON.
Kishi.
‎2007 May 24 8:02 AM
‎2016 Feb 08 3:05 PM
‎2007 May 24 8:03 AM
‎2007 May 24 8:04 AM
also chk this
REPORT abc MESSAGE-ID zz.
DATA : currdate LIKE sy-datum,
backmonths(3) TYPE n,
newdate LIKE sy-datum.
currdate = sy-datum.
backmonths = '3'.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = currdate
backmonths = backmonths
IMPORTING
newdate = newdate.
WRITE : newdate.
‎2007 May 24 8:03 AM
‎2007 May 24 8:03 AM
‎2007 May 24 8:04 AM
Hi!
Use this Function Module
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
Subtract the months u want ..........
regards........
‎2007 Nov 16 12:40 PM
even by that you can extract the value required.
You can also use one more function module OIL_DATE_SUBTRACT_MONTH.