Application Development 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: 

How Can We calculate employee total experience.

Former Member
0 Kudos

Dear Guru's.

i want to calculate Employee total experience.

for example.

company1 from 01/01/2006 to 31/10/2006.

company2 from 01/11/2006 to 01/05/2007.

here i want to calculate employee total experience.

i need output in following format.

year months

1 5

please help me to get the output .

1 ACCEPTED SOLUTION

naveen_inuganti2
Active Contributor
0 Kudos

Hi...

Try with....

HRVE_GET_TIME_BETWEEN_DATES function module...

Here the logic for your requirement....

>data: varm(2) type p,

> vary(2) type p,

> vard(2) type p,

> var1(2) type p,

> var2(2) type p.

>

>call function 'HRVE_GET_TIME_BETWEEN_DATES'

> exporting

> BEG_DATE = '20060101'

> END_DATE = '20061031'

> IMPORTING

> DAYS = vard

> MONTHS = varm

> YEARS = vary

> EXCEPTIONS

> INVALID_PERIOD = 1

> OTHERS = 2

>

>move varm to var1.

>move vary to var2.

>clear: varm, vary, vard.

>

>call function 'HRVE_GET_TIME_BETWEEN_DATES'

> exporting

> BEG_DATE = '20061101'

> END_DATE = '20070501'

> IMPORTING

> DAYS = vard

> MONTHS = varm

> YEARS = vary

> EXCEPTIONS

> INVALID_PERIOD = 1

> OTHERS = 2.

>

>

>var1 = var1 + varm.

>var2 = var2 + vary.

>

>clear: vard, varm, vary.

>

>if var1 > 12.

>var1 = var1 - 12.

>var2 = var2 + 1.

>endif.

>

>write:/ 'Total Experiance',

> var2,

> 'Years',

> var1,

> 'Months.'.

Thanks,

Naveen Inuganti.

3 REPLIES 3

naveen_inuganti2
Active Contributor
0 Kudos

Hi...

Try with....

HRVE_GET_TIME_BETWEEN_DATES function module...

Here the logic for your requirement....

>data: varm(2) type p,

> vary(2) type p,

> vard(2) type p,

> var1(2) type p,

> var2(2) type p.

>

>call function 'HRVE_GET_TIME_BETWEEN_DATES'

> exporting

> BEG_DATE = '20060101'

> END_DATE = '20061031'

> IMPORTING

> DAYS = vard

> MONTHS = varm

> YEARS = vary

> EXCEPTIONS

> INVALID_PERIOD = 1

> OTHERS = 2

>

>move varm to var1.

>move vary to var2.

>clear: varm, vary, vard.

>

>call function 'HRVE_GET_TIME_BETWEEN_DATES'

> exporting

> BEG_DATE = '20061101'

> END_DATE = '20070501'

> IMPORTING

> DAYS = vard

> MONTHS = varm

> YEARS = vary

> EXCEPTIONS

> INVALID_PERIOD = 1

> OTHERS = 2.

>

>

>var1 = var1 + varm.

>var2 = var2 + vary.

>

>clear: vard, varm, vary.

>

>if var1 > 12.

>var1 = var1 - 12.

>var2 = var2 + 1.

>endif.

>

>write:/ 'Total Experiance',

> var2,

> 'Years',

> var1,

> 'Months.'.

Thanks,

Naveen Inuganti.

Former Member
0 Kudos

Hi,

Separately for both companies first you use this function module to get the experience in one company::

HR_HK_DIFF_BT_2_DATES

select the appropriate output type

Then you add both the durations to get the total experience.

I have done like this only..

Reaward if useful

regards,

Nishant

Former Member
0 Kudos

Hi rajkumar,

1. We can use the FM

HR_HK_DIFF_BT_2_DATES

2. Pass Date1 as new date (greater one)

Date2 as old date

Output_Format = '08'

So you will basically get the number of months

3. Do this for both the records,

and add the number of months for each

4. Then you can divide by 12 or MOD by 12

and get the years and months.

regards,

amit m.