Thursday, September 13, 2007

To subtract year months and date from a particular date

REPORT ZHAR_PRG .

***************Data Declartion************************************
DATA: E_DAYS LIKE VTBBEWE-ATAGE,
E_MONTHS LIKE VTBBEWE-ATAGE,
E_YEARS LIKE VTBBEWE-ATAGE.

***************Parameters for Selection****************************
PARAMETERS: FRMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.

*******Call Function To Subtract Years,Month and Days**************
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FRMDATE
i_date_to = TODATE
* I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = E_DAYS
E_MONTHS = E_MONTHS
E_YEARS = E_YEARS.

********* To Display The Data****************************************
WRITE:/5(30) 'Diff in No.Of.Days ', E_DAYS.
WRITE:/5(30) 'Diff in No.Of.Months ',E_MONTHS.
WRITE:/5(30) 'Diff in No.Of.Years ', E_YEARS.

***************To Initialize****************************************
INITIALIZATION.
FRMDATE = SY-DATUM - 60.

No comments: