2007 Jun 27 4:55 AM
Hi all,
I need to fetch last payroll record of a pernr,from transaction pc_payresult.
I am using the LDB PNP.
After calling GET PERNR, I am using functions CU_READ_RGDIR and then PYXX_READ_PAYROLL_RESULT to fetch the last active payroll record.
But is there any way to <b>directly</b> fetch the last active payroll record,based on the pernr? Please suggest a way.
Thanks&Regards
Ananya
Hi all,
I need to fetch last payroll record of a pernr,from transaction pc_payresult.
I am using the LDB PNP.
After calling GET PERNR, I am using functions CU_READ_RGDIR and then PYXX_READ_PAYROLL_RESULT to fetch the last active payroll record.
But is there any way to <b>directly</b> fetch the last active payroll record,based on the pernr? Please suggest a way.
Thanks&Regards
Ananya
2007 Jun 27 5:03 AM
Hi
When you fetch the RGDIR records from the CU_READ_RGDIR, it contains SEQNR.
SEQNR number increases by 1 when a payroll is run for that pernr. So, the last SEQNR is the latest payroll record. Remember, this can be a retro payroll run for previous dates, yet it will be the latest payroll run.
You can also get it by using PAYDT, the date on which the payroll was run.
Run the program RPCLSTRU to get a clear picture. This payroll program will give all the RGDIR records for a PERNR and you can check the dates.
When you click on any of the record, the result will be shown.
Regards
Navneet.
2007 Jun 27 5:08 AM
Hi Navneet,
Actually I want to fetch the Last Payroll Record from the LDB itself and donot want to use the function CU_READ_RGDIR.
Once I get the personnel using GET PERNR,is it possible to use a macro in the LDB to fetch the last payroll for that pernr ?
Or is there some other way to fetch from LDB itself ?
Thanks & Regards
Ananya
2007 Jun 27 6:05 AM
Hi
To get the payroll results, you need to read the cluster CU to get RGDIR. For this CU_READ_RGDIR is used and almost all standard programs also use this FM.
Simple Report using LDBs to get latest payroll result.
report ythr_read_payroll .
data: t_rgdir type pc261 occurs 0,
t_result type payus_result,
w_bt type line of hrpay99_bt,
out_seqnr like pc261-seqnr.
tables: pernr.
get pernr.
call function 'CU_READ_RGDIR_NEW'
exporting
persnr = pernr-pernr
tables
in_rgdir = t_rgdir
exceptions
no_record_found = 1
import_mismatch_error = 2
no_read_authority = 3
others = 4.
if sy-subrc <> 0.
write:/1 'No payroll results for ', pernr-pernr.
endif.
call function 'CD_READ_LAST'
exporting
begin_date = pn-begda
end_date = pn-endda
importing
out_seqnr = out_seqnr
tables
rgdir = t_rgdir
exceptions
no_record_found = 1
others = 2.
if sy-subrc <> 0.
write:/1 'Error for ', pernr-pernr.
endif.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = 'RU'
employeenumber = pernr-pernr
sequencenumber = out_seqnr
changing
payroll_result = t_result
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.
if sy-subrc <> 0.
write:/1 'Error for ', pernr-pernr.
endif.
loop at t_result-inter-bt into w_bt.
write:/1 pernr-pernr, out_seqnr, w_bt-bankl, w_bt-bankn.
endloop.
Regards
Navneet
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |