‎2008 Jul 25 11:30 AM
Hi,
I want to read the RT table for PCL2(payroll cluster).
I want to fetch the data on the basis of the payroll area and the current year...
How to do tht? Can anyone provide me some examples...
Plz provide some inputs.
‎2008 Jul 25 11:38 AM
first of all get all the employees ubder that payroll area ..
loop at it_pernr.
call function CU_READ_RGDIR .. to get the rgdir(PC261)
get the latest SEQNR from RGDIR structure from above ..
pass this FM : PYXX_READ_PAYROLL_RESULT along with pernr and get the payroll result ..
call function 'CU_READ_RGDIR'
exporting
persnr = it_pernr-pernr
IMPORTING
" molga = molg
tables
in_rgdir = t_rgdir
.
read table t_rgdir into wa_rgdir with key srtza = 'A'
fpbeg = pn-begda fpend = pn-endda.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
employeenumber = wa_info-pernr
sequencenumber = wa_rgdir-seqnr
changing
payroll_result = t_payresult
loop at t_payresult-inter-rt into wa_rt .
case wa_rt-lgart .
when ''. <-- get the BETRG(amount) based on the LGART
endcase.
endloop.
‎2008 Jul 25 11:45 AM
Hi thanx for the soln.
I have pernrs, year and payroll area as the selection criterias on my screen.
then i did some thing like:
rp-init-buffer.
set the key to retrieve the rgdir table that contains the
payroll results directory for the employee
CLEAR cd-key.
cd-key-pernr = s_pernr-low.
rp-imp-c2-cu.
DESCRIBE TABLE rgdir LINES l_lines.
IF l_lines <> 0.
SORT rgdir DESCENDING BY seqnr.
ENDIF.
LOOP AT rgdir WHERE srtza = 'A'
AND abkrs IN s_abkrs.
EXIT.
ENDLOOP.
CHECK sy-subrc = 0.
(Read RU cluster)
rx-key-pernr = cd-key-pernr.
UNPACK rgdir-seqnr TO rx-key-seqno.
rp-init-buffer.
rp-imp-c2-ru.
but i m not able to fetch the data on the basis of the year that user enters on the screen,
plz help
‎2008 Jul 25 11:58 AM
If U want to read the data based on the year entered on
selection screen then U'll get more number of records ..
(might be 12 .. one result for one month) ..
Get payroll periods based on the year entered ..
change your coding as :
LOOP AT rgdir WHERE srtza = 'A'
AND abkrs IN s_abkrs
AND FPPER in r_FPPER. <-- U need to populate this
(Read RU cluster)
rx-key-pernr = cd-key-pernr.
UNPACK rgdir-seqnr TO rx-key-seqno.
rp-init-buffer.
rp-imp-c2-ru.
*get data from RT ... amount for required wage types ..
ENDLOOP.
USE FM : HR_PAYROLL_PERIODS_GET to get the payroll periods ...
‎2008 Jul 25 11:41 AM
hi check this..
check this example...
report zzpayroll.
tables: pa0001,
pcl1, "HR Cluster 1
pcl2. "HR Cluster 2
*--Standard Include for US Payroll
include rpc2ruu0. "Cluster RD data definition
include rpc2cd00. "Cluster CD Data-Definition
include rpc2ca00. "Cluster CA Data-Definition
include rpc2rx00. "Cluster RF data definition internat. part
include rpppxd00. "Data definition buffer PCL1/PCL2
include rpppxd10. "Common part buffer PCL1/PCL2
include rpppxm00. "Buffer handling routine
*Internal Table to Hold data from PA0001
data : begin of it_pa0001 occurs 0,
pernr like pa0001-pernr,
begda like pa0001-begda,
endda like pa0001-endda,
end of it_pa0001.
data: begin of output occurs 0,
pernr type pa0000-pernr,
abart type abrar,
zeinh type pt_zeinh,
lgart like pa0008-lga01,
betrg like pa0009-betrg, "gROSS AMMOUNT.
end of output.
data : v_seqnr like pc261-seqnr. "Sequence Number
*------select option
selection-screen begin of block b1 with frame title text-001.
select-options : s_pernr for pa0001-pernr, "Pernr
s_date for sy-datum. "Date
selection-screen end of block b1.
start-of-selection.
perform getd-data.
&----
*& Form getD-data
----
form getd-data .
select pernr
begda
endda
from pa0001
into table it_pa0001
where pernr in s_pernr.
sort it_pa0001 by pernr begda descending.
if sy-subrc = 0.
loop at it_pa0001.
data : v_molga like t500l-molga .
call function 'CU_READ_RGDIR'
exporting
persnr = it_pa0001-pernr
importing
molga = v_molga
tables
in_rgdir = rgdir.
sort rgdir by seqnr .
loop at rgdir where srtza = 'A' and
void is initial and
reversal is initial and
outofseq is initial and
paydt in s_date.
v_seqnr = rgdir-seqnr.
rp-init-buffer.
rx-key-pernr = it_pa0001-pernr.
rx-key-seqno = v_seqnr.
rp-imp-c2-ru.
loop at rt.
output-pernr = it_pa0001-pernr.
output-betrg = rt-betrg.
output-lgart = rt-lgart.
output-abart = rt-abart.
output-zeinh = rt-zeinh.
append output.
sort output by lgart betrg ascending.
delete adjacent duplicates from output comparing lgart.
clear output.
endloop.
endloop.
endloop.
endif.
loop at output.
write:/ sy-vline,
output-pernr,
sy-vline,
output-lgart,
sy-vline,
output-betrg,
sy-vline,
output-abart,
sy-vline,
output-zeinh,
sy-vline.
write:/1(50) sy-uline .
endloop.
endform. " getD-data