Payroll Control Center - Check Implementation Guide
Payroll Control Center - Check Implementation Guide
Check implementation
Customer
Contents
Introduction & Prerequisites
Customizing
Coding a Check
Public
Prerequisites
You have installed declustering on your system (notes 1774918 and 1846500 plus country-dependent note)
The Payroll Control Center has been set up according to the implementation guide.
While this is no prerequisite for following this implementation guide it is recommended to have declustered payroll data available for testing purposes.
You should listen to the recorded expert session (ca 2 hrs) before using this guide, as it assumes familiarity with the Payroll Control Center and the
terminology used.
This check implementation guide will take you through an implementation of a parameterized generic wage type check for the Payroll Control Center. This is
not a full documentation on the IMG or customizing and we will not touch on the meaning of every field therein.
Public
Customizing
Customizing 1
Set up parameter types
First, go to the IMG "Payroll Data Source Framework and select the
step Create Data Source Types.
We will start by defining the parameters of the check. Some parameters
are delivered by SAP and can be used.
Select Define Result Detail Types/Parameter Types.
There are three additional parameters we need:
A wage type
Z1AMT_LOW
Z1AMT_HIGH
Z1LGART
Public
Customizing 2
Define the amount parameters
Lower and upper limit differ only in their description. However, the check
does need two distinct parameters to allow the limits to be set correctly,
so both are needed. We are implementing a US-specific check, so we set
MOLGA to 10 and the currency to USD.
The EDM type allows you to choose between a decimal and a string important for conversion. Here we have a decimal of system type MAXBT,
and precision, digits, and data element are set accordingly. The
parameter reflects an amount and it is an input parameter, so both
checkboxes are set.
It is not a result - the result for this check will be a list of personnel
numbers.
The lower limit is also an amount (USD, for the US), and is configured the
same way, except for the description.
Public
Customizing 3
Define the wage type parameter
The wage type has no numerical properties, and those fields remain
empty.
We still make this a US specific parameter in this example. That means
we will only be able to use it in US specific checks.
Note:
These parameters do not necessarily have to be country specific. This is
an example only, and we recommend experimentation.
Public
Customizing 4
Create the data source type
Go to the next IMG step Create Data Source Types.
Create a new data source type Z_PYC_HRUS_GEN_WT_BT
Give the new data source type a text a short text.
Set the country grouping to 10, for the US, and Transparent
results to Supported.
The run time class is ZCL_PYD_GENCHECK_WT_BETWEEN. We will
create this class later. At this point in time it does not exist.
Public
Customizing 5
Assign input and result type parameters
Select Assign input type parameters.
We want our check to be able to select by a range of parameters, including
the three we defined just now. Assign those parameters as shown on the
right.
Fixed parameters are entered in customizing, and used to create a
specific check instance, e.g a check for >= 1000 USD gross for students
employed part-time.
Mandatory parameters are just that. All non-mandatory parameters do
not need to be set.
Select Assign result type parameters.
Assign PERNR as result type. This example checks for authorization on
infotype 8. If you have no authorizations for the data source framework
customized you can leave the field empty for this example.
The parameters and optional/mandatory need to be handled by the check code.
Public
10
Customizing 6
Assign Result Details
With parameter PERNR selected, select Assign Result Detail Type.
We want to show an employee header with generic information on the
employee, a generic overview, and for this check the payroll results in
form of a wage type list. These three generic views are delivered by SAP.
Add the views as shown in the image on the right.
The flag Is header puts the employee information in the header bar.
The flag Is default opens the generic overview when an employee is
selected.
The sort order defines in which order the icons are displayed.
These views are filled by the check code. That means for different checks you
can display different details.
Public
11
Customizing 7
Assign Status Change Reasons
Select Status Change Reasons. (The parameter PERNR should still be
selected from the previous step. If you have gone out of that view you will
need to select it again.)
For this generic check we expect exceptions that we might set to OK
manually for additional wage types or retrocalculation differences. Add
these two reasons as shown.
The reasons you have configured here will be shown as possible
selections in the pop-up that appears when you set an employee to OK
manually.
Public
12
Customizing 8
Setting up the UI: Tiles
We will now set up tiles, folders, and check instances that form the structure
we see on the UI. In this example, we restrict ourselves to one tile, with one
folder, and a few instances of our check.
Leave this IMG step entirely and go to Classify Data Sources / Set Up Data
Source Classes.
Create a class Z_US_TEST with the name US Payroll Result Checks.
This will create a tile on the UI with that name.
The class category is PY_COCKPIT. All check classes have this category.
It is delivered by SAP.
Parameter type is ABKRS- Payroll Area. This class works on payroll area
level.
Note: Empty tiles will not appear on the UI. You need to finish this customizing
section before you can expect to see anything.
Public
13
Customizing 9
Setting up the UI: Folders
Select Folder.
Create a folder Earnings for country grouping 10 US. We will create a
few check instances for earnings and assign them to this folder.
Public
14
Customizing 10
Setting up the UI: Assign data source types to folders
Select Assignment data source type to folder.
Create a folder Earnings for country grouping 10 US. We will assign
our data source type to this folder. Its instances will appear here.
Public
15
Customizing 11
Defining check instances
Leave the previous IMG step and go to Define Data Source Instances.
We define two instances:
Low retrocalculation difference ( /552 <= 100 USD)
Severance pay (MII3 exists: 0<= M113 <= 99999999 USD )
There are many more checks you can implement simply by parameterizing this
generic wage type check. In this example we do not restrict the check by
organizational assignment. (For other examples, such as high gross which
may be different across personnel groups, that may make more sense.)
Public
16
Customizing 11
Defining check instances
Leave the previous IMG step and go to Define Data Source Instances.
We define two instances:
Low retrocalculation difference ( /552 <= 100 USD)
Severance pay (MII3 exists: 0<= M113 <= 99999999 USD )
Note: You can check for existence of a wage type by checking for a value
between 0 and the maximum amount. With this check you cannot check for
missing wagy types.
There are obviously many more checks you can implement simply by
parameterizing this generic wage type check. In this example we do not restrict
the check by organizational assignment. (For other examples, such as high
gross which may be different across personnel groups, that may make more
sense.)
Public
17
Customizing 12
Defining check instances instance setup
We will walk through the low retrocalculation check. The severance
payments check is set up analogously, with the parameters shown on the
previous slide.
Create a data source instance as shown on the right.
Give it a name and a short, name, and assign it to country grouping 10 for
the US.
Select Uses transparent payroll results.
The type is the data source type we created earlier:
Z_PYC_HRUS_GEN_WT_BT
Public
18
Customizing 13
Defining check instances instance parameters
Select Instance input parameter
In this example we set only the mandatory parameters we defined earlier:
payroll area, wage type, lower limit, and upper limit.
Create parameter Z1LGART as shown on the right. The selection value is
the wage type: /552. It has no currency or measurement unit, and those
fields cannot be set.
Analogously, create the lower limit Z1AMT_LOW (selection value 0) and
the upper limit Z1AMT_HIGH (selection value 100). The currency is set
automatically as defined by us earlier.
Create the parameter ABKRS. The selection parameter should be an
existing payroll area for which you have test data.
Now we have all the customizing in place that we need for our example. In the
next section we will discuss the code behind it.
Public
19
Coding a check
Method structure:
Public
21
Code 1
Creating the check class
In this section we will create the runtime class for our check. You can either
access it via the IMG step in which you created the data source type, or via
transactions se24 or se80.
Create class ZCL_PYD_GENCHECK_WT_BETWEEN
Inherit class CL_PYD_TY_PERNR_BASE
Ensure interfaces IF_PYD_TY_RT and IF_PYD_TY_DT are present.
Public
22
Code 2
Creating the attributes
First, we create the attributes that store the parameters we need for our check.
That includes those parameters defined in the IMG as well as definitions for
corresponding selection ranges.
Please note that for easier re-use and control this is given as code on the right
side. For this part it is probably easier to work in the source code editor of
transaction se24 rather than in the graphical interface.
PROTECTED SECTION.
DATA mt_range_bukrs TYPE RANGE OF bukrs.
DATA mt_range_werks TYPE RANGE OF persa.
DATA mt_range_persg TYPE RANGE OF persg.
DATA mt_range_persk TYPE RANGE OF persk.
DATA mv_amt_low TYPE maxbt.
DATA mv_amt_high TYPE maxbt.
DATA mv_lgart TYPE lgart.
You will note that some parameters are missing. For ease of reading we will not
show all code on the right, but only the parts relevant for our discussion.
Full sample code is attached at the end of this presentation.
Public
23
Code 3
The check method getting the optional parameters
The check is executed via the EXECUTE method of interface IF_PYD_TY_RT.
For our purposes, we need to redefine this method.
In the code on the right, all attributes are set first.
Then, we look for the optional parameter BUKRS that we defined in the IMG. If
it is set, a selection range is set.
Public
24
Code 5
The check method executing the check
SELECT DISTINCT rgdir~pernr INTO TABLE lt_pernr
Now, we have all parameters and selection ranges and can execute the check.
With declustered tables, this is a simple SELECT statement.
The payroll results are stored in transparent table P2RX_RT, and they are still
accessed via tables RGDIR and WPBP, but now in an SQL JOIN, and in a single
statement.
In the WHERE clause you find a selection on exactly those parameters that we
defined in the IMG.
All that is left now is to sort and return the list of personnel numbers we get
from the SELECT.
Public
25
Code 6
The overview method retrieving data for the UI
Here, after retrieving data from the payroll area for the begin and end dates, we
read infotype 8, and use it to fill an output table with salary data. This output
table will be shown on the UI exactly as filled here.
See the code sample at the end for the full implementation using several
infotypes and grouping the output.
METHOD get_generic_overview.
[]
lif_infotype_reader->read(
EXPORTING
tclas
= 'A'
pernr
= mv_pernr
infty
= '0008'
begda
= lv_begda
endda
= lv_endda
no_auth_check = abap_false
IMPORTING
infotype_tab = lt_infotype_tab
data_exists = lv_data_exists ).
IF lv_data_exists = abap_true.
cl_hr_pnnnn_type_cast=>prelp_to_pnnnn_tab(
EXPORTING prelp_tab = lt_infotype_tab
IMPORTING pnnnn_tab = lt_p0008 ).
ENDIF.
lv_group_id = 'SALARY'.
lv_group_name = 'Basic Pay'.
LOOP AT lt_p0008 ASSIGNING <ls_p0008>.
ls_gov-text = 'Annual salary'.
ls_gov-value = <ls_p0008>-ansal.
ls_gov-groupid = lv_group_id.
[]
Public
26
Code 7
The wage type list retrieving data for the UI
Here, we retrieve the payroll results for an employee and append it to an output
table. This output table will be shown in the Wage Type List tab on the UI.
For a full implementation have a look at the attached code samples.
METHOD get_simple_wt_list. .
[]
CLEAR rt_list.
SELECT rt~lgart rt~betrg t512t~lgtxt INTO CORRESPONDING FIELDS OF TABLE lt
_rt FROM hrpy_rgdir AS rgdir INNER JOIN
p2rx_rt AS rt ON
rgdir~pernr = rt~dct_pernr AND
rgdir~seqnr = rt~dct_seqnr
inner JOIN t512t AS t512t ON
t512t~sprsl = sy-langu AND
t512t~molga = iv_molga AND
t512t~lgart = rt~lgart
WHERE
t512t~lgart in lt_lgart and
rgdir~pernr = mv_pernr AND
rgdir~abkrs = mv_abkrs AND
rgdir~srtza = 'A' AND rgdir~fpper = mv_period AND rgdir~inper =
mv_period.
LOOP AT lt_rt INTO ls_rt.
ls_output_rt-text = ls_rt-lgart && ' - ' && ls_rt-lgtxt.
ls_output_rt-amt = ls_rt-betrg.
ls_output_rt-num = ls_rt-anzhl.
ls_output_rt-rte = ls_rt-betpe.
ls_output_rt-amt_curr = 'USD'.
APPEND ls_output_rt TO rt_list.
ENDLOOP.
ENDLOOP.
Public
27
Sample Code
Sample code is attached to the note.
This code is split into two classes: some parts can be used in more than the
wage type check only, and these are included in the class
ZCL_PYD_HANA_CHECKS_BASE.
Public
28
Thank you
Public
30
Public
31