Function module to find the months between two different dates
I have a requirement in which the client wants to change the product from existing one to new product(report)....and i have to check whether the client is changing the product before 12 months of the issue date of existing product.
How do i do this..is ther any function module to find the month between two different dates??
Check the following code:
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
FROMDATE = SY-DATUM - 60.