Sei sulla pagina 1di 47

Balance Absence Quota Carry Forward:

Client Situation

Below are the client requirements with respect to balance absence quota carry forward.

Annual Leave

The annual leave quota gets generated in time evaluation either on 01-Jan or on the
hiring date and has validity till 31-Dec of the given year.
On 31-Dec of every year, the remaining balance of annual leave quota should get carry
forward to next year.
The validity and deduction interval for the carry forward annual leave quota will be for
the next calendar year.
A maximum of 5 days balance can be carried forward to the next year. If the balance is
more than 5 days, extra days above 5 days will lapse.

Sick Leave

The sick leave quota gets generated in time evaluation either on 01-Jan or on the hiring
date and has validity till 31-Dec of the given year.
On 31-Dec of every year, the remaining balance of sick leave quota should get carry
forward to next year.
The validity and deduction interval for the carry forward sick leave quota will be for the
next calendar year.
The entire quota balance should get carried forward to next year.

Privilege Leave

The privilege leave quota gets generated by program RPTQTA00 and the validity of the
leave quota is from 01-Jan of current year till 31-Mar of next year. Hence, the quotas
will overlap during Jan Mar next year.
On 31-Mar of next year, the remaining balance of previous year Privilege Leave Quota
should be carried forward to next year for the period from Apr Dec.
The validity and deduction of interval for the carry forward privilege leave quota will be
for 01-Apr till 31-Dec.
A max of 7 days can be carry forward to the next year.

Solution Design

Let me give you step by step configuration of the solution design.

I assume here that the quotas for annual leave, sick leave and privilege leave have
already been created.

We would need to create carry forward quotas for annual leave, sick leave and privilege
leave. But before we do that, let us create few daily time types for our solution.

Step 1: SPRO > Time Management > Time Evaluation > Time Evaluation Settings >
Define Time Types
Step 2: SPRO > Time Management > Time Data Recording and Administration >
Managing Time Accounts Using Attendance/ Absence Quotas > Time Quota Types >
Define Absence Quota Types

The actual quotas are as mentioned below:

91 - Annual Leave Quota


95 - Sick Leave Quota
97 - Privilege Leave Quota

The carry forward quotas will be defined as below:

71 - CF Annual Leave Quota


75 - CF Sick Leave Quota
77 - CF Privilege Quota
Step 3: SPRO > Time Management > Time Data Recording and Administration >
Managing Time Accounts Using Attendance/ Absence Quotas > Calculating Absence
Entitlements > Automatic Accrual of Absence Quotas > Permit Generation of Quotas
in Time Evaluation

Step 4: SPRO > Time Management > Time Data Recording and Administration >
Managing Time Accounts Using Attendance/ Absence Quotas > Calculating Absence
Entitlements > Rules for Generating Absence Quotas > Set Base Entitlements > Base
Entitlement for Absence Quota Generation
The carry forward time types have been assigned as base entitlement for carry forward
quotas respectively.

Step 5: SPRO > Time Management > Time Data Recording and Administration >
Managing Time Accounts Using Attendance/ Absence Quotas > Calculating Absence
Entitlements > Rules for Generating Absence Quotas > Determine Validity and
Deduction Periods
This quota is valid for the period Apr Dec.

Step 6: SPRO > Time Management > Time Data Recording and Administration >
Managing Time Accounts Using Attendance/ Absence Quotas > Calculating Absence
Entitlements > Rules for Generating Absence Quotas > Define Generation Rules for
Quota Type Selection

We will define the selection rules for the three absence quotas.

C/F Annual Leave


C/F Sick Leave
C/F Privilege Leave
Step 7: Create Constants for Leave Balance Thresholds

Step 8: Create PCRs for Reading Balance Quotas at Quota End Date
PCR ZALB reads the balance annual leave quota on 31-Dec using HRS=FR91C and
passes the value to time type ZALB.

PCR ZSLB reads the balance sick leave quota on 31-Dec using HRS=FR95C and passes the value
to time type ZSLB.
On 31-Mar, PCR ZPLB finds the difference between current date and quota end date for
the earliest record. If the difference is 0, it means that this is the record for which quota
needs to be read. If there is only one record of 97 which will be the case of new hire,
the difference between current date and quota end date will be greater than 0.

If the difference is 0, it reads the remaining balance of privilege leave for the first record
and passes it to time type ZPLB.

