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: 

attrition rate report

Former Member
0 Kudos

Hi experts,

is there a standard query/report to find out the attrition rate in an organisation?

points will be rewarded on useful answers.

thanx in advance

viggy

1 REPLY 1

Former Member
0 Kudos

Hi,

As par as my knowledge is concerned there is no Std report for this Attrition.

see the developed report.

REPORT ZH_REPT_ATTRITION

line-size 250

line-count 80

message-id zh_mp

no standard page heading.

************************************************************************

  • T A B L E S

************************************************************************

TABLES: pa0000,

pa0001,

hrp1000.

************************************************************************

  • S E L E C T I O N S C R E E N

************************************************************************

selection-screen begin of block s1 with frame title text-001.

parameters: p_year like anek-gjahr. "Year

selection-screen end of block s1.

************************************************************************

  • D A T A

************************************************************************

  • Internal Tables

  • Internal table to hold personnel numbers

data: begin of it_pa0000 occurs 0,

pernr like pa0000-pernr, "Personnel number

begda like pa0000-begda, "Beginning date

endda like pa0000-endda, "End date

stat2 like pa0000-stat2, "Status whether active or withdrawn

end of it_pa0000.

  • Internal table to hold person-org unit relation

data: begin of it_pa0001 occurs 0,

pernr like pa0001-pernr,

begda like pa0001-begda, "Beginning date

endda like pa0001-endda, "End date

orgeh like pa0001-orgeh,

end of it_pa0001.

  • Internal table to hold org unit description

data: begin of it_hrp1000 occurs 0,

objid like hrp1000-objid,

short like hrp1000-short,

end of it_hrp1000.

  • Internal table to hold sorted data

data: begin of it_sort occurs 0,

org_text like hrp1000-short,

month like anek-monat,

status like pa0000-stat2,

pernr like pa0000-pernr,

end of it_sort.

  • Internal table to hold summarised attritions monthly

data: begin of it_summary occurs 0,

org_text like hrp1000-short,

month like anek-monat,

v_emp_total type i,

v_emp_quit type i,

monthly_attrition type p decimals 2,

annual_attrition type p decimals 2,

end of it_summary.

  • Internal table to hold attrition rates of the company

data: begin of it_total occurs 0,

month like anek-monat,

v_emp_total type i,

v_emp_quit type i,

monthly_attrition type p decimals 2,

annual_attrition type p decimals 2,

end of it_total.

  • data

DATA: v_begda like pa0000-begda,

v_endda like pa0000-endda.

************************************************************************

  • I N I T I A L I Z A T I O N

************************************************************************

INITIALIZATION.

move sy-datum+0(4) to p_year.

************************************************************************

  • A T S E L E C T I O N S C R E E N

************************************************************************

AT SELECTION-SCREEN.

  • check if year is in future

if p_year > sy-datum+0(4).

message e000 with text-002.

endif.

************************************************************************

  • S T A R T O F S E L E C T I O N

************************************************************************

START-OF-SELECTION.

  • arrive at beg date and end date based on selection

perform determine_dates.

  • get all personnel numbers from PA0000

perform get_pernr.

  • get relevant organisational units

perform get_org_units.

  • get organisational units' description

perform get_org_desc.

************************************************************************

  • E N D O F S E L E C T I O N

************************************************************************

END-OF-SELECTION.

  • sort data as per months

perform sort_data.

  • sum up monthly data

perform it_summary.

  • transpose data as per required output

  • perform transpose_data.

  • display results

perform basic_list.

************************************************************************

  • F O R M S

************************************************************************

&----


*& Form determine_dates

&----


  • determines begda and endda of selection period

----


FORM determine_dates.

concatenate p_year '01' '01' into v_begda.

concatenate p_year '12' '31' into v_endda.

ENDFORM. " determine_dates

&----


*& Form get_pernr

&----


  • Gets all personnel numbers which are valid within the selection

  • period from table PA0000

