GRC
HR
SCM
CRM
BI
Expand +


Article

 

How to Customize Schemas and Personnel Calculation Rules to Implement Time Evaluation in SAP ERP HCM

by Riishi Ritambhar, Technical/Functional Consultant

May 31, 2018

Learn how to customize schemas and configure rules in SAP ERP HCM to process the time recordings of employees to derive the regular and premium (time-and-a-half and double-time) hours to be paid.

The SAP ERP HCM system provides a framework to process all employees’ working and non-working times, such as attendances, absences, shift substitutions, holidays, and days off, to derive the hours that are to be paid as regular, overtime, holiday pay, and shift premiums. The SAP ERP HCM standard program, called time evaluation, uses this framework to process recoded times of employees. Time evaluation executes a set of functions (collectively called schemas). The functions also sometimes call personnel calculation rules (PCRs) that have the logic for processing. Several standard functions and PCRs in the system can be customized to meet a company’s specific requirements. New functions and rules can also be defined in the system, which results in processing of recorded times as per a company’s specific requirements. New functions are rarely required, although changes or customization of PCRs are very common.

I use a sample set of business rules to demonstrate how these customizations can be implemented in the SAP ERP HCM system to meet a company’s specific requirements.

An Overview of Standard Time Evaluation and Payroll Integration

Consider a scenario in which a weekly wage worker’s work times are to be evaluated and passed on to the payroll system for payment. This evaluation is to be done based on the following business rules:

  • Daily hours up to 8 are paid as regular hours
  • Daily hours over 8 and up to 12 are paid as time-and-a-half
  • Daily hours over 12 are paid as double-time
  • Hours worked on a holiday or off day are paid at a time-and-a-half rate

Figure 1 shows some work shifts for common work schedules for employees.


Figure 1
Sample shifts and their timings

In this example, the employee is on a weekly payroll and works 65 hours a week (Figure 2). In the scenario, when the above business rules (which are to be implemented using PCRs, discussed in detail later in this article) are applied, the results are 32 regular hours, 32 time-and-a-half hours, and one double-time hour, for a total of 65 hours worked.


Figure 2
Weekly work hours for the employee (scenario sheet)

Based on the work times in Figure 2, the time-evaluation program in SAP ERP HCM generates 32 hours of regular work time, 32 hours of time-and-a-half, and one hour of double-time for this employee (Figure 3).


Figure 3
Output from the time-evaluation program to the payroll system

The time-evaluation system sorts the hours and passes the results to payroll. Payroll then applies the relevant rates to arrive at the amount to be paid to the employee (Figure 4).


Figure 4
Processing of time results in payroll for pay amounts

Time Evaluation: Schemas, Functions, and PCRs

Now that you understand the integration between the time-evaluation program and the payroll system, let’s look at schemas, functions, and PCRs, and how the standard schemas and PCRs are customized to implement company-specific business rules and requirements.

All of an employee’s working and non-working hours, including attendance (and time swipes recorded through card swipes or biometric authentication machines) and absences are processed using a standard SAP ERP HCM time-evaluation program. Enter transaction code PT60 on the home screen (Figure 5) and press Enter (or click the green checkmark icon) to open the time-evaluation program (Figure 6).


Figure 5
Enter the transaction code for time evaluation


Figure 6
The SAP ERP HCM time evaluation selection screen

The screens in Figures 6 and 8 are shown to give you an idea of the initial screens for time evaluation and schema. The time-evaluation program uses a schema (TM04) to evaluate an employee’s worked time. A schema is a set of functions (mostly standard and pre-delivered in the system) that processes an employee’s time in a predefined sequence, resulting in a final set of hours, as shown in Figure 3. The different fields on this screen (Figure 6) need to have values for the result of employee(s) to be processed (explained later).

To access a schema, on the home screen of SAP ECC enter transaction code PE01 in the field to the right of the green checkmark icon and press Enter (Figure 7). This action opens the schema (Figure 8).


Figure 7
Enter transaction code PE01 to create a new schema


Figure 8
Open the schema in edit mode

Enter the schema name you want to edit—in this case, TM04—and select the Source text radio button. Use transaction code PE01 to edit schemas. TM04 is the standard schema (in transaction code PE01). You need to copy the TM04 schema to a custom schema and then edit it. Click the Change button and the screen in Figure 9 opens. It shows schema TM04 in edit mode.


Figure 9
Schema TM04 in edit mode, with its set of functions with parameters

There are a few standard schemas such as TM00, TM01, and TM04. TM00 can be used only when clock times and full day records are recorded and evaluated in the system (called positive time recording in SAP ERP Central Component [ECC]). TM01 can be used only where exceptions to the planned working time are recorded and evaluated in the system (called negative time recording in ECC). TM04 can be used to process both exceptions to planned working time as well as clocked timings (both negative and positive times).

Since in my example I can have both clock times as well as exception recordings, I use schema TM04. Later I copy this schema to a custom schema ZM04 to make changes in the processing as per business rules.

Each line of the schema has a line number, a function, four parameters, a deactivation flag, and text. The schema is processed in the sequence of the line numbers and the related functions are processed using these parameters. For example:

  • Line: 000070
  • Function: MOD
  • Parameter 1: TMON
  • Parameter 2: GEN
  • Parameters 3 and 4: Blank
  • Deactivation flag: Blank
  • Text: Define groupings

The MOD function dynamically assigns the employee being processed to various groupings for different time processing. Some of the groupings are for Time Wage Type and Absence valuation.

In this function call, on line 000070, parameter 1 has PCR TMON and parameter 2 has the value GEN. This means that the PCR TMON is used for the assignment of grouping. Parameter GEN indicates that the PCR is triggered for each item (wage type) in the input table (discussed in detail in my follow-up article, “Implementing FLSA using Time Evaluation”). For absence evaluation, the employee might need to be grouped one way (e.g., everyone on a 12-hour shift or work schedule is grouped together). For wage generation the employee might need to be grouped a different way (all temporary workers together) and for absence quotas the employee might need to be grouped another way (with all employees located in the same country or location).

The dynamic group assignment in the MOD function is enabled by PCR TMON. This PCR can be opened by double-clicking TMON on line 000070 of the schema (Figure 9).

PCRs can also be accessed from the home screen using transaction code PE02 (Figure 10).


Figure 10
Enter transaction code PE02 to access PCRs from the home screen

Enter PE02 in the field and click the green checkmark icon on the left and the screen in Figure 11 opens.


Figure 11
Open PCR TMON in view mode

Enter TMON as the Rule name, select the Source text radio button, and click the Display button. This action opens the screen in Figure 12 with the details for PCR TMON.


Figure 12
The details for PCR TMON for grouping employees for time processing

PCRs use operations (usually standard and pre-delivered in the system) to do some processing on the employee record being managed. The details for PCR TMON are as follows (Note: MODIF—modifier—is an operation within PCR TMON):

Set ESG for PCR: These values are determined by the configuration values in table V_503_B (Figure 13). This table groups employees based on their employee (EE) group (i.e., A or B) and employee subgroup (i.e., W1 or 01). (How to access this table is explained later in this article, in the section “An Overview of the Configuration Tables Used in Time Evaluation.”)


Figure 13
The employee sub-grouping (ESG) for the PCR grouping in table V_503_B

MODIF: This is the operation that sets the value of the various variables associated with this operation. These variables are used during processing (e.g., wage type generation) in time evaluation.

W=03: The time wage type selection group is assigned the value of 03 for the employee’s record that is being processed. This parameter W sets or groups the employee to group 03 for wage type processing. When wage types are generated, all the employees with the same wage type selection group are processed in the same way.

Creating Custom Schemas

To process recorded attendances of the employee to meet the custom needs of your company (e.g., all hours over 40 in a week to be paid as overtime), standard schema TM04 needs to be copied and then modified. To copy it, go to the initial screen of the schema (TM04) and click the copy icon (boxed in blue in Figure 11). This action opens the pop-up screen in Figure 14.


Figure 14
Name the custom schema ZM04

The From schema field shows TM04. Specify the name of your custom schema in the To schema field (ZM04 in this example) and press Enter. This takes you back to the previous screen where you now see ZM04 as the schema name (Figure 15).


Figure 15
Schema name ZM04

Click the Change button and the screen in which you can edit the custom schema ZM04 opens (Figure 16).


Figure 16
The new, customizable schema ZM04 copied from standard schema TM04

There are various blocks within the schema, shown in Figures 17, 18, and 19. Each block has multiple functions used to perform various processing in sequential steps. The first block (Figure 17) performs the initialization step using function MOD and PCR TMON (Figure 11).


Figure 17
The Initialization block of the new time schema

The next block, Provide time data (Figure 18), reads the recorded time data, such as attendance or time swipe, absence, substitution, and planned working time or schedule of the employee.


Figure 18
The Provide time data block of the time schema

The blocks in Figure 19 determine overtime and generate the time wage type to be passed on to payroll.


Figure 19
The Determine overtime and Select time wage types blocks of the new schema

The overtime calculation and related wage type generation are done in the Determine overtime and Select time wage types blocks, respectively, as shown in Figure 19.

The Determine overtime block of the schema has two sub-schemas, TW15 and TW30 (Overtime after x hours/day and Overtime after 40 hours/working week, respectively). Sub-schemas are schemas that are called within another schema (using the copy function). Sub-schema TW15 has two PCRs (TO01 and TO02) to generate daily overtime (Figure 20).


Figure 20
Schema TW15 with PCRs TO01 and TO02 to determine daily overtime

For scenario of clock-time recordings sub-schema TW30 has two PCRs (TW31 and TW32) to generate weekly overtime (Figure 21).


Figure 21
Schema TW30 with PCRs TW31 to TW36 to determine weekly overtime

PCR TO01 for Calculating Overtime

PCR TO01 is one of the rules for calculating overtime. (It can be accessed in two steps explained in the instructions before Figures 10 and 11.) Once opened, the rule tree is executed by the system from top to bottom (Figure 22).


Figure 22
PCR TO01 to calculate overtime on a day (after 8 regular hours)

In the rule (PCR) TO01, the first operation VARST uses parameter DAYTY (day type) to get the value of the day type (of the current day being processed in time evaluation) based on configuration in table T553A (Figure 23). So, on a public holiday, the value is returned as 1, and on other days, the value of the day type is returned as 0 (blank).


Figure 23
The standard day types defined in table T553A (0 and blank are considered the same)

Next, operation VARST uses parameter FREE to get a Boolean yes (Y) or no (N) answer based on whether the current day being processed is a day planned for work (e.g., a shift assigned) or an off day (no shift hours assigned).

So, standard PCR TO01 sets the hours (HRS) to the value 8 using operation HRS=8,00 on a day that is not a public holiday (i.e., day type 0, work/paid day) and is a free day (planned hours are less than 0). PCR TO01 then assigns this value of 8 to time type 0900 using operation ADDDB0900Z. Thus, this rule considers all hours worked beyond 8 on a non-working day that is not a public holiday to be overtime hours.

An Overview of the Configuration Tables Used in Time Evaluation

Time types are used as counters for hours (e.g., hours worked, regular hours, and overtime, as shown in Figure 2) to keep track of the different types of daily (or weekly or monthly) hours. These time types are defined in table T555A. Standard time types are predefined in the system. To define a new custom time type, enter transaction code SM30 in the SAP Easy Access screen (Figure 3) and press Enter. This action opens the initial view of the Edit Table View screen (Figure 24).


Figure 24
Access the different configuration tables (V_T555A in this case)

Enter the Table/View name as v_T555A and click the Maintain button. This action opens the table of time types (Figure 25).


Figure 25
Create a new entry for your custom time type

Click the New Entries button to define new time types to be used as hour counters. In the screen that opens (Figure 26), enter the PS Grouping, Time type, and Start and End dates. Set the value for the Save as day balance to 1 and click the save icon to save your settings.


Figure 26
Create a new custom time type

The values set in the time type can be persisted or saved in the database. This is used if the value calculated in the previous processing is to be retrieved and used for any purpose in later time evaluation runs or processing. It can also be used to generate a report for daily values or for audit purposes. There are two different types of balances associated with the time type:

  • The value of the day balance in the Balances section is set to 1 if the value assigned to it for a complete day (by the time evaluation program) is to be saved in the results cluster of the database. For example, time type ZTMH would save the total time-and-a-half hours of a day in the day balance.
  • Similarly, the value of Cumulate in period balance is set to 1 if the value cumulated in the time type for a period is to be saved in the results cluster. For example, if time type ZTMH has a value of 8 hours in the day balance for 20 days in a month, the total time-and-a-half-hours of a period (month) in the period balance would be 160 hours. The value is reset to 0 at the start of a month.

If cumulated period values are to be continued (and not reset to 0) across months or years, the Transfer prev. period and Transfer prev. year are set to 1. In such cases the cumulated values are transferred from the previous month or year to the next. This cumulation across periods or years would typically be used for those time quota calculations that do not lapse at the end of the year and hence should be transferred across periods and years.

An example of transfer of cumulation would be employee’s annual leave quota, which does not lapse. In such cases the Transfer prev. year option ensures that annual leave quota from the previous year is carried over (cumulated over) to the next year.

Creating Custom PCRs

In this scenario, you need to generate overtime on all the scheduled days that are not holidays (for hours worked beyond 8). Go back to the SAP Easy Access screen in Figure 3 and enter transaction code PE02 (the transaction code for PCRs) and press Enter.

In the screen that opens (Figure 27), enter the name of the standard PCR that needs to be copied in the Rule field (in this case, TO01), select the Source text radio button, and click the copy icon.


Figure 27
Copy standard schema TO01

Reading the comments of the schema provides you with a fair idea of what processing is done where. For example, the schema TM04 line 510 has the comment Overtime after x hrs/day (Figure 19). This line calls sub-schema TW15. After the system opens sub-schema TW15 (Figure 20), line 30 has the comment Initialize overtime limit x. This indicates that the limits are set in the rule (PCR) TO01 so this is where the standard initialization needs to be replaced with a custom one.

In the pop- up window that opens (Figure 28), enter the name of the custom PCR as ZO01 and press Enter (or click the green checkmark icon).


