cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while calculating Average number of Employees

Former Member
0 Kudos

Hi All,

User want to calculate average number of employees of previous year. So when user enters 0Calmonth = 03.2013. I need to find number of employees on 01.01.2012 and 31.12.2012 and calculate average of those two values.

I created customer exit variable on 0Calmonth, got first and last day of the previous year. Now I have created two restricted keyfigure(RKF) to find number of employees on these days. But I am finding difficult to input 01.01.2012 value to first RKF and 31.12.2012 value to second RKF.

Please let me know how to proceed.

Thanks,

Hemanth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hemanth,

If i understnad your requirement clearly, to calucualte average  you need to count no.of employees for the complete year not on first and last day of the year. Is your key figure is Non cumualtive?

Try with following procedure.

1. Create one user entry variable for 0CALMONTH (Type Single value ) say ZVAR1.

2. Create one customer exit variable (Type Range) on 0CALDAY and use the below code to fill the variable with last year data.

LOOP AT i_t_var_range INTO loc_var_range

                  WHERE vnam = 'ZVAR1'.

lt_year = loc_var_range-low+0(4).

lt_year = lt_year - 1.

concatenate lt_year '01' '01' into l_s_range-low.

concatenate lt_year '12' '31' into l_s_range-high.

l_s_range-sign = 'I'.

l_s_range-opt  = 'BT'.

APPEND l_s_range TO e_t_range.

ENDLOOP.

3. Restrict key figure using customer exit variable. This will give you the no.of employees for complete prior year.

4. Assign this RKF to CKF and select exception aggegation as Average.

Hope this will help you.

Thanks,

Reshma M.

Former Member
0 Kudos

Hi Reshma,

Thanks for your reply. As per my client, he want me to calculate average only by taking first and last day of the year. So I cant use above logic.

I am using  business content KF - 0HDCNT_LAST(Number of employees). Which is cumulative but has exception aggregation - LAST VALUE and Agg Ref Char - 0CALDAY.  Hope this will provide me the number of employees on the specified dates(like non-cumulative KF).

Thanks,

Hemanth

Former Member
0 Kudos

Hi Hemanth,

To get the no.of employees on first day and last day of an year, create 2 customer exit variables (Type single values)  and use below code.

For first day of year:

LOOP AT i_t_var_range INTO loc_var_range

                  WHERE vnam = 'ZVAR1'.

lt_year = loc_var_range-low+0(4).

lt_year = lt_year - 1.

concatenate lt_year '01' '01' into l_s_range-low.

l_s_range-sign = 'EQ'.

l_s_range-opt  = 'BT'.

APPEND l_s_range TO e_t_range.

ENDLOOP.

For last day of year:

LOOP AT i_t_var_range INTO loc_var_range

                  WHERE vnam = 'ZVAR1'.

lt_year = loc_var_range-low+0(4).

lt_year = lt_year - 1.

concatenate lt_year '12' '31' into l_s_range-low.

l_s_range-sign = 'EQ'.

l_s_range-opt  = 'BT'.

APPEND l_s_range TO e_t_range.

ENDLOOP.

Create 2 RKF's using these two customer exit variables and calculate average.

Thanks,

Reshma M.

Answers (1)

Answers (1)

former_member189638
Active Contributor
0 Kudos

You can't create a variable on 0CALMONTH and try to input date values...Create customer exit variable for 0CALDAY and use them in restricted Key Figure