SAP Payroll Basics: Schema Structure

Since my earliest days working with SAP's Payroll module I've used a certain structure for the payroll calculation schema that gives customers more flexibility than what's delivered out of the box. It's pretty simple, decreases maintenance effort and improves the quality of your testing, Who wouldn't want that?

In SAP Payroll we really need to be able to run the payroll calculation for all sorts of different payroll periods so that we can test the calculations, troubleshoot and so on. But the standard payroll calculation schema checks the payroll control record and only runs the period that is released there. That's great - essential! - to have in a productive system, but in a test system it requires more effort to go around setting the payroll control record to all sorts of different periods. And if you have more than one person testing, it gets interesting sharing the one payroll control record. So to avoid that, people often make a copy of the payroll calculation schema and then comment out the line that checks the payroll control record - problem solved! Well, not really. Any time you change the production payroll calculation schema, you have to remember to also update the test version. In the real world, they never stay in sync, you end up with a test schema that isn't exactly like production, that leads to bad test results, and before you know it you are paying people incorrectly. Let's not do that - here's an easy solution.

Programmers will recognize this technique of 'includes' - in the payroll calculation schema syntax it's a 'COPY' function. So let's put all the main payroll calculation schema logic in one 'include' and then call it from two different schemas - one for production (which checks the payroll control record) and one for test (which doesn't check the control record). Here's how I do it.

First, copy the standard schema U000 to )U10 - using the US in my example, and the ')' character is for my customer name space. If you don't want to use ')' choose another one - check report RDDKOR54 on table T52C0 (the schema table) to see what values are allowed. Once you create )U10, change its attributes and uncheck the 'Schema can be executed' checkbox. Then in the source text comment out schema UIN0. Schema UIN0 is where 'CHECK ABR' is called, to check against the payroll control record. Don't worry - we will check it later. My screenshot also has a modified version of UBD0 - don't worry about that, we just had to make some changes there for a different purpose.


Now, create schema )U00, make it executable, and title it 'Production Payroll Schema - US'. It will have two lines - the first is a COPY of the initialization schema and the second is a COPY of schema )U10. Schema UNI0 is the standard SAP initialization schema that checks the payroll control record, and then schema )U10 has all the calculation logic. In my example below I have schema )U17 instead of UIN0 because I had to enable hourly rates with more than two decimals.





OK, so now we have our production schema - let's make a test version. Copy schema UIN0 to a new schema - mine is )U18. And in that schema, comment out the CHECK ABR line, so that we can ignore the payroll control record. Then copy schema )U00 to )U01 (Test Payroll Schema - US). This new )U01 is just like )U00 except we are calling initialization with )U18, like this -




And that's all you need to do! If you are testing, use schema )U01, and in production use )U00. All your configuration for the payroll calculation will be done in schema )U10 and it's sub-schemas and rules. That )U10 gets called in both the test and the production versions.

Transport all this through to production. Some clients have been nervous about having the test schema )U01 in the production system because they don't want anyone to be able to run payrolls for various periods. It's a good question - but built into the payroll driver is a validation that prevents schemas without 'CHECK ABR' from creating results in a productive system. So it's not possible to create payroll results with schema )U01 in a production system. Try it if you want - set the client role of your QA system to productive and save a payroll with schema )U01 to see the error message.

This framework is also very useful for other purposes. For example, sometimes I will make a )U03 copy of )U01 and put in a custom payroll calculation rule to automatically put 40 hours of straight time in the IT table for hourly employees. It's a quick shortcut to getting some pay generated without having to enter time. I also use it in the US to set flags for changing the tax schema's behavior so that it can be used for the Claims Report PC00_M10_CLAIMS - but more detail on that in another blog.

34 users have voted.

Add new comment