Master the Art of Writing Time PCRs

Introduction

For the last few days, I came across many queries in SCN (SAP Community Network) regarding grant of absence quotas in time evaluation run. And consultants were facing issues in generation of the correct value of the quota.

Also, there are multiple ways things can be done and hence, I found that it was sometimes getting difficult to find out where the consultants were facing issues. Because of this, I thought of coming up with a knowledge artifact with step by step configuration details of absence quotas grant in time evaluation run.

Client Situation

The client was implementing positive time management and it had the below requirements regarding absence quotas:

Annual Leave

  • Base Entitlement for a year = 20 days
  • Validity Interval = calendar year
  • Annual Leave quota of 20 days to be granted at the start of calendar year.
  • If the employee is being hired in the middle of the calendar year, then the grant of annual leave quota should be prorated. Also, the prorated quota of annual leave should be rounded off to the nearest integer.

Sick Leave

  • Base Entitlement for a year = 7 days
  • Validity Interval = calendar year
  • Sick Leave quota of 7 days to be granted at the start of calendar year or at the time of hiring. There is no proration for sick leave quota if the employee gets hired in the middle of the calendar year.

Recreation Leave

  • Base Entitlement for a year = 5 days
  • Validity Interval:  01-Jul to 30-Jun
  • Recreation Leave quota of 5 days to be granted on 01-Jul or at the time of hiring between 01-Jul and 31-Dec. There is no proration of recreation leave quota if the employee gets hired in the middle of the calendar year.

Since the client was implementing positive time management, the positive time evaluation could run successfully in actual mode only till the day the actual data is available. Hence, for 01-Jan, the time evaluation will run after the shift has got over provided this was a day shift.

Solution Design

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

Step 1: SPRO > Time Management > Time Data Recording and Administration > Managing Time Accounts Using Attendance/ Absence Quotas > Setting Groupings for Time Quotas > Group Employee Subgroups for Time Quotas

/wp-content/uploads/2014/06/1_474514.png

Step 2: SPRO > Time Management > Time Data Recording and Administration > Managing Time Accounts Using Attendance/ Absence Quotas > Setting Groupings for Time Quotas > Group Personnel Subareas for Time Quotas

/wp-content/uploads/2014/06/2_474524.png

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

/wp-content/uploads/2014/06/3_474525.png

/wp-content/uploads/2014/06/4_474526.png

/wp-content/uploads/2014/06/5_474527.png

Step 4: 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

/wp-content/uploads/2014/06/6_474528.png

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 > Specify Rule Groups for Quota Type Selection > Modify Feature QUOMO

/wp-content/uploads/2014/06/7_474529.png

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 > Set Base Entitlements > Base Entitlement for Absence Quota Generation

/wp-content/uploads/2014/06/8_474530.png

/wp-content/uploads/2014/06/9_474531.png

/wp-content/uploads/2014/06/10_474532.png

Step 7: 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

/wp-content/uploads/2014/06/11_474533.png

Annual leave starts at the start of calendar year and continues till the end of the calendar year.

/wp-content/uploads/2014/06/12_474534.png

Sick Leave start at the start of calendar year and continue till the end of calendar year.

/wp-content/uploads/2014/06/13_474535.png

Recreation Leave starts 6 months after the start of calendar year (July) and continues till 6 months after the end of calendar year (June).

Step 8: SPRO > Time Management > Time Data Recording and Administration > Managing Time Accounts Using Attendance/ Absence Quotas > Calculating Absence Entitlements > Rules for Generating Absence Quotas > Define Rules for Reducing Quota Entitlements > Reduction Rules

/wp-content/uploads/2014/06/14_474536.png

The above rule was copied from standard rule 05. The reference period for reduction rule for inactive days is as per base period (calendar year).

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

/wp-content/uploads/2014/06/15_474537.png

We are using standard rule 01 which means that any value between X and X.5 (X.5 not included) gets rounded off to X and any value between X.5 (X.5 included) and X+1 gets rounded off to X+1 where X is an integer.

Step 10: SPRO > Time Management > Time Evaluation > Time Evaluation Settings > Define Time Types

We define three daily time types – one for each type of leave quota.

/wp-content/uploads/2014/06/16_474538.png

/wp-content/uploads/2014/06/17_474539.png

/wp-content/uploads/2014/06/18_474540.png

Step 11: 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.

Annual Leave

