‎2008 Mar 07 7:52 PM
Hi,
Please can anyone help to calculate the Age of employees.
Without using function modules
For example my employee age is 19810202.
how can i calculate his age of today
Thanks,
GAL
‎2008 Mar 07 7:56 PM
Difference from today is the age.
Y is that you don't want to use any modules?
Ok Read year, month, day into three separate variables and check the difference.
then Write it...in output
thanks
Edited by: Alchemi on Mar 7, 2008 1:57 PM
‎2008 Mar 07 7:56 PM
Difference from today is the age.
Y is that you don't want to use any modules?
Ok Read year, month, day into three separate variables and check the difference.
then Write it...in output
thanks
Edited by: Alchemi on Mar 7, 2008 1:57 PM
‎2008 Mar 07 7:58 PM
you will get no. of days difference.
simple subtraction.
x = current date - birthdate.
for eg :
if x = 365 days ur employee age is 1 yr.( just an example)
work out ur logic.
‎2008 Mar 07 8:00 PM
say for eg:age is 19830407
data:c_age value '19830407'
data:v_age like sydatum.
write:/ v_age - c_age.
Edited by: sukruthi raj on Mar 7, 2008 9:00 PM
‎2008 Mar 07 8:02 PM
hi this may useful for u,
this calculate the difference of two dates, first u get it and u will add it to his age, and you can get the coding the inside the function module , copy it and use it in the program...
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.
<REMOVED BY MODERATOR>
venkat.
Edited by: Alvaro Tejada Galindo on Mar 7, 2008 4:47 PM