Figure 28
Name your custom PCR ZO01

This action takes you back to the initial screen of the PCR (Figure 29). Enter ZO01 in the Rule field and click the Change button.


Figure 29
Open PCR ZO01 in change mode

Make your required changes to the custom schema in the screen that opens (Figure 30). You can make changes, additions, or deletions to the existing entries using the icons in the top ribbon. In this example, this PCR defines the rules for segregating regular, time-and-a-half, and double-time hours.


Figure 30
Rule ZO01 with time types ZTMH and ZDBT (these time types define the daily limit for overtimes [time-and-a-half and double-time])

Using the same steps detailed in Figures 27 through 30, copy standard PCR TO02 into custom schema ZO02 (Figure 31). This PCR segregates hours into regular and overtime.


Figure 31
PCR ZO02 with logic to segregate out regular hours and overtime hours

A new PCR ZO03 (Figure 32) is created manually from scratch rather than being copied from a standard PCR.


Figure 32
PCR ZO03 where overtime hours are segregated into time-and-a-half and double time

This PCR ZO03 is called from PCR ZO02 using operation GCY (Figure 33). PCR ZO03 segregates the overtime hours into time-and-a-half and double-time.


Figure 33
Schema ZW15 (copied from TW15) with PCRs ZO01 and ZO02

I assume that PCRs ZO01, ZO02, and ZO03 do the processing that is required.

After the custom PCRs (ZO01, ZO02, and ZO03) are created, for the logic in the PCR to be triggered the following steps need to be done:

  1. Copy schema TW15 to schema ZW15 (follow the instructions before Figures 14 and 15)
  2. In sub-schema ZW15, replace PCRs TO01 and TO02 with PCRs ZO01 and ZO02 and click the save icon (Figure 33).
  3. In schema ZM04, replace sub-schema TW15 with sub-schema ZW15 and click the save icon (Figure 34).

Figure 34
Sub-schema ZW15 placed in schema ZM04

Generating Time Wage Types

Finally, once the hours are segregated, they need to be converted into time wage types. This step is done in the Select time wage types block (line 000540-0000580 in Figure 19).

Function GWT (generate wage types) uses the configuration in the individual entries of table T510S to generate the relevant wage types (Figure 35). This table is accessed by going to the table edit view screen (transaction code SM30 in the home screen) as shown previously in Figure 24.


Figure 35
Individual entry in table T510S that determines which wage types are generated

The wage type (e.g., 2100 for regular hours in Figure 35) is generated for all the time pairs that have processing type S (this processing type is attached to the time pair by the PCRs ZO02 and Z0O3). I describe PCRs ZO02 and ZO03 in more detail in my related article, “Implementing FSLA Using Time Evaluation.”) Likewise, wage type 2200 is generated for time-and-a-half and wage type 2300 is generated for double-time. After making this entry save it by clicking the save icon at the top of the screen.

Once all the changes to the PCRs and schema detailed above are done, it’s time to process the recorded time of the employee. It is done by going to the time evaluation program using transaction code PT60 (Figures 5 and 6).

The attendances detailed in Figure 2 are recorded in infotype 2002 for personnel number 650000. This is accessed using transaction PA30 from the home screen as shown in Figure 36.


Figure 36
Recorded clock times for the employee Bob Harris for the week 24th to 30th April 2017

We therefore run time evaluation for the period 24th Apr 2017 to 30 Apr 2017 so that all these records are processed by the program (Figure 37).


Figure 37
Execute time evaluation using custom schema ZM04

Enter the Personnel number (650000) of the employee, the Evaluation schema as ZM04, the Forced recalculation as of date as 24.04.2017, and the Evaluation up to date as 30.04.2017. Select the Display log check box. Entering these values instructs the program to process the time for personnel number 650000 from 24th Apr 2017 to 30th Apr 2017 using schema ZM04.

Click the execute icon and you see the time-evaluation results in a log as shown in Figure 38.


Figure 38
The time-evaluation results log for personnel number 00650000

This log is shown only when the Display log check box is selected in Figure 37.

The time wage types generated can be viewed by double-clicking table ZL (Figure 39).


Figure 39
Double-click table ZL to see the time evaluation results’ log

This action opens the related output (Figure 40).


Figure 40
Time wage types generated by time evaluation

An email has been sent to:





 

Riishi Ritambhar

Riishi Riitambhar is technical/functional consultant with over 12 years of experience in the area of HCM applications built on SAP ERP HCM and SAP SuccessFactors. His special areas of focus include SAP positive Time Management and Payroll integration. Riishi's SuccessFactors Employee Central experience includes extensive implementation experience of Metadata Framework, workflows, and business rules.



More from SAPinsider



COMMENTS

Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!


SAPinsider
FAQ