Implementing Validation Rules in The New Payroll Control Center - SAP Blogs

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

Community

Ask a Question Write a Blog Post Login

Steve Cottrell
May 13, 2016 12 minute read

Implementing validation rules in the new Payroll Control Center


Follow RSS feed Like

10 Likes 6,488 Views 6 Comments

As many of you are aware, the new Payroll Control Center provided by SAP gives powerful and user friendly functionality to the execution and validation of payroll within SAP.

The Rapid Deployment Solution (RDS) for the new Payroll Control Center has just been released (here) along with many great validation rules and KPIs that you can use to rapidly implement
the PCC for your business / customers.

However, it will also be important that you can add additional value to your customer by implementing customer speci c validation rules over and above what is provided in the RDS.  This Blog
goes through, at a high level, how to create a new validation rule.  It should be read in conjunction with the PCC RDS overview on SCN available here. This Blog is merely a summary with high
level aspects.  To go through it all in detail would be more of a training course than a blog.

Basic Principles

Firstly – the purpose of any validation rule is to, as quickly and easily as possible, provide the information required to resolve the issue.

Secondly – it is also as important to build a validation rule’s solutions in a way that mean the issue can be resolved directly from the PCC (and even potentially automatically).

Thirdly – be creative.  The validation rules are not restricted to information in a particular logical database (i.e. PNP or PNPCE etc).  You can write validation rules or KPIs that look across
aspects of the system that are not just HR.  For example, in the PCC RDS there is a KPI that checks all posting documents are successfully posted in SAP Finance.  It does this by reading nance
tables to check that the posting run ID from payroll is within the documents posted in the BKPF nance table.  Due to the PCC not being restricted to just the HR and Payroll module, you could
create a KPI for things like establishing all vendor payments posted from payroll to accounts payable have been paid (for example), whether all inbound interface les have been received, etc
etc.

Fourthly – performance.  It’s important that what you write will run in a reasonable time-frame so it’s practical to be used.  Therefore it’s of signi cant bene t if you use declustered payroll
results rather than traditional function modules and macros to read payroll results.

For the purpose of this blog we’ll stick to creating an example employee related validation rule.  The example I’ll give here is a validation rule to establish where employees are assigned to
multiple positions in the Org Chart and their total FTE assignment for the sum of those positions is above 100%.

Validation Rule Structure

To create a new validation rule, it’s best to copy one of the existing ones provided in the RDS, such as class /SMBERP/CL_PYD_PA_MAIN_BANK.

/SMBERP/CL_PYD_PA_MAIN_BANK has the below class structure:

I’ll highlight some of the key methods and their purpose:

IF_PYD_TY_RT~EXECUTE – This method is used to establish which employees have the issue of the type that your validation rule is looking for.  It’s the main engine to search for errors.

ERR_OV_GET_LIST – Provides information as to the reason why the employee came up as an error in the validation rule

ERR_SOL_GET_LIST – Provides the options to guide the Payroll Administrator to correct the error

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 1/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

There are also several methods called RDTs or Results Detail Types (These are the YSMB* methods).  The purpose of these is to show information in the detailed section of the Error
Management view of the PCC.  For example, method YSMB_WAGE_TYPE_REPORT shows the below information in the detail section of the Error Management view:

Once you have copied an example RDS class to your class name (and activated it), you’ll need to perform some con guration steps so that the class gets called.  Only once you’ve validated you
can get your copied class to work would I suggest you start changing it to meet your needs.

Con guration steps

The con guration steps for the validation rules are in section Payroll -> Payroll: International -> Payroll Data Source Framework of the IMG.  Note – these con guration steps are explained in far
more detail in the Implement Con guration Guide “Implementing Payroll Control Center Validation Rules (FM1)” document in the PCC RDS (here).

Step 1 – Create Data Source Types – Create Data Source Types.  This step is used to create the linkage between the Data Source Type and the validation rule class you are creating, see below:

It de nes what parameters you will be passing to your class (Personnel Area for example), what results detail types (RDTs) you will be displaying for your validation rule, and what reasons you’ll
present the user to be able to select in order to mark the validation rule as ‘Resolved’ for that employee.

Step 2 – De ne Data Source Instances is the step I normally then jump to in the IMG.  This step holds the values of the parameter you will be passing to your validation rule.  For example, in the
Personnel Area parameter mentioned in Step 1 above you may be passed Personnel Area US01 in order that your validation rule class can restrict the employees the rule is run for to only be
those in Personnel Area US01

Step 3 – Classify Data Sources -> Set Up Data Source Classes.  This step de nes what folders the validation rule will appear in and is used for logical grouping.  You may de ne your groupings by
the type of validation rule or the team that will process a group of validation rules so the Payroll Manager can easily assign out those validation rules in the Monitoring step of the PCC.

Perform the above steps by copying the entries for the validation rule you are copying from.  Once the above 3 steps have been setup, when you run the “Initiate Policies” step of the PCC, it will
execute your validation rule:

Validation rule logic – Execute Method

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 2/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