----


FORM get_pernr.

select pernr

begda

endda

stat2

from pa0000

into

table it_pa0000

where ( begda >= v_begda )

or ( endda >= v_endda ).

ENDFORM. " get_pernr

&----


*& Form get_org_units

&----


  • gets org units from table pa0001

----


FORM get_org_units.

select pernr

begda

endda

orgeh

from pa0001

into table it_pa0001

for all entries in it_pa0000

where pernr = it_pa0000-pernr

and begda = it_pa0000-begda

and endda = it_pa0000-endda.

ENDFORM. " get_org_units

&----


*& Form get_org_desc

&----


  • gets organisational units' description from table hrp1000

----


FORM get_org_desc.

select objid

short

from hrp1000

into table it_hrp1000

for all entries in it_pa0001

where plvar = '01'

and otype = 'O'

and objid = it_pa0001-orgeh.

ENDFORM. " get_org_desc

&----


*& Form sort_data

&----


  • Sorts the data as per months

----


FORM sort_data.

  • Internal table to hold employees quit

data: begin of it_emp_quit occurs 0,

pernr like pa0000-pernr,

end of it_emp_quit.

  • data

data: v_month(2) type n,

v_begmonth(8),

v_endmonth(8),

v_quit_recent_fg(1). "flag to check if this employee is counted

v_month = '01'.

while v_month <= '12'.

concatenate p_year v_month '01' into v_begmonth.

  • call function to get last date of the month

CALL FUNCTION 'ZH_LAST_DAY_OF_MONTH'

EXPORTING

YEAR = p_year

MONTH = v_month

IMPORTING

LASTDAY = v_endmonth.

clear it_pa0000.

loop at it_pa0000.

v_quit_recent_fg = 'X'.

  • check for employees

  • if endda is not before this month's start date and

  • if begda is not after this month's end date

if ( not it_pa0000-endda < v_begmonth and

not it_pa0000-begda > v_endmonth ).

clear it_pa0001.

  • get the related organisational unit

read table it_pa0001 with key pernr = it_pa0000-pernr

begda = it_pa0000-begda

endda = it_pa0000-endda.

if sy-subrc = 0.

clear it_hrp1000.

  • get the description of the organisational unit

read table it_hrp1000 with key objid = it_pa0001-orgeh.

if sy-subrc = 0.

  • check if status is '0' --- withdrawn, which has to be considered

  • only once

if it_pa0000-stat2 = '0'.

clear it_emp_quit.

read table it_emp_quit with key pernr = it_pa0000-pernr.

if sy-subrc = 0.

  • set flag ----- this employee is not to be counted

v_quit_recent_fg = ' '.

endif.

  • add this employee to it_emp_quit

move it_pa0000-pernr to it_emp_quit-pernr.

collect it_emp_quit.

clear it_emp_quit.

sort it_emp_quit.

endif. "if pa0000-stat2 = '0'

if v_quit_recent_fg = 'X'.

  • move reqd data to internal table sort

move v_month to it_sort-month.

  • pernr taken only for check

move it_pa0000-pernr to it_sort-pernr.

move it_pa0000-stat2 to it_sort-status.

move it_hrp1000-short to it_sort-org_text.

append it_sort.

clear it_sort.

endif.

endif. "if sy-subrc = 0.

endif. "if sy-subrc = 0.

endif. "end if not it_pa0000-endda < v_begmonth.

endloop.

add 1 to v_month.

endwhile.

  • free internal table not required further

free: it_pa0000,

it_pa0001,

it_hrp1000.

ENDFORM. " sort_data

&----


*& Form it_summary

&----


  • Sums monthly data

----


FORM it_summary.

  • Internal table to hold employees

data: begin of it_emp occurs 0,

pernr like pa0000-pernr,

end of it_emp.

data: v_emp_total type i,

v_emp_quit type i,

v_cumulative_percentage type p decimals 2,

