Monday, December 15, 2008

Program to calculate Age of a person till the current date along with no. of days,months and years

REPORT z_no_of_days_months_years .

PARAMETERS:p_bdate TYPE sy-datum, " Begin Date
p_cdate TYPE sy-datum DEFAULT sy-datum. " Curent Date

DATA:v_months TYPE i,
v_days TYPE i,
v_years TYPE i,
v_tdays TYPE i.

CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = p_bdate
end_da = p_cdate

IMPORTING

no_day = v_days
no_month = v_months
no_year = v_years
no_cal_day = v_tdays.

write:/ 'Age: ',v_years ,'Years ',v_months, 'Months ', v_days ,'Days.'.