The purpose of the Execute Method is to identify the employees that have an issue in the quickest possible way.  Here we are not concerned with periphery information about the employee like
their name, basic pay etc, we simply want to get a list of employees that have the problem that this validation rule is there to identify, nothing more.

Now you have got this copied validation rule to run from the PCC, you need to look at altering the code to perform the validation you want for your customer.  Below is my example.

METHOD if_pyd_ty_rt~execute.

TYPES:

BEGIN OF t_hrp1001,

sobid TYPE sobid,

prozt TYPE prozt,

END OF t_hrp1001.

DATA:

……

LOOP AT it_par INTO ls_par.

CASE ls_par–par_type.

WHEN ‘ABKRS’.

l_abkrs = ls_par–low.

WHEN ‘PERIOD’.

l_period = ls_par–low.

WHEN ‘PERSA’.

l_persa = ls_par–low.

ENDCASE.

ENDLOOP.

lo_payroll_area = cl_hr_payroll_area=>get_instance( imp_area = l_abkrs ).

IF lo_payroll_area IS BOUND AND l_period IS NOT INITIAL.

“TODO

ELSE.

RETURN.

ENDIF.

lv_pabrj = l_period(4).

lv_pabrp = l_period+4(2).

lo_payroll_area->get_period_info( EXPORTING imp_pabrj = lv_pabrj

imp_pabrp = lv_pabrp

IMPORTING exp_begda = lv_begda

exp_endda = lv_endda ).

* Get all positions with 008 relationships between period start and end date

* Sum the FTE percentage for each day within the pay period

lv_date = lv_begda.

WHILE lv_date <= lv_endda.

“Note OpenSQL below in order to establish using one database query what items have an error

SELECT hrp1001~sobid, SUM hrp1001~prozt

INTO TABLE @lt_hrp1001 FROM hrp1001 AS hrp1001

INNER JOIN pa0001 AS it01 ON hrp1001~objid = it01~pernr

WHERE it01~begda <= @lv_begda AND

it01~endda >= @lv_begda AND

it01~sprps = ‘ ‘ AND

it01~abkrs = @l_abkrs AND

it01~werks = @l_persa AND

WHERE hrp1001~begda <= @lv_begda AND

hrp1001~endda >= @lv_begda AND

hrp1001~otype = ‘S’ AND

hrp1001~rsign = ‘A’ AND

hrp1001~relat = ‘008’ AND

GROUP BY hrp1001~sobid.

SORT lt_hrp1001. DELETE ADJACENT DUPLICATES FROM lt_hrp1001.

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 3/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

DELETE lt_hrp1001 WHERE prozt <= 100.

LOOP AT lt_hrp1001 INTO ls_hrp1001.

APPEND ls_hrp1001 TO lt_hrp1001_final.

ENDLOOP.

CLEAR: lt_hrp1001, ls_hrp1001.

lv_date = lv_date + 1.

ENDWHILE.

SORT lt_hrp1001_final. DELETE ADJACENT DUPLICATES FROM lt_hrp1001_final.

ls_result–par_type = if_pyd_cont_types=>gcs_par_type–pernr. “Note the results parameter type always has to be pernr

“Note the only item you can pass out of this method is a list of employee numbers. You can’t pass out anything else in the structure
like their name, location, employee group etc. You can fill that information per employee later in the IF_PYD_TY_RT~RESULT_DETAILS_GET
method

LOOP AT lt_hrp1001_final INTO ls_hrp1001.

ls_result–id = ls_hrp1001-sobid.

APPEND ls_result TO rt_result.

ENDLOOP.

ENDMETHOD.

Now, in order to debug your code to check that it is getting called and establish any errors or changes you may need to make to it, you can debug the job in SM37. To do that put a break point in your
EXECUTE method, select the ‘00001/Execute Check Instances’ job in SM37 and then enter jdbg in the transaction box on the top left.

This will then debug the job and you can hit F8 to run to your break-point:

Now you should be able to debug your validation rule to see if it’s not working as you want and adjust accordingly. It’s not practical to debug the rule using the normal method of running it via SE24 or
SE80.

Additional information to enable the Payroll Administrator to resolve the error

Once you have adjusted your EXECUTE method to the correct logic to identify the employees with an error, you can then move onto presenting information about that error to your Payroll
Administrators in a way that will enable them to resolve the error as quickly as possible, i.e. the second principle in the intro section above.

There are 3 sections of the PCC Error Management view that you can alter in order to present relevant information to the user, they are:

ERR_KV_GET_LIST – This method is used to populate key values in the error screen. It has not been used significantly in the PCC RDS, but is available to use if of value.

ERR_OV_GET_LIST – This method provides information as to the reason why the employee came up as an error in the validation rule

ERR_SOL_GET_LIST – This is a very important method as it enables you to give the possibility of enabling the users to resolve the issue with as little e ort as possible.  This doesn’t necessarily mean the
e ort for the business users is small, but rather you have the chance here to set things up for the user to that they have the most e cient path available to them to resolve the issue.  Where possible call
transactions directly in SAP or SF in order to allow the administrator to directly resolve the issue.

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 4/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