v_cumulative_average type p decimals 2.

  • sort internal table it_sort

sort it_sort by org_text month status.

  • delete adjacent duplicates

  • to take care of organisational reassignments

delete adjacent duplicates from it_sort.

loop at it_sort.

at new org_text.

  • initialise total employees to zero for every organisational unit

v_emp_total = 0.

v_cumulative_percentage = 0.

v_cumulative_average = 0.

endat.

at new month.

  • initilalise employees quit

v_emp_quit = 0.

endat.

if it_sort-status = '0'.

  • counter quit employees

add 1 to v_emp_quit.

endif.

if it_sort-status = '3'.

  • check if this employee is already accounted

clear it_emp.

read table it_emp with key pernr = it_sort-pernr.

if sy-subrc <> 0.

  • counter total employees

add 1 to v_emp_total.

  • move this employee to it_emp for further check

move it_sort-pernr to it_emp-pernr.

append it_emp.

clear it_emp.

sort it_emp.

endif.

endif.

at end of month.

  • move data to it_summary

move v_emp_total to it_summary-v_emp_total.

move v_emp_quit to it_summary-v_emp_quit.

move it_sort-org_text to it_summary-org_text.

move it_sort-month to it_summary-month.

  • to avoid division by zero

if v_emp_total <> 0.

it_summary-monthly_attrition = v_emp_quit / v_emp_total * 100.

endif. "if v_emp_total <> 0.

  • add this months percentage to cumulative percentage

add it_summary-monthly_attrition to v_cumulative_percentage.

  • evaluate cumulative attrition by averaging

if it_summary-month = 1.

it_summary-annual_attrition = it_summary-monthly_attrition * 12.

else.

v_cumulative_average =

v_cumulative_percentage / it_summary-month.

it_summary-annual_attrition = v_cumulative_average * 12.

endif. "if it_summary-month = 1.

append it_summary.

clear it_summary.

endat.

endloop.

  • sort internal table it_summary

sort it_summary by org_text month.

  • move null values for months having no data

loop at it_summary.

at new org_text.

do 12 times.

read table it_summary index sy-tabix.

move sy-index to it_summary-month.

move 0 to it_summary-v_emp_total.

move 0 to it_summary-v_emp_quit.

move 0 to it_summary-monthly_attrition.

move 0 to it_summary-annual_attrition.

collect it_summary.

clear it_summary.

enddo.

endat.

endloop.

  • sort internal table it_summary again

sort it_summary by org_text month.

  • free internal table not required further

free it_sort.

ENDFORM. " it_summary

*&----


*& Form basic_list

*&----


  • Outputs data

*----


FORM basic_list.

  • Internal table to duplicate it_summary to ease display

data : it_dup_summary like it_summary occurs 0 with header line.

data: v_pos type i.

it_dup_summary[] = it_summary[].

loop at it_summary.

at new org_text.

new-line.

v_pos = 20.

loop at it_dup_summary where org_text = it_summary-org_text.

write at v_pos(8) it_dup_summary-v_emp_total.

add 9 to v_pos.

endloop.

new-line.

write it_summary-org_text.

v_pos = 20.

loop at it_dup_summary where org_text = it_summary-org_text.

write at v_pos(8) it_dup_summary-v_emp_quit.

add 9 to v_pos.

endloop.

new-line.

write : 'Monthly Attrition'.

v_pos = 20.

loop at it_dup_summary where org_text = it_summary-org_text.

write at v_pos(8) it_dup_summary-monthly_attrition.

add 9 to v_pos.

endloop.

new-line.

write : 'Annual Attrition'.

v_pos = 20.

loop at it_dup_summary where org_text = it_summary-org_text.

write at v_pos(8) it_dup_summary-annual_attrition.

add 9 to v_pos.

endloop.

endat.

endloop.

ENDFORM. " basic_list

reward points for useful answers

regards

Anji