Complete Payroll PCR Schema
Complete Payroll PCR Schema
Complete Payroll PCR Schema
PCR
by
Mohan
PrepareMe
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 2
HelpMe
PrepareMe
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 3
HelpMe
Objective
CONTENTS
Day 1
Concept of payroll driver and it's relation with schema and PCR
Concept of payroll driver
Payroll driver relationship with PCR and Schema
Concept of table header and Wage types
Introduction to schema
Introduction to schema
Functions in Schema
Documentation on functions
Structure of a schema
How to create a Schema
How to write a custom schema?
Examples on writing custom Schemas
Day 2
Introduction to PCR
Introduction to PCR
Operations in PCR
Documentation on operations
Rule Structure
How to write a custom PCR?
Examples on writing custom PCRs
Concept of processing classes in writing PCRs
Concept of payroll constants in writing PCRs
Documentation on Payroll Schema and PCRs
Expanding schemas and PCRs
Payroll run
PrepareMe
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 8
HelpMe
PrepareMe
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 11
HelpMe
Payroll Driver
(PC00_Mxx_CALC)
(PE01)
Rules
Functions
(PE02)
(PE04)
Operations
(PE04)
Payroll Results
(pc_payresult)
Number
Rate
Amount
2100
100.00
2100
100.00
4200
20.00
1500
40
10.30
412.00
SCHEMA
The payroll schema contains calculation rules to be used by the payroll
driver during payroll.
The personnel calculation schemas define the basic process of payroll or time
evaluation Schema is Basically collection of Functions and schemas to be
processed in sequential manner during payroll run.
Schemas can call other schemas within them using function COPY.
Transaction code for Schemas is PE01
Schemas are Country Specific
Report RPDASC00 can be used to search Schemas for Time and Payroll.
Edit Commands for Schema
D
Deletes a line
I
Inserts a line
C Copies a line
DD Indicates the start / end of a block to be deleted
CC Indicates the start / end of a block to be copied
A
Places the block after the chosen line
B
Places the block before the chosen line
Functions in Schema
Functions are used in Schema. Used to perform business process
specific calculation within the Payroll Driver run.
Transaction Code : PE04
Functions can me created with customer development. Z*
Few examples for Payroll Functions:
PIT/PRT -Function PIT will process a particular wage type or all
wage types in Input table/based on the parameter value
PRT -Function PRT will process a particular wage type or all
wage types in Result Table based on the parameter value
COPY -Function copy is used to copy a subschema in main
schema
IF & ENDIF - Used for conditional statement execution
BLOCK
- Used to begin or end certain blocks in a schema
REFRSH -This function will refresh tables based on the
parameter value
COM
-This function is used to comment a line
SORT - This function will sort tables based on the parameter
value
EXPRT
- This function will export payroll results to cluster
based on the parameter value
P0009/P0011 -These functions will be used to read infotype 0009
& 0011.
Schema Structure
The system processes these functions in sequence. A function must
be processed successfully before the next functions in the source
text can be processed.
Column D (Execution of function or subschema)
This indicator determines whether the function or subschema
specified in a line of the source text is executed. If you enter an
asterisk (*) in this field, you deactivate the function or subschema,
in other words, the function or subschema is not included when
the schema is executed.
Function
Most functions perform specific tasks that collect, process, or
display data. There are also
Functions to control the process: conditions (IF...ENDIF)
and loops (LPBEG...LPEND)
Functions to call subschemas (COPY)
Different functions to call personnel calculation rules
Goto TCode:PE01 and click on Create button, system will ask for
a program class(C-Payroll,T-time), Country grouping and if it is a
main schema then selection for Schema to be executed must be
marked to run in payroll.
The production schema ZUA0 is a simple one, just two lines. (See
Figure 5.) First, you call the initialization schema, and then you
call the main calculation schema ZUA1.
Copy schema ZUA0 to your test schema ZUAT. (See Figure 6.) You
want ZUAT to ignore the control record, so have it use schema UIN0
for initialization. Remember that CHECK ABR is commented out in
UIN0. Therefore, both the production and test schemas now use the
same calculation logic in schema ZUA1 which keeps them in sync.
Input
Table
Operations in PCRs
RTE
ex: RTE=
Tcode:PE04
Rule Structure
The rules treatment of wage types is also affected by how it is called
by the function. The rule gets its wage types from the function, so the
function controls what the rule can process.
Parameter 1 will have PCR for a particular function which can access
a PCR
Parameter 2 has the following values:
GEN Only access the **** wage type section of the rule.
Pxx Like GEN but brings along the value of the processing class
xx.
Exx Same as Pxx except for evaluation classes.
(blank) Access the section of the rule that corresponds to the
current wage type (will process only a specific wage type)
When you click on Create button system will ask for a Program
class (Time/Payroll) and Country Grouping.
Pcr: ZA01 will be processed for all ESG groupings of wage type /
181
Pcr: X043 & X047 will process wage type only for a specific wage
type not all wage types in input table.
Pcr: X042 & X047 will process all wage types in input table.
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 49
HelpMe
Example-1:
Example-1 Contd.
Example-1 Contd.
See Figure 10 for the IT after rule ZUA1 was processed, showing
the new wage type 0COL with the same A and AP splits as wage
type 0BAS, and 0.15 in the NUM field to reflect the percentage
used in calculation.
Figure 10 IT after processing of rule ZUA1
Example-2
Example-2 Contd
Example-3
Example-3 Contd.
Example-3 Contd..
Notice how the PIT function starts with rule ZUA4, branches to
ZUA5 and then returns. The IT before processing now has 0COL
in it (Figure 13).
Example-3 Contd..
Processing classes are one of the key methods of processing wage types
in SAP Payroll. Processing classes are attributes of a wage type. When
payroll runs, various procedures select and process wage types based on
their processing class values. In addition to standard processing classes
delivered by SAP, customers can create their own for custom payroll
processing for example, a class for fringe benefits.
A wage type has 99 processing classes, though Payroll does not use
every one of them for every countrys payroll. Table T52D8 shows which
processing classes apply to each country. Customers can use processing
classes 90 through 99 for their own purposes and the others are delivered
by SAP.
Below figure shows this view for wage type 0SAL, which is a US salary wage type.
Processing classes with a white box beneath them are available for US payroll.
The Payroll system does not use the other processing classes for US payroll
processing, so they are unavailable for input. Some processing classes are blank
because Payroll does not use them for this type of wage type in some cases. For
example, Payroll uses processing class 72 to define whether a wage type is an
employee tax or an employer tax. Since salary is neither, the screen displays no
value.
Example-4
Example-4 Contd.
Example-4 Contd..
When payroll runs, the processing section for rules ZUA6 and
ZUA7 look much the same as before, except you see constants
and processing classes (Figure 20).
Figure 20 Processing section for rules ZUA6 and ZUA7 with
constants and processing classes
When modifying wage types, constants, and other data via views in
transaction SM30 or the IMG, click on the blue i or Info button for
documentation. The current documentation is brought up in display
mode. Click on the edit button or press F5 to maintain it.
Transaction PDSY is a universal way to access all this
documentation, regardless of where it comes from. Via PDSY, you
can view and edit documentation, using the same editor, for many
different objects. Early releases of R/3 used report RPDSYS00 to
view and maintain documentation, but it has been replaced with
transaction PDSY. While RPDSYS00 may continue to exist, you
cannot be assured it is showing you the most recent documentation.
Document the Why
Each rule, schema, wage type, and constant can be documented
online. Click on the Goto menu and select Documentation. From
there, you can enter documentation on why you are making the
changes, reference the transport it is assigned to, and perhaps enter
other change management information (i.e. issue number, ticket
number and so on). The critical part is to define why you are making
the change, not just saying what the rule does. Most people who have
to come behind you to modify the rule can see what the rule is doing,
but may not know why it was done a certain way or if there are other
dependencies in the schema. This sort of documentation requires
very little effort, and saves much time in the future.
Payroll Driver
(PC00_Mxx_CALC)
Schema(PE01)
Contains
May Use
Rules(PE02)
Functions(PE04)
Contain
May
Operation(PE04)
Manipula
te
May
Manipulat
e
Wage Type(T512W)
The payroll driver can be run a number of different ways. From the
payroll menu for a specific country, select the Payroll>Start payroll
option. Or use transaction PC00_Mxx_CALC, where xx is the
country identifier (or MOLGA). The payroll driver can also be
executed from transactions SE38 and SA38. Any way you go, this
selection screen comes up (using U.S. payroll and the test
employee as an example). (See Figure 24.)
If you are using the schema ZUA0 for production payroll, the
payroll period is always left at Current period unless you are only
running simulations, which tells the payroll driver to get the current
pay period from the payroll control record. If you use the test
schema ZUAT, you could select Other period and then enter
whatever period and year you want to run, and save those results
(only in a non-production system). The payroll area in this section
is required and tells the payroll driver which payroll area to use for
deriving the current period, the period begin and end dates, and
other payroll area-related data.
The payroll log varies from one release to another and from one
country to another. It can also vary from one customer to another
depending on how the schemas were customized. For these
examples, the payroll log follows the standard schema U000 very
closely, on the Enterprise release. (See Figure 25.)
The log tells you that one employee was selected, and one
employee was successfully calculated. The number of periods
calculated may be more than the number of employees, since it
counts the current and retro calculated periods. Employees
rejected from payroll would be counted in the Rejected line. The
payroll driver rejects employees for two primary reasons a lack
of basic and consistent master data, and customization errors.
For the PIT function and rule ZUA8, you can see the Input,
Processing, and Output sections. These sections vary by
function and operation, but are vital to testing and
troubleshooting. If you double-click the PIT function, the
payroll driver displays the contents of the input, processing,
and output sections together in one list. Or you can doubleclick any one section to see its contents alone. Likewise, you
can further expand each section to see individual components
in this case, wage types.
In many of the detailed lists, you can see two icons a green plus
sign with a down arrow and a red minus sign with an up arrow
(Figure 27). These icons control the level of detail that is
displayed in the list. Click the green plus to see more detail and
the red minus to see less.
Figure 27 Green and red icons control level of detail
A rule can also filter wage types, or it can process all wage types.
It can filter by employee-subgroup grouping and by wage type.
This is an attribute of the rule, and different logic can be executed
for each set of filtered wage types. In Figure 28, you tell the editor
you want to edit the section of the rule that will process wage type
0BAS for all employee subgroup groupings. To see all the various
wage types a rule is set up for, click the overview button once you
are editing the rule. The various sections can be managed by the
Edit>ES Grouping wage or time type menu path inside the rule. If
the employee subgroup grouping or wage type are set to
asterisks, then they are valid for all values.
Figure 28 Select the section of the rule that will process wage
type 0BAS
After the above error Log, below changes were done to rectify it.
(Figure- 31)
PIT IN72 P72 NOAB
Exercises
1. write a PCR to read amount from a certain wage type (Ex: wage
type 1000) in input table and multiply it with the number of any
other wage type (Ex: wage type 1001) and then store it in the first
wage type (Ex: wage type 1000).
2. write a PCR to read amount from a certain wage type (Ex: wage
type 1000) in input table and divide it with the number of any other
wage type (Ex: wage type 1001) and then store it in the first wage
type (Ex: wage type 1000).
3. write a PCR to restrict the above example for a certain personnel
area and employee subgroup (Ex: for wage type 1000)
4. Compare the amount against the wage type (Ex: amt of wage type
1000) of above examples and if it is greater than 50 then only add
it to the output table.
Transactions
PrepareMe
TellMe
2
3
ShowMe
LetMe
5
India SAP CoE, Slide 95
HelpMe
HelpMe
Tips and Tricks
1.While writing custom operations or functions it is
recommended to copy the source code to Z Program
and then use. and also before releasing these
changes it is strictly recommended to do the version
comparison of an object.
2. Be careful while releasing transports related to
schema changes as they are date dependant.
Dependency must be checked with respect to dates of
a particular schema before release.
3. It is always recommended to do a thorough impact
analysis before touching any payroll schema or PCR.
4. Be careful with the usage of PRT and Pxxxx functions.
wrong syntax of these functions will leads to double
output in payroll.
India SAP CoE, Slide 96
Any Questions
Thank You