How to use PYXX_READ_PAYROLL_RESULT to read payroll result in ABAP

You need to create ABAP HR Program Payroll Report and of course you need to get payroll result data, Payroll result is cluster table. In ABAP Program you can get payroll result using two methods. First you can use Payroll Event and the second is you can use PYXX_READ_PAYROLL_RESULT function module. In this post, we will explain how to read payroll result using PYXX_READ_PAYROLL_RESULT function module.

ABAP Source code

DATA: it_rgdir TYPE TABLE OF pc261,
g_seqnr TYPE pc261-seqnr,
st_payresult TYPE payid_result,
wa_rt  TYPE pc207.

CALL FUNCTION ‘CU_READ_RGDIR’
EXPORTING
persnr = pernr-pernr
TABLES
in_rgdir = it_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.

CALL FUNCTION ‘CD_READ_LAST’
EXPORTING
begin_date = pn-begps
end_date = pn-endps
IMPORTING
out_seqnr = g_seqnr
TABLES
rgdir = it_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION ‘PYXX_READ_PAYROLL_RESULT’
EXPORTING
employeenumber = pernr-pernr
sequencenumber = g_seqnr
CHANGING
payroll_result = st_payresult
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_import = 2
import_mismatch_error = 3
subpool_dir_full = 4
no_read_authority = 5
no_record_found = 6
versions_do_not_match = 7
error_reading_archive = 8
error_reading_relid = 9
OTHERS = 10.

gt_rt[] = st_payresult-inter-rt[].

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.