Skip to Content
Author's profile photo Trong Minh (Woody) Nguyen

Payroll processing – Calculate average 6 month Basic Salary

I. Requirement

     There is a quite complicated requirement: calculate average 6 month Basic Salary for employee. For example: in Jun, average basic salary will be computed from Jan, Feb, Mar, Apr, May and Jun. but in Jul: start month from Feb until Jul. The most difficult here: how can system can store value from period to period, move corresponding to current period and no issue when having any retroactive accounting.

II. Solution   

     In order to resolve the request, you have to be clear how payroll processing with some table: IT, OT, etc and Functions and Operations as well. It’s quite take time to explain very detail about it. So please investigate SAP documents for some Functions: PIT, operations ADDWT, AMT, etc in T-code PDSY. It’s not too much difficult but a lot efforts to control it. I assume that you understand the prerequisites above.

     My solution as below:

     1. Create 6 wage type ( index from 00, 01, 02, 03, 04, 05) to store basic salary.

     2. Keep in mind these logic

          – wt 00 only contains current basic salary

          – wt 01 only contains Last value of wt 00 (if it’s NULL, ONLY in golive period or 1st period running payroll, using current basic salary or Avg 6mon Basic Golive inputted manually)

          – the same logic will be applied for others from wt 03, wt 04 and wt 05.

     3. After having value in these wage types, you just simply total and divide 6. It’s very easy so I don’t care about it. I will focus only the step 2.

1. Configuration Wage type: Create 6 wage types (sharing same configurations in V_512W_D) and please note processing class 6:



2. PCR

     There are some PCR will re-produce solution steps mentioned in step 2:



     There are total 5 PCR (from ZV20 to ZV24). Basic Salary is wt 1000 and Avg 6mon Basic Golive is wt 5901.

     In the first PCR, there are some steps I would like to explain in order to be easier to understand

          – Output wt 1000 from internal table IT to output table OT to process. Insert current AMT into wt 00 (wt 8000). (100% fits with 1st step above Keep in mind these logic)

          – Get last value of wt 00 (wt 8000), if it’s > 0, assign to wt 01 (wt 8001).

               Otherwise (Only in golive period or 1st period running payroll), check Avg 6mon Basic Golive.

               If Avg 6mon Basic Golive = 0, get Basic Salary and assign to wt 01 (wt 8001). Else wt 01 (wt 8001) equals Avg 6mon Basic Golive.

3. Schema

     Should include your PCR before processing class 10 in sub-schema XAL9 Factoring and storage. With my case I insert it into sub-schema XAP9 Import additional payments/deductions. I captured payroll schema when running display mode, as it’s very important way to deeply and fast control and understand Payroll Schema


III. Testing

     Look at employee who has a complicated basic salary.


     And Avg 6mon Basic Golive (if you don’t input the wt, system will get from current basic salary in 1st period running payroll )

Golive average.png

     Now running Payroll in 1st period – Jan and Jun.

     In JANUARY: (6 wt (00 -> 05) contain correctly values: wt 00 (wt 8000) – current basic 300, other Avg 6mon Basic Golive 150.


     In JUNE: (6 wt (00 -> 05) are exactly: wt 00 (wt 8000) – current basic Jun 400, wt 01 (wt 8001) – basic in May: 400, wt 02 (wt 8002) – basic in Apr: 350, wt 03 (wt 8003) – basic in Mar: 400, wt 04 and wt 05 (wt 8004 & wt 8005) both base in Jan and Feb – 300).


Assigned Tags

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

      Hi Woody,

      Good work.

      If I am working for India can i copy those  wagetype from MB10 whiach is model wage type for basic pay?

      Thnx in advance

      Author's profile photo Former Member
      Former Member

      Hi Woody,

      Could you please tell me the requiremnt clearly why we need to calculate average 6 m onths basic salary?

      Author's profile photo Trong Minh (Woody) Nguyen
      Trong Minh (Woody) Nguyen
      Blog Post Author

      I have implemented 1 project with special requirement as below (basing on Labor law 🙂 ), when employee retires, employee will get 1 month salary for 1 working year. Salary is the average salary under the labor contract of the preceding 06 months before the employee is dismissed. And whenever employee raises Leave Request (sick or maternity leave), employee's allowances are base on Average 6 month Basic Salary. Actually there are a lot of requirements involving average Salary, so I would like to share solution with you guys 🙂



      Author's profile photo Swapnil Takte
      Swapnil Takte


      Very good example, bcoz in India many company's are following same rule for leave encasement .



      Author's profile photo Trong Minh (Woody) Nguyen
      Trong Minh (Woody) Nguyen
      Blog Post Author

      Thanks Swapnil 🙂 Actually it's quite difficult, it took a long time for me to find the solution, so I would like to contribute to our SCN, hope it's helpful 🙂



      Author's profile photo Giriesh Chakaravarthy Mamurugan
      Giriesh Chakaravarthy Mamurugan

      Hi Woody,

      Nice Document. I have tried to do the same but got struck at a point. I tried to read the LRT of 1001 WT. I am getting the WT 8000 value for current value of WT 1001 but the 8001 for the past LRT i.e,. WT 8001,02,03,04,05 it is not showing the Past LRT results. I have checked your document as well and my WT PC - 6 is in 1. Any further changes to be done ? If I am using AMT=O 1001 it gets the value from VORT table but AMT=L 1001 doesn't.

      With Regards,

      Giriesh M

      Author's profile photo Trong Minh (Woody) Nguyen
      Trong Minh (Woody) Nguyen
      Blog Post Author

      Hi Giriesh M,

      I believed you have had your own solution already as I've seen your blog. Congratulations!

      Regarding your query, LRT is standard table provided by SAP, can you double check again whether your PCR is putting correctly in schema? You may put in a wrong part.

      In standard X000, SAP use sub-schema XLR0 to import last payroll result by checking PC06

      PORT  X006 P06  NOAB  

      Transfer relevant data to LRT

      Hope you can handle it soon.

      Best Regards,