In SAP HR, functions provide the high-level logic for calculations. The functions can be associated with either a payroll class or time management class. In payroll, they provide the overall functionality for payroll processing including rules for calculations. Functions perform general processing such as reading wage types from specific infotypes, calculating payroll taxes on a given set of wages, benefits premiums etc and storing the results of the payroll calculation.
To understand how to read the functions, below is the example for one of the payroll functions, WPBP (Import work center and basic pay data).
WPBP (Import work center and basic pay data)
This function is used to transfer master data on the work center and basic pay for the payroll period to internal table WPBP. The basic pay wage types are stored in the internal table IT. If all the fields of the table WPBP are same during the entire payroll period, this table will contain one record. However, in certain cases different data may exist for different partial periods. In such cases, there will be multiple entries, which are identified by split indicators. Such cases have been explained in the below sections along with the screenshots.
Viewing the function
SAP Payroll comprises of many functions which can be accessed via transaction PE04. Some of these are country-specific while others are not. Each function is defined and documented and can be viewed via transaction PDSY in releases 4.5 and greater, or with report RPDSYS00 in earlier versions.
T Code: PE04
Characteristics of the function
Each function has a corresponding ABAP code associated wit it, which is obtained by adding ‘fu’ at the beginning of its name. While a payroll function may comprise of ABAP code, it is not executed in similar way as ABAP code is. A payroll function is executed in the payroll driver using schemas. Thus, when the payroll driver executes the schema, it automatically puts ‘fu’ in the beginning of the function name and then execute it further.
Usage of function in a Schema#
A function may be used as a part of schema or a sub schema, depending on the requirements. For example, in the below screenshots, the function ‘COM’ is used in the main schema X000 (International Personnel Calc. Schema for RPCALCX0 (International)), while the function WPBP is used as a function in the custom subschema XBD0 (Edit basic data).
Main Schema: X000
Sub schema XBD0
#A schema can be accessed via transaction PE01 and the details of the functions can be viewed by pressing F1 on the function name.
Syntax of a function
The syntax of a function in a schema is defined basis the parameter list defined in the characteristics of the function.
Below is the detailed explanation of the parameters.
- Par2 – different pay-scale type (No check)
- Par3 – rel. time unit (X – WPBP for each time unit)
- Par4 – Subtype of infotype 0008 (No check)
Thus for WPBP, if you specify a pay scale type which has not been maintained correctly in the indirect valuation tables, the personnel number is rejected during indirect valuation.
Setting the third parameter will result in split of WPBP in a greater detail if the time unit for the pay scale does not correspond to the time unit for the payroll area.
For the fourth parameter, the function WPBP is started for the subtype 0 of IT 08.
Executing function in Schema
A function cannot be directly executed in isolation. It can be executed only via schemas which are further executed using payroll driver. Key in the data in the payroll driver (T Code: PC00_M**_CALC_SIMU – payroll driver in simulation mode; ** indicates the country grouping or MOLGA)
T Code:PC00_M01_CALC_SIMU (01 – MOLGA for Germany)
The driver will execute various functions step by step as per the schema. In case the “display log” option has been checked in the payroll driver, a payroll log will be generated basis the inputs given.
The below screenshots depict the output of WPBP function and how the processing is done basis the inputs provided to the function. Here, WPBP function will pick up the inputs from P0000/ P0001 / P0007 / P0008 and P0027 tables and perform indirect valuation of wage types from basic pay in the processing step and subsequently transfer the data into WPBP Table.
Inputs for the WPBP Function
WPBP function will pick up the inputs from P0000/ P0001 / P0007 / P0008 and P0027 tables.
Detailed view of the inputs
Processing during the WPBP function
Indirect valuation of wage types from basic pay is performed in the processing step and subsequently that output is transferred into WPBP Table.
Output – Creation of WPBP Table
In case there are no changes to the IT 0000 / 0001 / 0007 / 0008 / 0027 during the given payroll period, there will be only one entry. However, if certain changes have been made to above infotypes during the payroll period, a split will be created for the partial periods and accordingly, multiple entries will be created in WPBP table. This is being shown in the subsequent section.
WPBP splits created by WPBP function
As mentioned above if there are any changes to IT 0000 / 0001 / 0007 / 0008 / 0027 for an employee during the given payroll period, a split will be created for the partial periods in WPBP table.
For example there had been a change in the basic pay for an employee in the middle of a given payroll period (01.04.2006– 30.04.2006), which resulted in multiple splits in WPBP Table.
Inputs for the WPBP Function
Processing of WPBP Table with splits
Output of WPBP Table with splits
Detailed output of WPBP Table with two entries