Step 9: Create PCRs for Bringing Forward Balance Quotas

PCR ZALC reads the value of time type ZALB for 31-Dec and compares with the value of
constant ZALTH (value = 5) on 01-Jan. If the values is less than 5, it passes the value
to time type ZALC and if it is more than 5, it passes value 5 to time type ZALC.
PCR ZSLC reads the value of time type ZSLB for 31-Dec and passes it to time type ZSLC
on 01-Jan.

PCR ZPLC reads the value of time type ZPLB for 31-Mar and compares with the value of
constant ZPLTH (value = 7) on 01-Apr. If the values is less than 7, it passes the value
to time type ZPLC and if it is more than 7, it passes value 7 to time type ZPLC.

Step 10: Add PCRs to Time Schema


The PCRs ZALB, ZSLB and ZPLB which read the remaining balance at quota end date
should be introduced in time schema after function QUOTA. This will be especially useful
in arriving at the correct remaining leave balance in case of daily accrual of leaves where
a small fraction of leave gets accrued and transferred every day.

Please ensure that you introduce function CUMBT in the time schema again after the
PCRs ZALB, ZSLB and ZPLB. This is done to transfer the time types generated in these
PCRs from Table TES to Table ZES.

The PCRs ZALC, ZSLC and ZPLC which bring forward the leave balance from previous
day to the current day should be introduced after standard PCR TR30 and before function
CUMBT. This is done so that the time types generated in these PCRs can move from
Table TES to Table ZES in function CUMBT for quota generation.

Let us now proceed to testing.

Solution Testing

IT2006 (as on 01-Jan-13)

Let us assume that the employee didnt apply any leave in the year 2013.

Run time evaluation for 31-Dec-13.

PCR Processing for 31-Dec-13


PCR ZALB reads the remaining balance on 31-Dec for annual leave quota and passes it
to time type ZALB.

PCR ZSLB reads the remaining balance on 31-Dec for sick leave quota and passes it to
time type ZSLB.

Table ZES

Time types ZALB and ZSLB have values 20 and 7 respectively on 31-Dec-13.

Run time evaluation for 01-Jan-14

PCR Processing for 01-Jan-14


PCR ZALC brings forward remaining annual leave balance from time type ZALB and
compares it with the value in constant ZALTH (value = 5). Since it is greater than 5, it
passes the value 5 in time type ZALC.

PCR ZSLC brings forward remaining sick leave balance from time type ZSLB to time type
ZSLC.

Table ZES
IT2006

C/F quotas as well as quotas for the year 2014 get created.

Run time evaluation for 31-Mar-14

PCR Processing

PCR ZPLB reads the privilege leave balance available on 31-Mar from the record with
earliest validity start date.

Table TES
The value of time type ZPLB on 31-Mar is 12 and not 24. Hence, it proves that only the
first record of quota 97 has been read.

Run Time Evaluation for 01-Apr-14

PCR Processing

PCR ZPLC brings forward the remaining balance in time type ZPLB and compares it with
the value in constant ZPLTH (value = 7). Since it is greater than 7, it passes the value
of 7 to time type ZPLC.

Table ZES

IT2006
C/F Privilege Leave has got generated for the period 01-Apr-2014 till 31-Dec-2014 for
7 days.

Absence Quota basing on Working Date:

I. Purpose
This document will provide more information about Absence Quota Generation and Time
Schema. I have seen a lot of question involving Time Schema - one of the most difficult things in SAP
HCM, so I hope the document will support you better to control Time Schema. In document, I will
generate Absence Quota by using Time Schema. I have to create many PCRs with quite complex
logic and input them into many where in Time Schema. You can find how to link mater data,
controlling Time Type and processes of Time Evaluation.
Note: before looking at the document, basic knowledge in Absence Quota must be investigated
carefully first.

II. Requirement
I will focus on 1 actual customer's expectation. It's one of common request whenever
implementing or supporting SAP HCM in enterprise's system:
1. Employee will has 1 Paid Leave Quota after having 20 working days on system.
2. Working date is: when he has Attendance on IT2002 (of-course not including the day off:
Saturday or Sunday), and has full check-in and check out in Time Events IT2011.
3. Absence Quota'll generated yearly.
4. Only Available for applying from the next year, until 31.12.9999

