Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date

Former Member
0 Likes
530

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
512

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

4 REPLIES 4
Read only

Former Member
0 Likes
513

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

Read only

Former Member
0 Likes
512

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.

Read only

Former Member
0 Likes
512

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

Read only

Former Member
0 Likes
512

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