This document contains step by step procedure to create custom payroll function.
What is a Custom function?
Payroll function and Schema plays very important roles in SAP HCM payroll run. Functions are used to calculate different amounts on the basis of master data and time data, wage type values etc. SAP provides many standard functions to calculate the amount for payroll run. We can also create custom functions with custom calculations as per business requirements and tweak into payroll schema.
How to create one?
Before we create a function, we must create, check, and save the source text for the new function in an include. For Payroll Accounting functions and operations, you use the include RPCBURZ0; for Time Management functions and operations, you use the include RPTMOZ00.
Go to se38 and enter RPCBURZ0 and click on change, for the first time in every project it would ask for Access Key, once we generate one key for change access we don’t need to do it every time we create a function/operation. It is a one time activity
Create a custom include which will have source text for all your custom functions/operations created in your project.
In custom include ZHPY_RPCBURZ0 create your own custom include for your custom function for example ZTEST
In custom include created above subroutine of your custom function ZTEST which has the source text is placed with form name as FUZTEST.
Now go to PE04 transaction code to create/display custom functions and operations
Type ZTEST in name field and select payroll and function as object class and type and click on Create
Enter the description text relevant to the functionality, form routine is defined by standard as FUZTEST (which we have created above in the include) we can also self define our own form name.
Check the checkbox of the countries depending on this the form or the source text will be called in respective country’s payroll schema
Define the parameters in the parameters section by which data will flow into the subroutine
In order to go to the source code we have to click on the below highlighted button which will take you to the subroutine of the custom function which we have created in RPCBURZ0
Select the payroll program of the country which we have chosen in the country assignment section
We can write our ABAP code as per our business requirement as per the below Screen shot.
Once the code is written, we have to activate the source code and also save and activate the function in PE04
Finally we can call the above custom Function in our custom schema where ever necessary as below