2013 Oct 04 11:41 AM
Hi,
Can anyone please let me know which tables and fields are used in arrears calculation for an employee for a particular month.
Thanks.
Hi,
Can anyone please let me know which tables and fields are used in arrears calculation for an employee for a particular month.
Thanks.
2013 Oct 04 1:29 PM
Hi Riya,
Please check tables DDNTK and ARRRS.
Thanks,
Ajay Bose
2013 Oct 07 9:06 AM
2013 Oct 07 9:15 AM
Hi Riya,
I hope these are cluster tables like PCR. You mite have to search for function modules that read the cluster data similar to payroll results. Check the below threads.
http://scn.sap.com/thread/1437352
http://scn.sap.com/thread/3325324
Thanks,
Ajay Bose
2013 Oct 07 9:32 AM
Hi Riya,
You can use FM PYXX_READ_PAYROLL_RESULT to read the cluster.
Thanks,
Ajay Bose
2013 Oct 07 9:19 AM
Hi,
Try using tables T512W, T512T and T51P6. Also try for the tables T558B, T558C and T5U8C.
Regards,
Sandeep.
2013 Oct 07 9:24 AM
Dear Riya Ghumare,
If you can see the arrears in the PC_PAYRESULT tcode than you can use the fm of result table and can access those values using the function modules given below.
call function 'CU_READ_RGDIR'
exporting
persnr = pERNR-pernr
importing
molga = lv_molga
tables
in_rgdir = gs_rgdir.
select single relid from t500l
into lv_relid
where molga = lv_molga.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = lv_relid
employeenumber = PERNR-pernr
sequencenumber = gs_rgdir-seqnr
read_only_international = 'X'
changing
payroll_result = 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.
loop at result-inter-rt into wa_rt.
endloop.
2013 Oct 07 9:30 AM
Hi Riya,
I had recently done the same thing.
Follow these steps.
data : gt_rgdir type table of pc261,
gt_payresult type table of pay99_result,
gw_payresult like line of gt_payresult,
gw_arrears type pc22z,
gv_arrears type pad_amt7s,
* Reading payroll information from the cluster directory
call function 'CU_READ_RGDIR'
exporting
persnr = p_pernr
tables
in_rgdir = gt_rgdir.
*Eliminate all records except for the one in the current period.
* This you will need to do based on your payroll date and period.
* Give the conditions based on your requirements and makes you have the valid payroll result available. Check transaction PC_PAYRESULT to see the payroll results for an employee, this will give you an idea of the conditons that you need to give.
* Eliminate payroll records with begin date other than the off-cycle date
delete gt_rgdir where fpbeg ne p_begda.
delete gt_rgdir where fpend ne p_enddah.
* Eliminate all on-demand payroll records other than the current result
delete gt_rgdir where srtza ne 'A'.
* Reading the country grouping and cluster id of the employee
call function 'PYXX_GET_RELID_FROM_PERNR'
exporting
employee = p_pernr
importing
relid = gv_relid
molga = gv_molga.
clear : gv_arrears, gw_arrears.
* From each payroll result valid for the given period, sum up the arrears from the arrears table within the pay results table.
loop at gt_rgdir into gw_rgdir.
* Reading the payroll information of the employee
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = gv_relid
employeenumber = p_pernr
sequencenumber = gw_rgdir-seqnr
* read_only_international = 'X'
changing
payroll_result = gw_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.
if sy-subrc eq 0.
loop at gw_payresult-inter-arrrs into gw_arrears.
gv_arrears = gw_arrears-betrg + gv_arrears.
endloop.
endif.
endloop.
Do ask me in case of any doubts.
Regards,
Susmitha
2013 Oct 08 10:31 AM
Never use the FM PYXX_READ_PAYROLL_RESULT inside a loop statement. To get a proper SEQNR Value.. Use the FM CD_READ_LAST
Thanx!
SuDEESH
2013 Oct 08 10:58 AM
Hi Sudeesh,
Thank for the info. The looping is done to accommodate the case when there are more than one payroll result for the employee in the inputted payroll period. So for better accurate results, looping through the payroll results table.
But I am curious to know why you said NEVER do it. Because most of the programs where I have come across the FM, I see it being used inside the loop, even in standard SAP programs and function modules.
2013 Oct 09 9:54 AM
Hi,
Even I have seen the same, But in those program FM CD_READ_LAST might not be used or they might have a requirement to fetch the data for more than one period. Actually this FM helps you to provide the last record's seqnr value.
Using this SEQNR we can fetch the exact record using the FM PYXX_READ_PAYROLL_RESULT .
CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR' " Get Relid & Molga...
EXPORTING
employee = pernr-pernr
IMPORTING
relid = lv_relid
molga = lv_molga
EXCEPTIONS
error_reading_infotype_0001 = 1
error_reading_molga = 2
error_reading_relid = 3
OTHERS = 4.
IF sy-subrc <> 0.
REJECT.
ENDIF.
CALL FUNCTION 'CU_READ_RGDIR' " RGDIR Values...
EXPORTING
persnr = pernr-pernr
IMPORTING
molga = lv_molga
TABLES
in_rgdir = lt_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
REJECT.
ENDIF.
CALL FUNCTION 'CD_READ_LAST' " Get Seq no...
EXPORTING
begin_date = pn-begda
end_date = pn-endda
IMPORTING
out_seqnr = lv_seqnr
TABLES
rgdir = lt_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
REJECT.
ENDIF.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT' " Payresult details...
EXPORTING
clusterid = lv_relid
employeenumber = pernr-pernr
sequencenumber = lv_seqnr
read_only_international = space
CHANGING
payroll_result = lt_result.
IF sy-subrc <> 0.
REJECT.
ENDIF.
SORT lt_result-inter-rt[] BY lgart ASCENDING.
*---* Get gross details...
UNASSIGN <lfs_rt>.
READ TABLE lt_result-inter-rt ASSIGNING <lfs_rt> WITH KEY lgart = lc_101 BINARY SEARCH.
IF <lfs_rt> IS ASSIGNED.
MOVE <lfs_rt>-betrg TO <fs_final>-gross.
<fs_final>-rate = ( <fs_final>-gross / 30 ). " Rate...
<fs_final>-amount = ( <fs_final>-rate * <fs_final>-numbr ). " Amount...
ENDIF.
UNASSIGN : <fs_final>, <lfs_rt>.
Thanx!
SuDEESH
2013 Oct 07 1:35 PM
HI Riya Ghumare,
I think Susmitha Susan Thomas has given you the complete solution how to access the cluster values. so please follow that I have showed you the function module so follow that.
Regards,