You’ll need to update the code in the above methods to provide the user information as to why an employee has come up in error and provide a means to resolve that error.

For example, in my validation rule here I call SAP WEBGUI when the user clicks on the link “Remove Excess Position assignment” in method ERR_SOL_GET_LIST to allow the user to alter the
position assignment of this employee:

Once you have done the above, your validation rule is setup, working and tailored to the business need.

Other aspects

This blog is at a very high level, and there are additional things that can be done to further add value to the business users. You can create KPI’s which can be used for things like reconciliations,
payroll status tracking etc. These work on a similar, but less complex way to the validation rules.

Also, there are several Results Detail Types provided in the RDS, but you can also define your own if there is particular information you may want to show the Payroll Administrator. For example, if you
have a validation rule in the time management area you may want to have an RDT that shows a time statement for the employee who has an error. Remember we want to make sure the Payroll
Administrator has all they need to be able to resolve the issue without having to exit the PCC and run a transaction or program in ECC (or SF) to find out further information about this error.

In Summary

Hopefully this blog helps to clarify that validation rules in the PCC are generally not onerous to build and are very powerful from a user experience perspective. Additionally, if you can structure your
rules and solutions so that the solutions provide a means to resolve the issue automatically or with minimal input you can significantly reduce the work your customers will need to do in order to
complete their payroll correctly and accurately.

Alert Moderator

Assigned tags

HCM (Human Capital Management) | SAP ERP | controlcenter | employee central | enterprise resource planning |

View more...

Related Blog Posts

A best-practice to implement SAP Payroll control center add-on


By Frans Smolders , Nov 24, 2014
Improve payroll data validation with SAP Payroll control center add-on
By Frans Smolders , Feb 13, 2014
https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 5/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

Learn about the Payroll Control Center for SAP Payroll & SuccessFactors Employee Central Payroll (Non Technical)
By Imran Sajid , Aug 26, 2016

Related Questions

Payroll Control record validation


By Former Member , Jun 26, 2010
Cost Center to Payroll
By Former Member , Sep 21, 2010
Payroll validation.
By Former Member , Oct 25, 2006

6 Comments

You must be Logged on to comment or reply to a post.

Jarret Pazahanick

May 16, 2016 at 3:11 pm

Nice job with this Steve.

Like(0)

Former Member

May 16, 2016 at 3:31 pm

Hi Steve,

This is a very good Blog! I like that you go into some of the details not just what we can read in help les

Thanks,

Serge

Like(0)

Imran Sajid

May 17, 2016 at 12:55 pm

Great stu as usual Steve!

Like(0)

Former Member

September 15, 2016 at 2:13 pm

Nice job, Steve!

I have a question: Is it possible to add several values for parameter? For example list of Wage Types I need to check?

I've tried to set it via customising, but got this error when I try to add second Wage Type:

Parameter type LGART already exists


Message No. PYD_FND203

Is there a possibility to have Range of values?

Thank you!

Like(0)

Imran Sajid

September 16, 2016 at 4:48 pm

Hi Maratkuls,

Yes this is possible but your input parameter would not be LGART. You would have di erent parameters such as LGART_HIGH and LGART_LOW which you would use to specify the range of
values (Ex: Wage Types 3000 to WT 3999) and of course the ABAP Code needs to be able to handle and read these parameters for the validation check.

Do you have the new PCC RDS installed in your system? If so, take a look at the setup of the validation rule "Positive deductions within a range".

If you are using the process context functionality which was released in 1602 then you should pass the values for wage type(s) from the code via the constants/custom table or even hard coding
(Usually not recommended) the value if you know that they are not going to change.

Regards,

Imran

Like(0)

Former Member

October 31, 2016 at 1:49 pm

Hi Team,
We are in the process of upgrading the Payroll Control Center (FP2) to PCC FP5. As per the documentation, I understand that the below Business Functions must be activated to ensure that the
new layout is visible in the front end. Please con rm if anything else is needed to view the Process Templates (PYP_V2_TEST_PAYROLL, PYP_V2_PRODUCTIVE_PAYROLL in the front end. Also,
after adding a custom process and adding a Policy to the Process, while generating the Process, the error 'Incorrect input parameters for check type PYD_EXAMPL_PERNR_CHECK_FP3 in
policy PAYROLL_POLICY_EXAMPLE_1' which eventually is a standard check.
HCM_LOC_CI_50

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 6/7
5/18/2021 Implementing validation rules in the new Payroll Control Center | SAP Blogs

HCM_LOC_CI_62
HCM_LOC_CI_63
HCM_LOC_CI_68
HCM_LOC_CI_72
HCM_LOC_CI_76
HCM_LOC_CI_79
HCM_LOC_CI_88
HCM_LOC_CI_89
HCM_LOC_CI_92
Please advise, how to re ect the new layouts in the front end.
Thanks,
Debjani

Like(0)

Find us on

Privacy Terms of Use

Legal Disclosure Copyright

Trademark Cookie Preferences

Newsletter Support

https://blogs.sap.com/2016/05/13/implementing-validation-rules-in-the-new-payroll-control-center/ 7/7

You might also like