III. Solution
First in Time Schema, you have to calculate Working Days by using data from 2 Infotype: 2002
(Attendances) and 2011 (Time Events), thus we have to copy from standards schema TM00 to our schema and
modifying it. Standard Functions in Time Schema retrieve data from 2 Infotype and post them into internal table
TIP, in Schema - useful links & T-Codes there is useful link to understand how time data stored in TIP.
In order to retreive data in TIP, standard functions RTIP or PTIP must be used to get data and then
checking it.
Origin indicator of TIP as below

E = Time event

O = Overtime from Overtime infotype (2005)

A = Absence from Absences infotype (2001)

P = Attendance from Attendances infotype (2002)

R = Availability from Availability infotype (2004)

D = Generated planned pair

C = Attendance/absence reasons

So we will check: if origin indicator is P, 1 working day will be counted. If origin indicator is E,
next step is checking whether in that day employee has full check in check out or not. These points
above will accumulate Working Date Total into 1 Time Type.

Next checking whether the last date coming, Working Date Total divide 20 and giving these
number to Absence Quota. So in Time Evaluation, we have to check whenever 31-Dec is run.

It's just summarization. Now steps be steps will be shown in order from here.

1. Grouping

Personnel Structure (EE group and EE subgroup)

Using Table View V_503_E in T-Code SM31 / SM30. My grouping is 2.

Enterprise Structure (Personnel Area and Personnel Sub-Area).

Using Table View V_001P_I. It's 08

Grouping for Time Recording:

Using Table View V_001P_H


2. Base Entitlement

As you can see, 3 grouping values above will be used here (2, 08 and 01).

Thanks to time type 9D50, whenever we assign value to 9D50, Absence Quota Type 10 (Paid Leave) in IT2006
will be created. The configuration of Type Type 9D50, nothing is important with configuration of 9D50
3. Counting Working Days

As I mention at the beginning in solution part, the PCR ZWA1 has logic as below (using T-Code PE02 to create
PCR).

Operation "OUTTPORIGS Origin status" returns Origin status in internal table TIP (E: data inputted from IT2011,
P data inputted from IT2002).

Operation "OUTTPEXTIM Times exist?" checks whether Time Event has full check in and check out or not. Y
means it's correct, both check in and check out exist.

The day fits conditions here, Time Type 9M99 will be accumulated 1. It's configuration of 9M99
Cumulate in period balance is 1: The time type is cumulated in a period balance. Our period here is month.

2 Transfer previous are clear right? because we just generate on last date of year so we have move data all
months (from Jan to Nov) into Dec.

Transfer previous year is up to you. In my schema, it isn't necessary because in 31st Dec, Absence Quota is
generated, so Accumulated working days will be blank.

Now using with Function RTIP / PTIP in Time schema (IMPORTANT)

I copied schema ZW01 from TM00 in T-Code PE01.

After successfully calling Function P2011, P2002, P2001, etc, ZWA1 is inserted into Time Schema with Function
RTIP.

This is these all logic to calculate Working Days.

4. Checking EOY (Dec-31st)

Creating 1 PCR to check whether month is Dec or not.


VARSTCURMO Current period: it returns current period (not current system , current period is the month that
Time Evaluation is running. For example if you are running PT60 for 2 months: Jan to Feb, so the first current
period is Jan, after accomplish running for all days in Jan, current period will be Feb).

Next ZI15 is inserted into Time Schema ZW01.

As you can see, 1st check Dec, 2nd check EOM, the day fitting 2 conditions is Dec-31st, the last date of Dec.
There are many solutions for checking Dec-31st. You can check by using Month and Day directly by using 2
operations: HRS=BCURDY : current day; HRS=CURMO : current month period

On Dec-31st, ZWA2 will be called to generate Absence Quota. Next point will explain the PCR. Note: these
PCRs have to inserted Time Schema before 2 standard Functions: CUMBT and QUOTA.

5. Generate Absence Quota.

PCR ZWA2 will take responsibility to generate Absence Quota.


Retrieving Accumulated Working Days in 9M99 by HRS=M9M99. Must plus with D9M99 (Daily value of 9M99,
because only running CUMBT, Daily time type value will be updated into Accumulated time type).