/wp-content/uploads/2014/06/19_474541.png

/wp-content/uploads/2014/06/20_474542.png

Please note that the accrual period is daily. This implies that every day 20 days of annual leave will accrue.

Introduction

I have come across many queries in SAP Community Network where SAP HCM consultants would like to acquire the skillset to write Time PCRs. This knowledge artifact is an attempt from my side to impart this knowledge based on my experience of working in Time management over 7 years and writing Time PCRs in various SAP HCM projects.

However, before I go any further, let me be frank that there are no shortcuts to this. There isn’t any tonic available in the market that you take a couple of shots of it and overnight, you become an expert in writing Time PCRs.

It will require persistent and diligent efforts, analytical bent of mind and patience and if you are game for it, this knowledge artifact is definitely for you.

Unlike other modules in SAP HCM where you have to mostly update configuration tables, Time Management and Payroll require you to map customer scenarios using PCRs, operations and functions and this is what makes these two modules very complex. However, once you have mastered the art of writing custom PCRs, you will realize that SAP has provided such a robust and flexible option in terms of PCRs to meet various client requirements. I refer to PCR Writing as functional coding and it is similar to ABAP coding.

Definition

A Personnel Calculation Rule (PCR) is called within a schema for executing subtasks using various operations. Each step within a PCR corresponds to an operation and there can be sub PCRs too. A PCR will be processed by a function.

Below is an example of a PCR MODT being processed by function MOD in standard schema TM00.

/wp-content/uploads/2015/05/a_703282.jpg

 

You can access, create, modify or delete PCR using TCode PE02.

/wp-content/uploads/2015/05/b_703283.jpg

Each PCR has below sub-objects:

  • Source Text – This displays the PCR in tree structure or table view and has two options – ESGrp Grouping and Wage/Time type. Below is the screenshot of the PCR in tree structure. The operations are highlighted in red box. Hence, PAYTP and MODIF are two examples of time operations.

/wp-content/uploads/2015/05/c_703284.jpg

  • Attribute – The attributes section display the text of the PCR, program class (T – Time Management, C – Payroll), Country Grouping, Person Responsible, Changes only by Person Responsible Checkbox, Created On and Last Change By date. Please refer below the screenshot of the same:

/wp-content/uploads/2015/05/d_703285.jpg

  • Documentation – This displays the documentation of the PCR and explains the functionality and usage of this PCR.

We never modify standard PCRs delivered by SAP. If we have to make any changes to standard PCR, we copy the standard PCR to a custom PCR and make changes to the custom PCR. Also, we comment out the standard PCR in the schema and replace it with the custom PCR. It is recommended to use codes starting with Z or Y for custom PCRs.

Probable Roadmap towards Becoming an Expert in Writing Time PCRs

When I had started my career in Time Management and Payroll, I went to a colleague of mine and asked him about the best way to learn these two complex modules. I wanted to get rid of the fear of time evaluation and payroll run log. His answer was a very simple one. Execute time evaluation for an employee and go through each node in the time evaluation log to understand how time data is getting processed by each function, PCR and operation. In hindsight, I can say that it was the best thing he advised me to do. And this is what I did. I ran time evaluation for an employee and went through the entire processing log one by one and in the process, I got myself educated on a number of standard functions, PCRs and operations. While I was doing this activity, I used to maintain a document to record the meaning and usage of the standard functions, PCRs and operations I came across. Of course, there were few complex things which were not clear and I used to go to him to get them clarified.

There was one important piece I had missed in this and that was the understanding of time types. Since I didn’t have sound understanding of time types, I was not good in writing new Time PCRs from scratch. I was, however, good in resolving support tickets which required analyzing the time evaluation log and changing or fixing existing PCRs. Hence, I had become like a car mechanic who could fix issues in a defective car and bring it back to shape. But I was still not good enough to create a new car on my own. Hence, it is very important that consultants get an understanding of time types if they wish to learn to write PCRs on their own.

Step 1: Understand Time Types – The DNA of Time PCRs

The first step involves developing an understanding of the functionality of time types. Without this, you will never be able to map complex time scenarios in Time PCRs. I have written a knowledge artifact regarding the same which will help you get this understanding. Please go through the below document.

Time Types – The DNA of Time PCRs

Step 2: Run Time Evaluation and study the Time Evaluation Log

