Purpose
This post exposes a basic and simple procedure for debugging PY-US-TX.
Overview
Payroll function USTAX processes information from employee Masterdata and customized tables and create a structure that is sent to BSI Tax Factory to calculate the taxes. This structure is shown on payroll log as BSI Interface. This post will help to find where the amounts on this interface come from.
Debbuging approach
While debugging PY-US-TX scenario, a good approach is to start the analysis from the end and for each point on the code or relevant variant found, we take note of it and restart the process.
Our approach on this post will starts on include RPCMASUT_PRINT_TAX_TABS. On this include the BSI interface is finally populated:
For example, on the code above we can see where parameter “TE” (tax exempt) is filled. What is relevant for us now is what comes after: taxes-tax_ex_imp. This is the amount that is put just after parameter TE on BSI Interface.
After discovering what field is used for the issued parameter, we can continue the analysis trying to find now where this amount was calculated or defined. Take a look at the following example
Example
Let’s suppose that while calculating the payroll tax type 41 for CA is not being calculated:
Analysing the BSI interface, it was found that the issue comes from parameter TE that is being filled with value 2 instead of 0:
As we saw at RPCMASUT_PRINT_TAX_TABS, this value is filled by taxes-tax_ex_imp. We need now to find what process was responsible for it.
A good approach is the use of watchpoints. While running the program, watchpoints will stop the execution when the specified variant or table is modified. To stop only on the scenario that is relevant for us we can put a condition on the watchpoint to stop only when tax type 41 is being processed. To do it, just before running RPCALCU0, execute “/h” and run the program. The debugger will rise. Add the following watchpoint (it might be necessary to press F7, to place the WT on the proper place):
Then press F8. System should stop on the following program and line:
Looking at the code, we can see that field taxes-tax_ex_ind is receiving value 2 because txit-exind has value Y.
Ok, now we go again with the same process. Restart the debug and Watchpoint on our new variant:
Press F8:
System should stop on the code above. Looking at the code we can see that the exempt indicator is coming from P0235. This is a reference to IT0235.
So the reason why parameter TE had value 2 was because of an override on IT0235 for CA for TT 41.
This was an easy scenario. It usually gets harder, when there are more BSI interfaces and retrocalculation. But, very often, only a few minutes proceeding like stated above helps a lot on understand better the system. The code is also commented, so it is common to find useful information there.
Leave A Comment?
You must be logged in to post a comment.