Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Function module to find the months between two different dates

Hi,

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??

Tags:
Former Member
Former Member replied

Hi,

Check the following code:

REPORT ZDATEDIFF.

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'

exporting

i_date_from = FROMDATE

i_date_to = TODATE

  • I_FLG_SEPARATE = ' '

IMPORTING

E_DAYS = EDAYS

E_MONTHS = EMONTHS

E_YEARS = EYEARS.

WRITE:/ 'Difference in Days ', EDAYS.

WRITE:/ 'Difference in Months ', EMONTHS.

WRITE:/ 'Difference in Years ', EYEARS.

INITIALIZATION.

FROMDATE = SY-DATUM - 60.

Regards,

Bhaskar

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question