PCC: How to implement a check
In payroll control center There is a very important component is check .
Payroll is so complex and there are a lot of master data and payroll result need check.
PCC provide a framework to formulate the whole process .
- find the error
- resolve the error
- validate the correction .
check can help to find the error and validate the correction .
World is so diversify and human being ‘s brain is so big to find so many rules to calculate the salary .
It is impossible to find the standard way to validate the master data and payroll result .
So SAP give you the stage to show your power , you can implement the check rule by yourself , and PCC can take care of other “none important” part .
Let’s see what does the check do and how to implement it .
I want to find the pernrs who ‘s salary is increased 100% compare to last month .
check come:
1. check execute the rules
2. check write the exception pernrs into some place
3. you can find these error pernr in payroll **** pit web page .
Who can invoke the check ?
It’s up to you !
It can be run by a given job , or it can assign to a step (PCC’s payroll step).
How to implement it
It is very easy :
First I assume you know what is DATA SOURCE TYPE ( It need a long article to describe it ).< If you do not know , you can just following the sample >
Check is a kind of data source type .
1. you can create a class extends the class : CL_PYD_CHECK_BASE
2. implement the IF_PYD_TY_RT~EXECUTE of your class
A sample with no meaning :
.
METHOD if_pyd_ty_rt~execute.
DATA:
lv_abkrs TYPE abkrs,
ls_par TYPE if_pyd_fnd_types=>ty_s_resp,
lt_pernr TYPE STANDARD TABLE OF pernr_d WITH NON-UNIQUE KEY table_line,
lv_pernr TYPE pernr_d,
ls_result TYPE ty_s_result.
READ TABLE it_par INTO ls_par INDEX 1.
IF sy–subrc <> 0.
RAISE EXCEPTION TYPE cx_pyd_fnd.
ENDIF.
lv_abkrs = ls_par–low.
SELECT it1~pernr INTO TABLE lt_pernr
FROM t52mcw AS mcw
INNER JOIN pa0001 AS it1 ON mcw~pernr = it1~pernr
INNER JOIN t549a ON t549a~abkrs = it1~abkrs
INNER JOIN t549q ON t549a~permo = t549q~permo
INNER JOIN t569v ON t569v~abkrs = it1~abkrs
WHERE it1~abkrs = lv_abkrs
AND mcw~koabr = ‘X’
AND it1~begda <= t549q~endda
AND it1~endda >= t549q~begda
AND t549q~pabrp = t569v~pabrp
AND t549q~pabrj = t569v~pabrj
AND t569v~vwsaz = ’01’.
ls_result–par_type = ‘PERNR’.
LOOP AT lt_pernr INTO lv_pernr.
ls_result–id = lv_pernr.
INSERT ls_result INTO TABLE rt_result.
ENDLOOP.
ENDMETHOD.