Comparing with constant in V_T511K ZZ000 (it's 20). If accumulated working days is lower than 20 until last day
of year, I will clear by assigning 0 to them.

Other while, Accumulated Woring Days divides ZZ000 and inserts into time type 9D50. After that clearing value
of 9M99.

These's all done for calculating Working Days Yearly and updating value into Absence Quota in IT2006 throung
time type 9D50.

6. Period in Absence Quota

Next, I will show how to generated yearly and Available for applying from the next year, until 31.12.9999.

It's done in Table View V_T559D with grouping 2, 08 and absence Quota 10 Paid Leave

Validity Interval: it's period for Start Date and End Date in IT2006. In these picture, on the left, it's
Start of Calendar Year (normally it's Jan-01st), and the right it's End of Calendar Year( of course it's
Dec-31st).

Deduction Interval: it's period that employee can be apply your Absence Quota.
Deduction From: End of validity interval, it means Dec-31st. But looking Relative Position: 1 Days. So Deduction
From will start from Dec-31st + 1 days, so it will be Jan-01st of next year

Deduction To: as same as Deduction From but relative is 999 Month so it'll be 31.12.9999.

That's all Next part is testing to be sure that solution is correct

IV. Testing
Hiring employee in Grouping 2, 08 and 01 on Jan-01st-2010.

1st case: having only 2 attendance records in IT2002


Attendance Total: 26 (Jan) + 26 (Oct) = 52 days.

After running PT60 until Dec-31st:

Employee has 2.6 days in Absence Quota ( 52/20 = 2.6).

Period: 01.01.2010 -> 31.12.2010.

Deduction period: 01.01.2011 -> 31.12.9999

=> All is correct

2nd case: Inputting more 2 days full check in and check out (for case miss check in/ check out, I tested but not
post here & moreover I have test same case in Understanding Relationship PT and PY):

Working days = 52 (attendance in IT2002) + 2 ( in IT2011) = 54 days.


After running PT60 until Dec-31st:

Employee has 2.7 days in Absence Quota ( 54/20 = 2.6).

Period: 01.01.2010 -> 31.12.2010.

Deduction period: 01.01.2011 -> 31.12.9999

=> All is correct

Carry Forward Absence Quota:

I. Purpose
One of common and complex request involving Absence Quota is carry forward from current year to next
year. There are many concerns and questions posted to find appropriate solution. Thus in this document I will
give you a good solution and step by step how to CARRY FORWARD absence quota. Basing on my document,
you will be easier to adapt SAP Time Management to meet your customer's expectation.

However, there are some basic information I have already mentioned in another documents, such as:
grouping Personnel Structure (EE group and EE subgroup), Enterprise Structure (Personnel Area and Personnel
Sub-Area), Grouping for Time Recording and the way to generate absence quota by using Time Type, so I will
not re-write it again. Please look at link Absence Quota basing on Working Date.

II. Requirement
Here it's the customer's expectation involving Absence Quota Type 20 - Sick Leave that should be
implemented in their system:

1. Yearly Absence Quota is 30 days.

2. Generate 2.5 days (30/12) per month for employee at the last date of month.

3. Start available: Hiring date or 1st Jan. End available: end of year 31st Dec.
4. If remaining >= 10 days in this year, 10 days will be carried forward to next year.

III. Solution
First of all, you have to create 2 Time Type and overview purpose as below

1. Time Type 9D50 will be stored value to generate Absence Quota. Whenever Time Type is not initial,
Absence Quota in IT2006 will be created automatically when accomplishing run Time Evaluation PT60.

9D50 will be generated in a customized PCR with logic below:

- plus 2.5 days (30/12)

- plus accumulated in Time Type 9WSL

=> assign to Time Type 9WSL

- Clear 9WSL immediately (to be sure that duplication 9WSL will not
happen).

2. Time Type 9WSL check whether remaining Absence Quota bigger or equal 10 or not? If it's exactly,
number 10 will be inserted into Time Type 9WSL and 9WSL is a bridge to bring this value from current year to
next year.

Note: create Time Type 9WSL 1 time per year, after accomplish generated Absence Quota on 31st Dec.
So 9WSL exists only from 31st Dec to end of Jan next year. Why? because whenever last of month is coming,
9D50 will be inputted value and 9WSL will be blank So from Feb to Dec, 9WSL always equals 0.

These are important points. From now steps by steps in configuration V_T559L and Time Schema also will be
mentioned here.

1. Grouping

As mention at the beginning, the Grouping I will use here: EE: 2, PA: 09 and Time Recording: 01.

2. Constant and Time Type

2.1. ZPLEL Yearly absence quota is 30, it's maintained in V_T511K

2.2. Time Type 9D50

It's only used 1 time per month so it's configuration is really simple. Just save as day balance.
2.3. Time Type 9WSL

As you can see the purpose of 9WSL, storing value on last day of year and bring to next year, so you have to
configure as picture below:

Activate "Transfer previous year". Without choosing this function, whenever 1st Jan comes, value in 9WSL will be
blank. It means value calculated on 31st Dec will not carried to the day after - 1st Jan.

3. Configure in V_T559L

With grouping above, there are steps for configuring in Table view Automatic Absence Quota Generation.
3.1. Base Entitlement tab: of course it's will be assigned to Time Type 9D50.

3.2. Transfer tab: it's important tab. Specifies the time at which the accrual entitlements are transferred
to the Absence Quotas infotype (2006) to be made available for deduction. As the absence quota has to
created monthly (at the last day of every month), so "Per time Evaluation Period" is necessary.
If you choose "Per calendar year", assuming that from Jan - Nov, employee has 2.5 days Sick Leave every
month, but when you open IT2006 in PA20, you cannot see Sick Leave. Why? because Transfer time to IT2006
is Calendar year, it's only transfer value in Time Type 9D50 to IT2006 on 31st Dec.

Co-operation with Validity/deduction interval in index 3.3. It will help us accumulate Absence Quota monthly
into yearly.

3.3. Validity/deduction interval

As mention in 3.2, both of them will create Absence Quota monthly but accumulate yearly

Transfer time is monthly, so whenever 9D50 is not blank, Absence Quota will be generated in IT2006 with
period is:

Begin Date : Calendar Year (Start) => normally it's hiring date in 1st year, and 1st Jan from second year.
End date: Calendar Year (End) => always 31st Dec.

Deduction Period:

Begin Date : Start of validity interval: it's Calendar year (chosen last step): => hiring date or 1st Jan.

End date: End of validity interval: it's Calendar year => always 31st Dec.

For example: employee joined company on 1st-Oct-2011

in Oct-2011, employee has 2.5 days in 9D50, in IT2006: 1 record:

Start 01.10.2011 - end 31.12.2011, Number 2.5, deduction: Start 01.10.2011 - end 31.12.2011.

next month Nov-2011:

just update record above:

Start 01.10.2011 - end 31.12.2011, Number 5.0, deduction: Start 01.10.2011 - end 31.12.2011.

in Dec-2011

Start 01.10.2011 - end 31.12.2011, Number 7.5, deduction: Start 01.10.2011 - end 31.12.2011.

3.4. Other tabs aren't important so only sharing:


4. Time Schema and PCR

4.1. Time schema ZW04:

Copy new Schema from TM04 and insert new schema with structure below:

NOTE: you have to insert PCRs in order as same as I have done here.

The logic already explained in this picture. Only call PCR ZW6C (creating Time Type 9D50) for generating
Sick Leave Quota If EOM is true

CUMBT: update value of time type in database.

QUOTA: update absence quota and create new / modify records in IT2006.
Next, check 31st Dec by ZI51, it's correct, ZW51 will be call to update value for Time Type 9WSL. After that
CUMBT must be call again.

4.2: PCR ZW6C

HRS=CZPLEL Get value ZPLEL in V_T511K, it's 30.

HRS/12 Divide 12, current value is 2.5

HRS+M9WSL Plus Accumulate value of 9WSL into HRS.

ADDDB9D50Z Add into Time Type 9D50

HRS=0 HRS = 0

ADDMB9WSLZ Clear 9WSL

4.3: PCR ZI51

4.4. PCR ZW51


HRS=FR20C Get Absence Quota left with subtype 20 in IT2006

HRS?10 Comparing with 10

* >=

HRS=10 HRS=10

ADDDB9WSLZ Assign to 9WZL to carry forward

< <

LEAVE

That's all Next part is testing to be sure that solution is correct

IV. Testing
Hiring employee on May-2011

Running PT60 until 31st May 2011, 2.5 Absence Quota with period from 01.05.2011 to 31.12.2011

=> It's correct


Running PT60 until 31st Dec 2011, 20 days (from May to Dec: 8 months) Absence Quota with period from
01.05.2011 to 31.12.2011

=> It's correct

Running PT60 until 31st Jan 2012, 12.5 days (10 days in 2011 and 2.5 days in Jan 2012) Absence Quota with
period from 01.01.2012 to 31.12.2012

=> ALL is correct

Potrebbero piacerti anche