Why am I asking you to go through this step? This is the best way to get an understanding of how time data gets processed in time evaluation. You will be going through each node and in the process, get an understanding of the usage of each function, PCR and operation. Don’t worry if things are not clear at the first instance itself for all the nodes in time evaluation log. But do continue this for the entire log. You can try various scenarios like capturing an attendance in IT2002, capturing absence in IT2001, capturing time events in IT2011, not capturing any data at all anywhere (positive time evaluation will result in error and negative time evaluation will get evaluated normally) and then running the time evaluation and studying the time evaluation log. You can go through the documentation of functions and operations and PCRs using TCode PE04 and PE02 respectively.

While I was doing the above activity, I used to maintain a spreadsheet with the codes of functions, PCRs and operations and their usage in separate worksheets. This helped me to do a quick review of what these functions, PCRs and operations were meant for, whenever required.

Operations

Taking cue from P.K. Agrawal’s book on Time Management, there are five different types of operations:

  1. Operations that provide information for Decision Making in PCRs
  2. Operations that change contents of Internal Tables
  3. Operations that change Overall Status
  4. Operations that change contents of Database Tables
  5. General Operations

Below screenshot shows these operations arranged in the above 5 categories:

/wp-content/uploads/2015/05/e_703289.jpg

I would recommend that you create 5 worksheets in a spreadsheet based on the above categories and capture the definition and usage of each of the above operations as you study the time evaluation log. Idea should be to capture the gist of the usage and not the entire content available in the documentation. And, you should go through this list often and revise so that you develop a good understanding of the usage of each operation.

The most commonly used operations in Time PCRs are OUTWP, TABLE, VARAB, VARPR, VARST, ADDDB, ADDMB, COLER, COLOP, FILLP, HRS, TFLAG, GCY and PCY and I would recommend that you study them first and understand them. You can also use the “Where Used” functionality in TCode PE04 to find out PCRs where the given operations are being used.

I always had a confusion regarding when to use GCY and PCY as both of them seemed to call another sub-rule. I was able to figure this out later on. GCY is used when you want to branch on to a new sub-rule from one rule and you will be processing only this sub-rule going forward. PCY is used when you want to process multiple sub-rules simultaneously from one rule.

You may also find that you have exhausted the maximum no. of operations that can be used in a PCR. In such a scenario, you will use the last operation (GCY or PCY as the case may be) in the PCR to move on to a new sub-PCR or another employee subgroup grouping of the same PCR.

Functions

Taking cue from P.K. Agrawal’s book on Time Management, there are three different types of functions:

  1. Functions that set a switch: These functions can be called at any position within the schema and they are called again while the current schema is being executed. Such functions don’t get processed in IF, ELSE and ENDIF loop. Examples are like OPPT, CHECK, EXPRT etc.
  2. Functions that import data: Examples are P2001, P2011, P2002 and so on.
  3. Functions that process a PCR:
    • Functions for processing status information like ACTIO.
    • Functions for processing internal tables like PTIPA, PTIP.
    • Functions with fixed processing like PBRKS.

Let me explain you the usage of common functions which process PCRs.

  • RTIP: It is used to read entries in Table TIP. Entries in Table TIP won’t get changed.
  • RTIPA: It is used to read entries in Table TIP only if there is an absence for the given day. Entries in Table TIP won’t get changed.
  • PTIP: It is used to process entries in Table TIP. Entries in Table TIP may get changed.
  • PTIPA: It used to process entries in Table TIP only if there is an absence for the given day. Entries in Table TIP may get changed.
  • ACTIO: It can be used to process any time PCR if there is no need to read or process Table TIP.

While using functions RTIP, RTIPA, PTIP and PTIPA to process a PCR, please use GEN in parameter 3 (beside the PCR) in the respective line of the schema if you are not processing the PCR for a specific time type.

While working on a requirement for one of my clients, I chanced upon a standard function PZL which gives a lot of flexibility to process wage types in Table DZL. Using this function, I was able to round off overtime hours generated in wage type from Table T510S. I was also able to split overtime hours after it has breached a given threshold limit in a month.

You can refer the below documents where function PZL has been used:

Splitting of Overtime Hours after X Hours in Time Evaluation

Rounding off Overtime Hours Generated via T510S table in Time Evaluation

Step 3: Develop Clarity of Thought on the Requirements and visualize design

