Friday, November 23, 2007

sap abap program for Find the difference between two days in days, months and years

*
* Type in two date and find the difference between the two dates in
* days, months and years.
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*
*
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.

No comments:

Blog Archive