Skip to Content
Author's profile photo Former Member

Step-by-step guide to create payroll custom function

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


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sven Ringling
      Sven Ringling

      Hi Tatavarthi,

      you do nicely cover the basic steps for creating a custom payroll function.

      However, I think we should mention that this process is only recommended, if you have only one payroll country in your system or you are 100% sure the function is to be used by several countries AND doesn't create any problems for others.

      The reason is:

      RPCBURZ0 would be an include to all active payroll drivers. If you use a table or other object only visible from one of them, all others would thrwo a syntax error, because they don't know the object. Even declaring that object in your form routine wouldn't work, as it would then throw a sysntax error in the country you are aiming at due to double declaration.

      The include to use would therefore be PCBURZxx0. "xx" being the country acronym (ISO code such as GB for Great Britain or DE for Germany) or, if you work with RPCALCX0 as payroll driver, 99.


      You want to develop a function, which needs to read UK rax rates in table T5G01.

      If you use this table in your coding in RPCBURZ0 without declaring it, it works fine, when running RPCALCG0 (UK), but others, e.g. RPCALCD0 (Germany) throw a syntax error.

      If you do declare it as "tables: T5G01.", The German payroll will be fine, but you' have a syntax error for UK due to double declaration.

      Therefore, the form routines need to go into PCBURZGB0, which is used in RPCALCG0 only.

      This has another advantage:

      implementation / support teams from different yountries don't get into each others' ways, if two of them work on custom functions or operations at the same time. This extra structure is, why I'd always use the country-specific includes whenever possible. It's just cleaner.

      hope I could makle this point clear and it helps readers to get the most out of your post.

      happy hacking 🙂


      RPCBURZ0 would

      Author's profile photo Former Member
      Former Member

      Hi Sven,

      To continue your concern , if we are going to add up any infotypes for INPUT Parameter section(ie Infotype Tab of Characteristics screen) , Will it cause a error for other countries as the INCLUDE is same for all PY Drivers.

      Hi Divya,

      Appreciate you effort for your SAP evangelism.

      Can you highlight how to add Input , Output , Processing parameters



      Author's profile photo Former Member
      Former Member

      Hi Divya,

      I find this article really helpful, thanks for it!

      I would however also like to know a bit more about how to parametrize the function, and what else I need to do to make it work within the payroll schema.

      We have created a new custom function based on the standard DPKW, I copied all the parameter settings, copied the code and modified it to read our data from infotypes 0008 and 0032.

      The problem is, that the consultant cannot see any data in the payroll schema when run.

      I guess, we should add some lines, or just modify the existing ones for our schema in T52C5 table.

      Any comments on this?



      Author's profile photo Klaus Reimann
      Klaus Reimann

      Hi Divya,

      First: Thank you very much for your instructions!

      But what about DEVC assignments?

      The RPCBURZ0 is in PCAL. If i create the custom includes in DEVC ZHR_PY for instance, the PE04-function will not link to the source code of the form in the custom include.

      But i can't move the custom includes to DEVC PCAL.

      So i'm locked in.

      Any idea?

      Best regards