You are on page 1of 31

Payroll Control Center

Check implementation

Customer

Contents
Introduction & Prerequisites
Customizing
Coding a Check

2014 SAP AG or an SAP affiliate company. All rights reserved.

Public

Introduction & Prerequisites

Prerequisites

You have installed declustering on your system (notes 1774918 and 1846500 plus country-dependent note)

You have installed HR Renewal 2.0

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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 lower limit (amount)

An upper limit (amount)

A wage type

Z1AMT_LOW
Z1AMT_HIGH

Z1LGART

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

We do not assign attributes in any of the other steps for these


parameters.

Note:
These parameters do not necessarily have to be country specific. This is
an example only, and we recommend experimentation.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.)

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.)

2014 SAP AG or an SAP affiliate company. All rights reserved.

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

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

Public

19

Coding a check

Structure of a check class


In order to implement our sample check, we need to define methods for:

Method structure:

Execution of the check

Filling the overview tab on the UI

Retrieve the instance parameters

Filling the wage type list on the UI

SELECT employees from the database

The employee header information is already filled in a standard class.


Keep the structure given on the right side in mind when following the example
on the next slides.

Execute (find all employee that fail a given check):

Return the results


Get overview/wage type list (for a single employee when selected in the UI):
Retrieve the parameters
SELECT overview data / wage types
Fill the output table
Return the output table

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

CLASS ZCL_PYD_GENCHECK_WT_BETWEEN IMPLEMENTATION.


METHOD if_pyd_ty_rt~execute.
super->if_pyd_ty_rt~execute( is_inst = is_inst
is_ty = is_ty
it_par = it_par
).

Then, we look for the optional parameter BUKRS that we defined in the IMG. If
it is set, a selection range is set.

FIELDSYMBOLS <ls_exec_param> LIKE LINE OF mt_exec_parameters.

The other optional parameters are set accordingly.

LOOP AT mt_exec_parameters ASSIGNING <ls_exec_param>.


set_attribute( EXPORTING
iv_attribute_name = <ls_exec_param>-par_type
iv_attribute_prefix = 'Z1' ).
ENDLOOP.
DATA ls_range_bukrs LIKE LINE OF mt_range_bukrs.

IF mv_bukrs IS NOT INITIAL.


ls_range_bukrs-option = 'EQ'.
ls_range_bukrs-sign = 'I'.
ls_range_bukrs-low = mv_bukrs.
APPEND ls_range_bukrs TO mt_range_bukrs.
ENDIF.
2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

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 p2rx_wpbp AS wpbp ON
rgdir~pernr = wpbp~dct_pernr AND
rgdir~seqnr = wpbp~dct_seqnr
WHERE
wpbp~bukrs IN mt_range_bukrs AND
wpbp~werks IN mt_range_werks AND
wpbp~persg IN mt_range_persg AND
wpbp~persk IN mt_range_persk AND
rgdir~abkrs = mv_abkrs AND
rgdir~srtza = 'A' AND rgdir~ipend
BETWEEN lv_begda AND lv_endda AND
rt~lgart = mv_lgart AND rt~betrg
BETWEEN mv_amt_low AND mv_amt_high.
ls_result-par_type = if_pyd_cont_types=>gcs_par_type-pernr.
sort lt_pernr.
DELETE ADJACENT DUPLICATES FROM lt_pernr.
LOOP AT lt_pernr INTO lv_pernr.
ls_result-id = lv_pernr.
INSERT ls_result INTO TABLE rt_result.
ENDLOOP.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.
[]

2014 SAP AG or an SAP affiliate company. All rights reserved.

APPEND ls_gov TO rt_overview.


CLEAR ls_gov.
EXIT.
ENDLOOP.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

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.

2014 SAP AG or an SAP affiliate company. All rights reserved.

Public

28

Thank you

2014 SAP AG or an SAP affiliate company. All rights reserved.

2014 SAP AG or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG or an SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG (or an SAP affiliate
company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP AG or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP AG or its
affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP AG or SAP affiliate company products and services
are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.
In particular, SAP AG or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or
release any functionality mentioned therein. This document, or any related presentation, and SAP AGs or its affiliated companies strategy and possible future
developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP AG or its affiliated companies at any time for
any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forwardlooking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place
undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

2014 SAP AG or an SAP affiliate company. All rights reserved.

Public

30

2014 SAP AG oder ein SAP-Konzernunternehmen.


Alle Rechte vorbehalten.
Weitergabe und Vervielfltigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrckliche schriftliche
Genehmigung durch SAP AG oder ein SAP-Konzernunternehmen nicht gestattet.
SAP und andere in diesem Dokument erwhnte Produkte und Dienstleistungen von SAP sowie die dazugehrigen Logos sind Marken oder eingetragene Marken der
SAP AG (oder von einem SAP-Konzernunternehmen) in Deutschland und verschiedenen anderen Lndern weltweit. Weitere Hinweise und Informationen zum Markenrecht
finden Sie unter http://global.sap.com/corporate-de/legal/copyright/index.epx.
Die von SAP AG oder deren Vertriebsfirmen angebotenen Softwareprodukte knnen Softwarekomponenten auch anderer Softwarehersteller enthalten.
Produkte knnen lnderspezifische Unterschiede aufweisen.
Die vorliegenden Unterlagen werden von der SAP AG oder einem SAP-Konzernunternehmen bereitgestellt und dienen ausschlielich zu Informationszwecken.
Die SAP AG oder ihre Konzernunternehmen bernehmen keinerlei Haftung oder Gewhrleistung fr Fehler oder Unvollstndigkeiten in dieser Publikation. Die SAP AG
oder ein SAP-Konzernunternehmen steht lediglich fr Produkte und Dienstleistungen nach der Magabe ein, die in der Vereinbarung ber die jeweiligen Produkte und
Dienstleistungen ausdrcklich geregelt ist. Keine der hierin enthaltenen Informationen ist als zustzliche Garantie zu interpretieren.
Insbesondere sind die SAP AG oder ihre Konzernunternehmen in keiner Weise verpflichtet, in dieser Publikation oder einer zugehrigen Prsentation dargestellte
Geschftsablufe zu verfolgen oder hierin wiedergegebene Funktionen zu entwickeln oder zu verffentlichen. Diese Publikation oder eine zugehrige Prsentation,
die Strategie und etwaige knftige Entwicklungen, Produkte und/oder Plattformen der SAP AG oder ihrer Konzernunternehmen knnen von der SAP AG oder ihren
Konzernunternehmen jederzeit und ohne Angabe von Grnden unangekndigt gendert werden.
Die in dieser Publikation enthaltenen Informationen stellen keine Zusage, kein Versprechen und keine rechtliche Verpflichtung zur Lieferung von Material, Code oder
Funktionen dar. Smtliche vorausschauenden Aussagen unterliegen unterschiedlichen Risiken und Unsicherheiten, durch die die tatschlichen Ergebnisse von den
Erwartungen abweichen knnen. Die vorausschauenden Aussagen geben die Sicht zu dem Zeitpunkt wieder, zu dem sie gettigt wurden. Dem Leser wird empfohlen,
diesen Aussagen kein bertriebenes Vertrauen zu schenken und sich bei Kaufentscheidungen nicht auf sie zu sttzen.

2014 SAP AG or an SAP affiliate company. All rights reserved.

Public

31

You might also like