The Verification steps in the Payroll Control Center, using the Payroll Data Source Framework are a great idea, but having to write code for your own reports makes implementation a bit daunting.
And what happens if requirements change? If the required logic changes, chances are you need a developer to alter it.
BRF+ seemed to be a perfect place to capture the logic you need in payroll verification, I gave it a try and this is my hacked up prototype. I built it as a functional person with average ABAP and zero BRF+ experience, so please read this blog as a suggestion to get you thinking, rather than a how-to.
For example, this exception report gives me all people who have an increase in gross from last pay, but ignores anyone where the increase is due to overtime only. Here is how I did it:
In BRF+ Create a Decision Table Expression
I created this table, and a BRF+ Function for reading it with Data Source Instance as the incoming parameter.
Putting Data Source Instance as the parameter allows you to reuse the table.
Wtype Bucket is basically a total amount (similar to what you may build for a payslip summary).
Next column, I specify what wagetypes will go into the bucket – a bucket may have only one wagetype, or be a subtotal of many.
Finally I have a flag – the type of Verification I’m looking at is comparing this pay period with their last one. So, if the flag is a “1” – that means get the amount for last period. If it’s a zero, get the amount for this period (ie the one we are processing).
So – what my table above is saying is, for Instance *ZDI_HIGH_GROSS_NO_OT:
- Get wagetype /101 from last period and put the amount into bucket BR01
- Get wagetype /101 for this period and put the amount into bucket B001
- Get wagetypes 2100 and 2120 for this period and put the amount into bucket B002
In the source of the Instance Class – build the buckets
Some ABAP coding is needed in the instance class to call the BRF+ function created above. That gives us what wagetypes to report on, how they are totalled, and whether we are getting the amounts from this period or previous.
Now with a list of wagetypes to report on, the Instance Class reads the payroll results for people and amounts they have been paid for the requested wagetypes (either this or last period) and allocates them, by person, to the buckets as per the BRF+ table.
We end up with each person having buckets of amounts – all defined in BRF+, so if we want to add another bucket or just add more wagetypes it can be a customising transport – no need to alter the code.
In order to apply the logic in BRF+, we need to look at each person one-at-a-time. So looping through a sorted list of people and wagetypes, for each person I built a little table of just two columns, example below –
For each person, that little table is then sent back to BRF+ to check whether they are an exception or not.
In BRF+ Create a Formula Using the Buckets
This bit, I’m not sure if its the best way of building this particular type of BRF+ Function – but it worked. Anyway – you will get the gist of it.
First up, my BRF+ function signature has the little table above coming in plus the Data Source Instance – again, so that the function can be used for multiple instances with variations.
In order for the formula to use the bucket values held in the table, I created table operations that read the table for each bucket – this part, being a BRF+ newbie, I’m not sure if there is a better way..
Next, the function has a ruleset and currently one rule
This rule will change Boolean (“true or false”), based on the result of formula Excess Gross
Finally the formula Excess Gross looks like this:
So it will return “true” if B001 > ( BR01 + B002 ).
In other words, if wagetype /101 this period is greater than the sum of /101 last period plus overtime this period, return a “true”.
Include the Person as an Exception Based on the Result of the BRF+ Formula
After the BRF+ formula is processed, the Instance Class gets a “true” or “false” returned. If is true – the person is an exception and is included in the Datasource.
A lot of payroll verification boils down to “if x is greater or less than y, its an exception”. Whether you are comparing changes in values from previous periods, or checking amounts are within a threshold (eg check for anyone exceeding $1,000,000 net!), its pretty easy to define the requirements in maths notation.
Within BRF+ the Payroll Validation functions can be treated as customising, a functional person can maintain them without developer input. For example, in the prototype I made, if the customer now wanted a threshold of, say 10%, they can add it themselves by updating the BRF+ function and don’t need to touch the instance class. eg:
Or I could create another instance and some other buckets, then in BRF+ define a totally different formula and link it to the new instance, creating a new verification report using the same ABAP code, without needing a developer.
Of course, the same way of thinking could be applied to pre-payroll checks based on infotypes or other data.