It is one of the most important activities that each consultant must do while trying to write a new PCR. One must have clarity of thought on the requirements. Because only then, you will be able to design the right PCR to meet the requirements. I discovered this technique fortuitously.

Every PCR goes through the below stages and each stage has few typical queries:

  • Input
    • What data needs to be processed?
    • Where does the data come from?
  • Processing
    • For whom the data needs to be processed?
    • How does the data need to be processed?
    • What should be the outcome of this processing?
  • Output
    • Where the processed data needs to be stored?

For each stage, depending on the activity, you may require different operations. Use the above questions to find the operations which will help you design the PCR. For example, a particular PCR needs to be processed for employees belonging to Personnel Area 1000 only. In such a case, it is the 1st question in the processing stage and you will use operation OUTWP as a decision operation to filter out the employees belonging to Personnel Area 1000.

When you have to write a custom PCR, you should try to understand the requirements functionally before trying to figure out the operations to use. You should think of the complete design in a way that if this requirement was being handled by someone else, then you should be able to explain the step by step process of how the solution should work. You should ask the above questions which will help you zero down on the operations to use or direct you to look for the right operations from the list you have prepared.

Frankly speaking, I discovered this accidently, while trying to build my first solution independently using PCRs and time types. Below is the document regarding my first solution:

Determination of First Clock In & Last Clock Out in Positive Time Evaluation

I would recommend you to go through it so that you get an idea about the challenges faced when you are developing a solution  using PCRs independently for the first time.

There may be situations when no standard operation can handle the client’s requirements. In such a case, you may go for development of a custom operation.

Step 4: Practice already built Standard and Custom PCRs

Practice, Practice and Practice!!! There is no substitute to this.

Yes, that’s the mantra to get into the groove of writing PCRs. Develop your confidence and understanding of the PCRs by creating simple Standard and Custom PCRs which are already built.

Some of the simple standard PCRs which you can practice are MODT, TD20, TD10 and TE20. If you wish to practice simple custom PCRs, you can refer to the below blogs:

Grant of Absence Quotas in Time Evaluation

Balance Absence Quota Carry Forward – Method 1

Once you have mastered the simple PCRs and created them on your own, you can move on to medium and high complexity PCRs. Some of the medium and high complexity standard PCRs which you can practice are TE30, TO01, TO02, TW31, TW32, TW33, TW34, TW35, TW36, TO20 and TO21. If you wish to practice medium and high complexity custom PCRs, you can refer to the below blogs:

Determination of First Clock In & Last Clock Out in Positive Time Evaluation

Late Coming, Early Going and Unauthorized absence

Pre-approved Overtime Using IT2007

Calculation of Ramadan Overtime during Planned Working Time

Splitting of Overtime Hours after X Hours in Time Evaluation

Rounding off Overtime Hours Generated via T510S table in Time Evaluation

Please ensure that you run time evaluation and validate that PCRs created by you are behaving as expected. It is very important that you go through the processing log of the PCR to validate its functioning.

Step 5: Moment of Truth – Build your own solution using custom PCRs

After you have gone through the above steps, you will definitely become comfortable in writing custom PCRs. But the moment of truth will come when you are able to do end to end design and build of a solution using custom PCRs independently. That moment will slowly and steadily build your confidence and help you to design more solutions with custom PCRs for various client requirements. And as you go on writing more PCRs, you will finally realize that writing PCR comes to you naturally.

The above steps are simply guidelines to help new consultants wanting to master the art of writing time PCRs. For some of them, the learning curve may be faster and not all steps may be needed. Some who may have attended SAP training may do it even quicker.

I hope consultants will benefit by the approach highlighted in this blog. It will require continued perseverance and patience to reach the goal. Remember that Rome wasn’t built in a day.

RPTIME00 Future Ahead?

SAP is rapidly changing quite a few things in SAP HCM space after acquiring SuccessFactors and one of the things which may get impacted is time evaluation solution. As per the blog – (RP)TIME to Say Good Bye? – published by Sven Ringling yesterday, SAP may soon sound the death bell for RPTIME00 program and time evaluation solution. If that indeed happens to be the case in future, it will be really unfortunate for SAP to do away with a time tested, highly flexible and robust time evaluation solution. And that would mean that my blog will also become redundant

Till that point of time, where customers continue to use time evaluation and new consultants are willing to acquire the art of writing Time PCRs, I hope this knowledge artifact will be useful and relevant.

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.