Reading Payroll Results using PNPCE
Hi All,
As far as reading infotypes/master data is concerned, I am comfortable using "PNPCE" instead of logical database "PNP".
Can any one tell me how can I read payroll results using "PNPCE". Since Get payroll event is not available in pnpce.
Hi khalid,
1. U want the remuneration (monthly salary )
2. U won't get it DIRECTLY from any table.
(Its stored in cluster format)
3. Use this logic and FM.
DATA: myseqnr LIKE hrpy_rgdir-seqnr.
DATA : mypy TYPE payin_result.
DATA : myrt LIKE TABLE OF pc207 WITH HEADER LINE.
SELECT SINGLE seqnr FROM hrpy_rgdir
INTO myseqnr
WHERE pernr = mypernr
AND fpper = '200409'
AND srtza = 'A'.
IF sy-subrc = 0.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = 'IN'
employeenumber = mypernr
sequencenumber = myseqnr
CHANGING
payroll_result = mypy
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.
myrt[] = mypy-inter-rt.
READ TABLE myrt WITH KEY lgart = '1899'.
4. the internal table myrt
will contain what u require.
regards,
amit m.
Similar Messages
-
Looping payroll results using pnpce ldb
hii experts,
Can anybody tell me how can v loop payroll results using pnpce ldb..plz provide me the syntax...or any reference report
program.Hi First Using Get peras event read the RGDIR results as below
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p_pernr
IMPORTING
molga = p_molga
TABLES
in_rgdir = p_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
Get the Cluster ID based on the molga value of the employee using T5001 table
Then Based on the RGDIR results loop retrive the payroll results below
LOOP AT gt_rgdir INTO wa_rgdir WHERE fpbeg LE wa_dates-endda AND fpend GE wa_dates-endda
AND srtza EQ c_a
AND payty EQ c_space.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = wa_t500l-relid
employeenumber = pernr-pernr
sequencenumber = wa_rgdir-seqnr
read_only_international = 'X'
CHANGING
payroll_result = gt_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. -
Read Payroll Result table.
Hi,
Could you please explain to me the procedure or the different steps needed to read the payroll result table for a particular country?To be more specific for my present req. the country is Canada.I'm new to the payroll module and hence do not know how the payroll procedure is executed.
A code example will be greatly appreciated.
Any help will be of good to me.
Thanks,
Sandeep.
Edited by: Sandeep Ram on Mar 24, 2008 1:41 PMinclude rpc2cd09. "Cluster CD Data-Definition
include rpc2ca00. "Cluster CA Data-Definition
include RPC2RKK0. "Cluster RK Data-Definition
include rpc2rx09. "Cluster internat. part
include rpppxd00. "Data befinition buffer PCL1/PCL2
include rpppxd10. "Common part buffer PCL1/PCL2
include rpppxm00. "Buffer handling routine
data : it_rgdir like pc261 occurs 0 with header line.
data : it_rt like PC207 occurs 0 with header line.
First get the payroll results using the FM : CU_READ_RGDIR
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p_pernr <-- pass pernr here ...
TABLES
in_rgdir = it_rgdir.
IF sy-subrc = 0.
SORT it_rgdir BY seqnr.
ENDIF.
LOOP AT it_rgdir WHERE srtza = 'A'
AND void IS INITIAL
AND reversal IS INITIAL
AND fpper = v_fpper. <-- Pass the period for
which U want to get the payroll results
v_seqnr = it_rgdir-seqnr.
ENDLOOP.
rx-key-pernr = p_pernr.
rx-key-seqno = v_seqnr.
rp-imp-c2-rk. <-- relid for canada is 'RK'
it_rt[] = rt[]. ---> results table ...
Now loop at rt .. and get the amounts for wage types ...
just an example ...
loop at it_rt.
if it_rt-lgart = '/101'.
v_betrg = it_rt-betrg.
endif.
endloop. -
Function module for reading payroll results
HI,
I need a function module for reading payroll results RT table.
Import parameters are personal number, payroll area, and payroll period.
Export should be RT table.
Regards,
Wasim AhmedHai Wasim
Check the following Code
data: payroll_cluster like t500l-relid.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = payroll_cluster
employeenumber = pernr-pernr
sequencenumber = payroll-evp-seqnr
READ_ONLY_BUFFER = ' '
READ_ONLY_INTERNATIONAL = ' '
CHECK_READ_AUTHORITY = 'X'
IMPORTING
VERSION_NUMBER_PAYVN =
VERSION_NUMBER_PCL2 =
changing
payroll_result = payroll_us
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
others = 8
if sy-subrc <> 0.
if sy-subrc <> 0.
write: / 'Fehler beim Laden des US Abrechnungsergebnisses'(003).
write: /'zu Personalnummer'(008), pernr-pernr,
'bei Sequence-Number'(012),
payroll-evp-seqnr.
write: / 'Fehlercode ='(004), sy-subrc.
endif.
endif.
Thanks & regards
Sreenivasulu P -
Short dump while reading Payroll results
we have a Z program to read the payroll results for a quarter(3 months)for a large number of employees.
As the internal allocated memory is 2G. This is exceeding that limit resulting in a short dump.
There are no big internal tables in the program except reading some 8 infotypes using rp-provide and get pernr one at a time.
But, in the FM CU_READ_RGDIR the pcl2 cluster records are being stored in an internal table IMPORT_DATA[] and not refreshed, which I think is the cause for the large memory usage. Any suggestions or directions are welcome.
Any suggestions
Thanks,
KumarSantosh,
Thanks for your inputs,
But my internal table type is of DEC (5,2) , I am getting that... it needs to be of type 'C'. Can you suggest.
Ex :
MOVE wa_temp-infile_string+106(8) TO wa_item-QT_PERCENT
This didnt work
so i tried moving into a seperate variable
MOVE wa_temp-infile_string+106(8) TO v_percent.
and then write to
WRITE v_percent to wa_item-QT_PERCENT. -
ABAP HR - How to insert payroll results using fm PYXX_WRITE_PAYROLL_RESULT
Hi,
I have a scenario where I want to read cluster information (PCL2 RX) from system A and insert it into system B. Both systems are SAP ECC 6.0. Employee master data already exists on target system, but no payroll results yet, so this is an insert and not an update.
I am using fm PYXX_READ_PAYROLL_RESULT (I also tried with HRCM_PAYROLL_RESULTS_GET) to read the data and then calling a RFC on system B where I use fm PYXX_WRITE_PAYROLL_RESULT to write the payroll results into database. Is this fm only to use in case of update, or it should also work when inserting new lines on the cluster? Because I always get a sy-subrc=0 but nothing is created on the db. Is there any other way to this? Do you have any code samples?
Many thanks,
MiguelHI Miguel:
I have succe add of new payroll records, the following reference code:
*& Report ZTEST_BJARNE8
REPORT ztest_bjarne8.
TABLES:pcl1,pcl2.
INCLUDE rpc2cd00. "Cluster CD data definition
INCLUDE rpc2ca00. "Cluster CA Data-Definition
INCLUDE pc2rxcn0. "Cluster CN data definition
INCLUDE rpc2rx00. "Cluster RX data definition internat. part
DATA: refvar_curr TYPE REF TO data.
DATA: refvar_prev TYPE REF TO data.
DATA: refvar_cumul TYPE REF TO data.
DATA: t52relid_header TYPE t52relid.
FIELD-SYMBOLS: <payresult_current>.
DATA: employee_number LIKE pc200-pernr,
client LIKE sy-mandt,
globalmolga TYPE T500L-MOLGA,
cluster_id LIKE t500l-relid,
isocode LIKE t500l-intca.
DATA: rgdir_entry LIKE pc261.
CALL FUNCTION 'HR_PCLX_INIT_BUFFER'.
employee_number = '81000463'.
CLEAR:rgdir.REFRESH rgdir[].
CALL FUNCTION 'CU_READ_RGDIR_NEW'
EXPORTING
persnr = employee_number
check_read_authority = space
imp_client = client
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
import_mismatch_error = 2
no_read_authority = 3
OTHERS = 4.
LOOP AT rgdir.
ENDLOOP.
cluster_id = 'CN'.
SELECT SINGLE * FROM t52relid INTO t52relid_header
WHERE relid = cluster_id.
CREATE DATA refvar_curr TYPE (t52relid_header-typename).
ASSIGN refvar_curr->* TO <payresult_current>.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = cluster_id
employeenumber = employee_number
sequencenumber = rgdir-seqnr
check_read_authority = space"false "already done
filter_cumulations = space
CHANGING
payroll_result = <payresult_current>
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
OTHERS = 8.
IF NOT <payresult_current> IS INITIAL.
"TODO changed RT data......
"Add new month payresult
rgdir-seqnr = rgdir-seqnr + 1.
CALL FUNCTION 'PYXX_WRITE_PAYROLL_RESULT'
EXPORTING
clusterid = cluster_id
employeenumber = employee_number
sequencenumber = rgdir-seqnr
payroll_result = <payresult_current>
CLIENT =
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_export = 2
export_error = 3
subpool_dir_full = 4
no_update_authority = 5
incomplete_result_imported = 6
OTHERS = 7
IF sy-subrc <> 0.
ENDIF.
APPEND rgdir.
globalmolga = '28'.
client = '200'.
CALL FUNCTION 'CU_WRITE_RGDIR_NEW'
EXPORTING
persnr = employee_number
molga = globalmolga
imp_client = client
TABLES
rgdir = rgdir
EXCEPTIONS
no_update_authority = 1
OTHERS = 2.
CALL FUNCTION 'HR_FLUSH_BUFFER_UPDATE_PCLX'
EXPORTING
test = space
EXCEPTIONS
insert_error = 1
no_update_authority = 2
OTHERS = 3.
IF sy-subrc <> 0.
"MESSAGE e062.
ENDIF.
ENDIF.
"INCLUDE rpc2cd09.
*& INCLUDE
INCLUDE rpppxd00. "Data definition buffer PCL1/PCL2
INCLUDE rpppxd10. "Common part buffer PCL1/PCL2
INCLUDE rpppxm00. "Buffer handling routine -
How to find payroll results using includes
hi all,
I have a requirement to get the payroll results of number of data clusters using includes not by using function modules.
I know by using function modules.
How to find out the exact include for given data cluster. If there is any path please let me know.
thanks & regards,
sekhar.Hi,
You can define macros in the program and call depending on the cluster you need.
For Eg for B2 cluster,
rp-imp-c2-b2.
before calling macros,
You should fill the key
move pernr to b2-key-pernr.
move year to b2-key-pabrj.
move period to b2-key-pabrp.
move '1' to b2-key-cltyp.
rp-imp-c2-b2.
For payroll
RP-IMP-C2-RU
Regards,
Manoj. -
RFC for reading payroll results into Accounting
hi folks,
I have the HR payroll results forwarded to accounting. I need to display these results in the accounting system. Is there a RFC enabled function module to do that?
your help is really appreciated.
thanks
VinuHi
Well theres a Fm "RFC_READ_TABLE" , if you have authorization of target system you can read PCL1,2 Tables.
Here`s the FM "BAPI_GET_PAYROLL_RESULT_LIST"
Hope thisll help you
Thanks
Message was edited by: Suleman Javed -
Which Syntax is best to read an infotype using PNPCE LDB ?
Hi experts,
Which syntax is best to read an infotype when we use PNPCE LDB.
Thanks.
reddyHi Iredy,
if you need to read an infotype records of the particular employee, you can use Macro RP-READ-INFOTYPE (Parameters: PERNR, INFTY, BEGDA, ENDDA)
Macro definition you can find in table TRMAC.
For RP-READ-INFOTYPE is definition as follows:
RP-READ-INFOTYPE 001 ****************************************
RP-READ-INFOTYPE 002 * RP-READ-INFOTYPE *
RP-READ-INFOTYPE 003 ****************************************
RP-READ-INFOTYPE 004 * PARAMETERS: *
RP-READ-INFOTYPE 005 * PERNR REQUESTED PERSONALNUMBER*
RP-READ-INFOTYPE 006 * INFTY REQUESTED INFOTYPNUMBER *
RP-READ-INFOTYPE 007 * INFTY-TABLE OUTPUT-TABLE LIKE PNNNN*
RP-READ-INFOTYPE 008 * BEGDA REQUESTED INTERVAL-BEGIN*
RP-READ-INFOTYPE 009 * ENDDA REQUESTED INTERVAL-END *
RP-READ-INFOTYPE 010 ****************************************
RP-READ-INFOTYPE 011 *SET DEBUGGING INTERRUPT ON *
RP-READ-INFOTYPE 012 PERFORM READ-INFOTYPE(SAPDBPNP) *
RP-READ-INFOTYPE 013 TABLES &3 *
RP-READ-INFOTYPE 014 USING &1 '&2' &4 &5
RP-READ-INFOTYPE 015 *SET DEBUGGING INTERRUPT OFF *
It means that the macro is performing read-infotype which is defined in include DBPNPF03 of the SAPDBPNP. -
Reading payroll results for an employee from ABAP-HR?
Hi,
I dont know whether i must post this question in this category ? but i had a problem in reading of the payroll data for employees.
I used the function of PYXX_READ_PAYROLL_RESULT and passed the PERNR(employee number), SEQNR, RELID(clusterid) for a given period of say PN-BEGDA AND PN-ENDDA. And i took the payroll structure of germany (its PAYDE_RESULT). program is showing the exceptions since between the selected periods i had many different country employees other than germany DE. how can i solve that problem ? if i use PAY99_RESULT then i cant read the National wage types? how to solve this problem?
which function i must use so that i must get all the payroll data of the employees between the given period with inter/national payroll details and also which structure(like PAYDE_RESULT) i must use for holding the payroll data that is unique?
please help me.
***Ratings are must for a possible answer.Hi KK,
In this sample code...you will find the use of the method i meantioned.
REPORT zgratuity_ipcl MESSAGE-ID zh.
TABLES : pernr , pa0001, pa0008 , pa0000 , t569v.
TYPE-POOLS: slis.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
INFOTYPES: 0008 ,0001,0002,0000.
DATA : period(6),
pay_period(6),
c_period(6).
DATA: number LIKE pc261-seqnr.
DATA : refdt LIKE p0000-begda.
DATA: ason_yr LIKE p0347-scryy,
ason_mon LIKE p0347-scrmm.
DATA : BEGIN OF it_0000 OCCURS 100,
pernr LIKE pa0000-pernr,
stat2 LIKE pa0000-stat2,
massn LIKE pa0000-massn,
begda LIKE pa0000-begda,
endda LIKE pa0000-endda,
END OF it_0000.
DATA : g_molga LIKE t512t-molga.
DATA: BEGIN OF package,
lga LIKE p0008-lga01,
bet LIKE p0008-bet01,
END OF package.
DATA : BEGIN OF rgdir OCCURS 0.
INCLUDE STRUCTURE pc261.
DATA : END OF rgdir.
DATA : BEGIN OF rx-key OCCURS 0.
INCLUDE STRUCTURE pc200.
DATA : END OF rx-key.
DATA : BEGIN OF crt OCCURS 0. "result table
INCLUDE STRUCTURE pc208.
DATA : END OF crt.
DATA : b_date LIKE sy-datum,
e_date LIKE sy-datum.
DATA : darate LIKE t539j-gwcht.
DATA : gamt TYPE p.
DATA : BEGIN OF it_0001 OCCURS 100,
pernr LIKE pa0000-pernr,
ename LIKE pa0001-ename,
bukrs LIKE pa0001-bukrs,
persk LIKE pa0001-persk,
persg LIKE pa0001-persg,
werks LIKE pa0001-werks,
END OF it_0001.
**start of mod by tejas on 31.05.06
DATA : BEGIN OF it_final_sup OCCURS 100,
pernr LIKE pa0001-pernr, "PL No
ename LIKE pa0001-ename, "NAME
persg LIKE pa0001-persg, "EMP GROUP
persk LIKE pa0001-persk, "ESG
zzpla LIKE pa0001-zzpla, "PLANT/BUSINESS
orgeh LIKE pa0001-orgeh, "ORG UNIT
orgtx LIKE t527x-orgtx, "ORG UNIT TEXT
gbdat LIKE pa0002-gbdat, "DOB
termn LIKE pa0019-termn, "DOJ
zzrtdt LIKE pa0002-zzrtdt,"DOR
sepdt LIKE pa0000-begda,
no_years TYPE i, "SERVICE YEARS
stat2 LIKE pa0000-stat2, "STATUS
s_text(15), "STATUS TEXT
basic LIKE pa0008-bet01, "BASIC
da LIKE pa0008-bet01, "DA
total LIKE pa0008-bet01, "TOTAL
crt LIKE pc207-betrg, "GRTUITY
massn LIKE pa0000-massn,
begda LIKE pa0000-begda,
ason(6) ,
dates LIKE pa0002-zzrtdt,
END OF it_final_sup.
DATA : BEGIN OF it_final_nonsup OCCURS 100,
pernr LIKE pa0001-pernr, "PL No
ename LIKE pa0001-ename, "NAME
persg LIKE pa0001-persg, "EMP GROUP
persk LIKE pa0001-persk, "ESG
zzpla LIKE pa0001-zzpla, "PLANT/BUSINESS
orgeh LIKE pa0001-orgeh, "ORG UNIT
orgtx LIKE t527x-orgtx, "ORG UNIT TEXT
gbdat LIKE pa0002-gbdat, "DOB
termn LIKE pa0019-termn, "DOJ
zzrtdt LIKE pa0002-zzrtdt,"DOR
sepdt LIKE pa0000-begda,
no_years TYPE i, "SERVICE YEARS
stat2 LIKE pa0000-stat2, "STATUS
s_text(15), "STATUS TEXT
basic LIKE pa0008-bet01, "BASIC
da LIKE pa0008-bet01, "DA
total LIKE pa0008-bet01, "TOTAL
crt LIKE pc207-betrg, "GRTUITY
massn LIKE pa0000-massn,
begda LIKE pa0000-begda,
ason(6) ,
dates LIKE pa0002-zzrtdt,
END OF it_final_nonsup.
DATA : BEGIN OF it_final OCCURS 100,
pernr LIKE pa0001-pernr, "PL No
ename LIKE pa0001-ename, "NAME
persg LIKE pa0001-persg, "EMP GROUP
persk LIKE pa0001-persk, "ESG
zzpla LIKE pa0001-zzpla, "PLANT/BUSINESS
orgeh LIKE pa0001-orgeh, "ORG UNIT
orgtx LIKE t527x-orgtx, "ORG UNIT TEXT
gbdat LIKE pa0002-gbdat, "DOB
termn LIKE pa0019-termn, "DOJ
zzrtdt LIKE pa0002-zzrtdt,"DOR
sepdt LIKE pa0000-begda,
no_years TYPE i, "SERVICE YEARS
stat2 LIKE pa0000-stat2, "STATUS
s_text(15), "STATUS TEXT
basic LIKE pa0008-bet01, "BASIC
da LIKE pa0008-bet01, "DA
total LIKE pa0008-bet01, "TOTAL
crt LIKE pc207-betrg, "GRTUITY
massn LIKE pa0000-massn,
begda LIKE pa0000-begda,
ason(6) ,
dates LIKE pa0002-zzrtdt,
END OF it_final.
**end of mod by tejas on 31.05.06
DATA : f_pabrj LIKE t549s-pabrj,
f_pabrp LIKE t549s-pabrp.
DECLARATIONS FOR ALV DISPLAY
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_layout TYPE slis_layout_alv ,
gs_print TYPE slis_print_alv,
gt_filter TYPE slis_t_filter_alv,
gt_sp_group TYPE slis_t_sp_group_alv,
gt_alv_graphics TYPE dtc_t_tc,
gt_excluding TYPE slis_t_extab ,
gt_events TYPE slis_t_event,
gt_print TYPE slis_print_alv.
DATA: gt_list_top_of_page TYPE slis_t_listheader.
DATA: g_boxnam TYPE slis_fieldname VALUE 'BOX',
p_f2code LIKE sy-ucomm VALUE '&ETA',
p_lignam TYPE slis_fieldname VALUE 'LIGHTS',
g_save(1) TYPE c VALUE 'X',
g_default(1) TYPE c VALUE 'X',
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant,
g_repid LIKE sy-repid.
DATA : result TYPE pay99_result.
DATA : crt_header TYPE LINE OF hrpay99_crt.
INITIALIZATION.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
SELECT-OPTIONS : sstat2 FOR pa0000-stat2.
SELECTION-SCREEN: END OF BLOCK b2.
*SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*SELECTION-SCREEN : SKIP.
*PARAMETERS : P_STAT2 LIKE PA0000-STAT2.
*SELECTION-SCREEN : SKIP.
*SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'PNPABKRS-LOW'.
screen-required = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN." on pnppabrj.
IF pnptimr9 = 'X'.
CONCATENATE pnpdispj pnpdispp INTO period.
CONCATENATE pnpdispp pnpdispj INTO pay_period.
ELSE.
CONCATENATE pnppabrj pnppabrp INTO period.
CONCATENATE pnppabrp pnppabrj INTO pay_period.
ENDIF.
IF period < '200505'.
MESSAGE e001 WITH
'Gratuity report is for period after month Auguest 2005' .
STOP.
ENDIF.
SELECT SINGLE * FROM t569v
WHERE abkrs = pnpxabkr.
CONCATENATE t569v-pabrj t569v-pabrp INTO c_period.
IF period > c_period.
MESSAGE e001 WITH 'Payroll for this period is not yet processed' .
STOP.
ENDIF.
CONCATENATE pnppabrj pnppabrp INTO period.
CONCATENATE pnppabrp pnppabrj INTO pay_period.
IF period =< '200505'.
MESSAGE e001 WITH 'Program is not valid for this period' pnppabrj
*pnppabrp.
ENDIF.
START-OF-SELECTION.
GET pernr.
PERFORM fill_data.
END-OF-SELECTION.
PERFORM final_data.
PERFORM display_data.
*& Form FILL_DATA
text
--> p1 text
<-- p2 text
FORM fill_data.
SORT p0000 BY pernr.
SORT p0001 BY pernr.
SORT p0002 BY pernr.
SORT p0008 BY pernr.
start mod made by kinjal for payroll dates
IF pnptimr9 = 'X'.
CALL FUNCTION 'HR_GB_PERIOD_DATES'
EXPORTING
abkrs = pnpxabkr
PERMO =
pabrj = pnpdispj
pabrp = pnpdispp
IMPORTING
begda = b_date
endda = e_date .
EXCEPTIONS
PERIOD_NOT_FOUND = 1
OTHERS = 2
ELSE.
CALL FUNCTION 'HR_GB_PERIOD_DATES'
EXPORTING
abkrs = pnpxabkr
PERMO =
pabrj = pnppabrj
pabrp = pnppabrp
IMPORTING
begda = b_date
endda = e_date
EXCEPTIONS
PERIOD_NOT_FOUND = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CONCATENATE pnppabrj pnppabrp '01' INTO b_date.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = b_date
IMPORTING
EV_MONTH_BEGIN_DATE =
ev_month_end_date = e_date.
end of modification
*DATA FETCHING FOR SUPERVISOR EMPLOYEES
LOOP AT p0001 WHERE begda <= e_date AND
endda >= e_date AND
persg = 'R' OR
persg = 'P'
AND
( persk >= '11' AND
persk <= '17'
OR
( persk >= 'IA' AND
persk <= 'IJ'
MOVE-CORRESPONDING p0001 TO it_final_sup.
READ TABLE p0002 WITH KEY pernr = p0001-pernr BINARY SEARCH.
IF sy-subrc = 0.
MOVE-CORRESPONDING p0002 TO it_final_sup.
ENDIF.
LOOP AT p0000 WHERE pernr = p0001-pernr AND begda <= e_date AND endda
>= e_date AND stat2 IN sstat2.
SELECT SINGLE orgtx INTO it_final_sup-orgtx FROM t527x
WHERE sprsl = 'EN'
AND orgeh = p0001-orgeh.
SELECT SINGLE text1 INTO it_final_sup-s_text FROM t529u
WHERE sprsl = 'EN'
AND statn = '2'
AND statv = p0000-stat2.
MOVE-CORRESPONDING p0000 TO it_final_sup.
IF p0000-massn = 'A6'.
MOVE p0000-begda TO it_final_sup-zzrtdt.
ELSE.
it_final_sup-zzrtdt = ' '.
ENDIF.
ENDLOOP.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
SELECT SINGLE termn INTO it_final_sup-termn FROM pa0019
WHERE pernr = p0001-pernr
AND tmart = '06'.
IF sy-subrc = 0.
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = sy-datum
date2 = it_final_sup-termn
output_format = '05'
IMPORTING
years = ason_yr
months = ason_mon
DAYS =
EXCEPTIONS
invalid_dates_specified = 1
OTHERS = 2
IF ason_mon > 6.
ason_yr = ason_yr + 1.
ENDIF.
MOVE ason_yr TO it_final_sup-no_years.
ENDIF.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT p0008 WHERE begda <= e_date AND endda >= e_date AND pernr =
p0001-pernr.
DO 20 TIMES VARYING package-lga FROM p0008-lga01 NEXT p0008-lga02
VARYING package-bet FROM p0008-bet01 NEXT p0008-bet02.
CASE package-lga.
WHEN '0010'.
it_final_sup-basic = package-bet + it_final_sup-basic.
WHEN '0I10'.
it_final_sup-da = package-bet + it_final_sup-da.
ENDCASE.
ENDDO.
it_final_sup-total = it_final_sup-basic + it_final_sup-da.
ENDLOOP.
BREAK-POINT.
start mod made by kinjal
it_final_sup-zzrtdt = it_final_sup-zzrtdt - 1.
CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'
EXPORTING
get_begda = it_final_sup-zzrtdt
GET_ENDDA =
get_permo = '67'
IMPORTING
get_pabrj = f_pabrj
get_pabrp = f_pabrp
TABLES
GET_PERIODS =
EXCEPTIONS
no_period_found = 1
no_valid_permo = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF it_final_sup-stat2 <> '3'.
CONCATENATE it_final-dates+4(2) INTO period.
CONCATENATE f_pabrj f_pabrp INTO period.
it_final_sup-ason = period.
ENDIF.
end of mod
rx-key-pernr = p0001-pernr.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p0001-pernr
IMPORTING
molga = g_molga
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
LOOP AT rgdir WHERE fpper = period AND inper = period.
ENDLOOP.
With this Seq. number as a key for cluster Key
we can read the RT table from the cluster/..
IF 2
IF sy-subrc EQ 0.
rx-key-seqno = rgdir-seqnr.
IMPORT crt FROM DATABASE pcl2(in) ID rx-key.
IF NOT crt[] IS INITIAL.
PERFORM resultstab.
ENDIF.
APPEND it_final_sup.
CLEAR it_final_sup.
ENDIF.
LOOP AT rgdir WHERE
inper = period AND
srtza = 'A'.
rx-key-seqno = rgdir-seqnr.
number = rgdir-seqnr.
CLEAR rt.
REFRESH rt.
Importing Result table cluster
IMPORT rt FROM DATABASE pcl2(in) ID rx-key.
IF NOT rt[] IS INITIAL.
PERFORM resultstab.
ENDIF.
ENDLOOP.
APPEND it_final.
CLEAR IT_FINAL.
ENDLOOP.
RP-PROVIDE-FROM-LAST P0008 SPACE B_DATE E_DATE.
BREAK-POINT.
DO 10 TIMES varying PACKAGE-LGA from p0008-lga01 next p0008-lga02
varying package-bet from p0008-bet01 next p0008-bet02.
compute itab-gross = itab-gross + package-bet.
IF sy-index = 10.
itab-pernr = p0008-pernr.
append itab.
endif.
enddo.
*DATA FETCHING FOR NON SUPERVISOR EMPLOYEES
LOOP AT p0001 WHERE begda <= e_date AND
endda >= e_date AND
persg = 'R' OR
persg = 'P'
AND
persk >= 'IL' AND
persk <= 'IV'
MOVE-CORRESPONDING p0001 TO it_final_nonsup.
READ TABLE p0002 WITH KEY pernr = p0001-pernr BINARY SEARCH.
IF sy-subrc = 0.
MOVE-CORRESPONDING p0002 TO it_final_nonsup.
ENDIF.
LOOP AT p0000 WHERE pernr = p0001-pernr AND begda <= e_date AND endda
>= e_date AND stat2 IN sstat2.
SELECT SINGLE orgtx INTO it_final_nonsup-orgtx FROM t527x
WHERE sprsl = 'EN'
AND orgeh = p0001-orgeh.
SELECT SINGLE text1 INTO it_final_nonsup-s_text FROM t529u
WHERE sprsl = 'EN'
AND statn = '2'
AND statv = p0000-stat2.
MOVE-CORRESPONDING p0000 TO it_final_nonsup.
IF p0000-massn = 'A6'.
MOVE p0000-begda TO it_final_nonsup-sepdt.
MOVE p0000-begda TO refdt.
ELSE.
MOVE it_final_nonsup-zzrtdt TO refdt.
MOVE e_date TO refdt.
ENDIF.
ENDLOOP.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
SELECT SINGLE termn INTO it_final_nonsup-termn FROM pa0019
WHERE pernr = p0001-pernr
AND tmart = '06'.
IF sy-subrc = 0.
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = refdt
date2 = it_final_nonsup-termn
output_format = '05'
IMPORTING
years = ason_yr
months = ason_mon
DAYS =
EXCEPTIONS
invalid_dates_specified = 1
OTHERS = 2
IF ason_mon > 6.
ason_yr = ason_yr + 1.
ENDIF.
MOVE ason_yr TO it_final_nonsup-no_years.
ENDIF.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT p0008 WHERE begda <= refdt AND endda >= refdt AND
LOOP AT p0008 WHERE begda <= e_date AND endda >= e_date AND
pernr = p0001-pernr.
DO 20 TIMES VARYING package-lga FROM p0008-lga01 NEXT p0008-lga02
VARYING package-bet FROM p0008-bet01 NEXT p0008-bet02.
CASE package-lga.
WHEN '0010'.
it_final_nonsup-basic = package-bet.
ENDCASE.
ENDDO.
ENDLOOP.
IF it_final_nonsup-massn = 'A6'.
SELECT SINGLE gwcht FROM t539j
INTO darate
WHERE molga = '40'
AND bwlga = '0I10'
AND begda <= it_final_nonsup-begda
AND endda >= it_final_nonsup-begda.
ELSE.
SELECT SINGLE gwcht FROM t539j
INTO darate
WHERE molga = '40'
AND bwlga = '0I10'
AND begda <= e_date
AND endda >= e_date.
ENDIF.
it_final_nonsup-da = ( it_final_nonsup-basic * darate ) / 100.
it_final_nonsup-total = it_final_nonsup-basic + it_final_nonsup-da.
gamt = 0.
gamt = ( it_final_nonsup-total * 15 * it_final_nonsup-no_years )
/ 26.
IF gamt >= 350000.
gamt = 350000.
ENDIF.
MOVE gamt TO it_final_nonsup-crt.
CLEAR gamt.
CLEAR refdt.
APPEND it_final_nonsup.
CLEAR it_final_nonsup.
LOOP AT rgdir WHERE
inper = period AND
srtza = 'A'.
rx-key-seqno = rgdir-seqnr.
number = rgdir-seqnr.
CLEAR rt.
REFRESH rt.
Importing Result table cluster
IMPORT rt FROM DATABASE pcl2(in) ID rx-key.
IF NOT rt[] IS INITIAL.
PERFORM resultstab.
ENDIF.
ENDLOOP.
APPEND it_final.
CLEAR IT_FINAL.
ENDLOOP.
ENDFORM. " FILL_DATA
" GET_GRATUITY
*& Form RESULTSTAB
text
--> p1 text
<-- p2 text
FORM resultstab.
LOOP AT crt WHERE lgart = '9GRA' AND cumty = 'U'.
it_final_sup-crt = abs( crt-betrg ).
ENDLOOP.
ENDFORM. " RESULTSTAB
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM display_data.
IF it_final[] IS INITIAL.
MESSAGE i001 WITH 'No data found'.
STOP.
ENDIF.
g_repid = sy-repid.
PERFORM e01_fieldcat_init USING gt_fieldcat[].
PERFORM eventtab_build CHANGING gt_events.
PERFORM e04_comment_build USING gt_list_top_of_page[].
PERFORM display_report.
ENDFORM. " DISPLAY_DATA
*& Form E01_FIELDCAT_INIT
text
-->P_GT_FIELDCAT[] text
FORM e01_fieldcat_init USING e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
gs_layout-group_change_edit = 'X'.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Pers No'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ENAME'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Name'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PERSK'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'ESG Cd'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ZZPLA'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Plant/Business'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ORGTX'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Org.Unit'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'GBDAT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Dt.Of Birth'.
ls_fieldcat-datatype = 'DATS'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'TERMN'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Dt.Of Joining'.
ls_fieldcat-datatype = 'DATS'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'ZZRTDT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Superannuation Dt'.
ls_fieldcat-datatype = 'DATS'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'SEPDT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Dt.Of Seperation'.
ls_fieldcat-datatype = 'DATS'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'NO_YEARS'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Service Years'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'S_TEXT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Status'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BASIC'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Basic'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DA'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'DA'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'TOTAL'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Total'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'CRT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-seltext_l = 'Gratuity'.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO e01_lt_fieldcat.
ENDFORM. " E01_FIELDCAT_INIT
*& Form EVENTTAB_BUILD
text
<--P_GT_EVENTS text
FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
ENDFORM. " EVENTTAB_BUILD
*& Form E04_COMMENT_BUILD
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader
DATA: ls_line TYPE slis_listheader.
DATA : v_text(100) TYPE c,
v_text1(100) TYPE c,
date1(10),
date2(10).
v_pernrlines TYPE i,
v_pernrchar(5).
DESCRIBE TABLE it_pernr LINES v_pernrlines.
MOVE v_pernrlines TO v_pernrchar.
CONCATENATE b_date6(2) '.' b_date4(2) '.' b_date+0(4) INTO date1.
CONCATENATE e_date6(2) '.' e_date4(2) '.' e_date+0(4) INTO date2.
CONCATENATE 'Gratuity Information for ' date1 'to' date2
INTO v_text SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = v_text.
APPEND ls_line TO e04_lt_top_of_page.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = v_text1.
APPEND ls_line TO e04_lt_top_of_page.
ENDFORM. " E04_COMMENT_BUILD
*& Form DISPLAY_REPORT
text
--> p1 text
<-- p2 text
FORM display_report.
gs_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'IT_FINAL'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
it_filter = gt_filter[]
i_save = g_save
is_variant = g_variant
it_events = gt_events
is_print = gs_print
it_alv_graphics = gt_alv_graphics[]
it_excluding = gt_excluding
TABLES
t_outtab = it_final.
ENDFORM. " DISPLAY_REPORT
FORM top_of_page *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM . "TOP_OF_PAGE
FORM user_command USING g_ucomm TYPE sy-ucomm
g_field TYPE slis_selfield.
CASE g_ucomm.
WHEN '&IC1'.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form FINAL_DATA
text
--> p1 text
<-- p2 text
FORM final_data.
LOOP AT it_final_sup.
MOVE-CORRESPONDING it_final_sup TO it_final.
APPEND it_final.
CLEAR it_final.
ENDLOOP.
LOOP AT it_final_nonsup.
MOVE-CORRESPONDING it_final_nonsup TO it_final.
APPEND it_final.
CLEAR it_final.
ENDLOOP.
SORT it_final BY pernr.
ENDFORM. " FINAL_DATA
<b>Reward if useful,</b>
Regards,
Tejas -
I'm triyng to use the above class to read Payroll results.
I'm using the code as advised, on note 699276.
However, i'm getting an "Read Error", when executing method GET_PERNR_PAYR_RESULTS_ALLIN1.
After some debugging, i discovered that in method Read_from_buffer (class Cl_hr_pay_buffer), the system does a direct reading to table PCL2, in search for the cluster entry key. The thing is, that instead of looking for CLUSTERID 'RP' (as it's stated on table T500L, for our MOLGA), the system look for CLUSTERID 'RX', because that value is hard-code on the CONSTRUCTOR method of class CL_HR_PAY_RESULT_99.
As anyone been thru this kind of problem? Is this some kind of class or method bug?
Thanks in advance for your cooperation.
Sincerely,
Hugo Ferreira
PS - Here's the code of the program, so far:
data: go_prr type ref to cl_hrpay99_prr_4_pnp_reps,
gt_pernr_pr type H99_HR_PAY_RESULT_TAB,
go_pernr_pr type ref to CL_HR_PAY_RESULT_PT.
field-symbols <pernr_pr> type ref to CL_HR_PAY_RESULT.
start-of-selection.
call method CL_HRPAY99_PRR_4_PNP_REPS=>GET_INSTANCE
EXPORTING
IM_PN_BEGDA = pn-begda
IM_PN_ENDDA = pn-endda
IM_MOLGA = '19'
IM_ADD_RETROES_TO_RGDIR = 'X'
IMPORTING
ex_prr = go_prr
EXCEPTIONS
INVALID_ENTRIES = 1.
get pernr.
call method go_prr->GET_PERNR_PAYR_RESULTS_ALLIN1
EXPORTING
im_pernr = pernr-pernr
IMPORTING
EX_PERNR_PAYROLL_RESULTS = gt_pernr_pr
EXCEPTIONS
COUNTRY_VERSION_NOT_AVAILABLE = 1
NO_AUTHORIZATION = 2
NO_ENTRIES_FOUND = 3
READ_ERROr = 4.
loop at gt_pernr_pr assigning <pernr_pr>.
go_pernr_pr ?= <pernr_pr>.
endloop.Hi,
I have to do the same thing. May I know your approach?
This is what I thought..
I can create a custom method in the copied class and change the clusted id and molga and replace the CONSTUCTOR method call in our custom payroll driver program.
But I cannot see this method anywhere in our payroll driver program when I hit the Where Used List.
I am not sure how to proceed.
Please suggest. -
Finding the latest payroll results and its CRT table.
Hi all,
My requirment is to fetch the value from the CRT table of the latest payroll result,
so that at any point of time it fetches the cumulative value till date from the CRT table.Hi
use the fun module
PYXX_READ_PAYROLL_RESULT
for fetching the payroll results
or see the sample code how to fetch the payroll results using the RT table.
report zovertime
line-size 252
line-count 60(1)
no standard page heading
message-id zndc.
Database Tables & Infotypes
tables: pcl1, " HR Cluster1
pcl2, " HR Cluster1
pa0003, " Master data - Payroll Status
cskt, " Cost Center Texts
t528t, " Positions Texts
t513s, " Job Titles
pernr, " Logical PNP
t001p, " Personnel Subarea
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
csks. " Cost Center
infotypes:0000,0001.
*include rpclst00.
include rpc2rx00.
include rpc2rxx0.
include rpc2cd00.
*include rpc2ps00.
*include rpc2pt00.
*include rpcfvp00.
*include rpcfdc10.
*include rpcfdc00.
include rpppxd00.
include rpppxd10.
Declaration of Internal Tables
Internal Table for Output Data
data: begin of rep_tab occurs 0,
kostl like pa0001-kostl, " Cost Center
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
ctext like cskt-ltext, " Cost Center Text
ptext like t528t-plstx, " Position Text
ot1 type p decimals 2, " Jan OT Amount
ot2 type p decimals 2, " Feb OT Amount
ot3 type p decimals 2, " Mar OT Amount
ot4 type p decimals 2, " Apr OT Amount
ot5 type p decimals 2, " May OT Amount
ot6 type p decimals 2, " Jun OT Amount
ot7 type p decimals 2, " Jul OT Amount
ot8 type p decimals 2, " Aug OT Amount
ot9 type p decimals 2, " Sep OT Amount
ot10 type p decimals 2, " Oct OT Amount
ot11 type p decimals 2, " Nov OT Amount
ot12 type p decimals 2, " Dec OT Amount
ott type p decimals 2, " Total OT Amount
end of rep_tab.
Declaration of Variables
data: v_mon(2) type n, " Month
v_no type i, " Data Lines
v_year(4) type c, " Year
v_date like sy-datum, " Date
v_date1 like sy-datum, " Date
v_seqnr like pc261-seqnr. " Sequence No.
Declaration of Constants
data: c_type like hrp1001-otype value 'S', " Object Type
c_kokrs like cskt-kokrs value '1000', " Controlling Area
c_date1 like sy-datum value '18000101', " Date
c_date2 like sy-datum value '99991231', " Date
c_x type c value 'X', " Sign
c_mon(2) type c value '01', " Month
c_val1(2) type c value '31', " Date
c_val2(2) type c value '12', " Month Type
c_val like p0041-dar01 value '01', " Date Type
c_lgart1 like p0008-lga01 value '0722', " Wage Type
c_lgart2 like p0008-lga01 value '0723', " Wage Type
c_1(2) type n value '01', " Month1
c_2(2) type n value '02', " Month2
c_3(2) type n value '03', " Month3
c_4(2) type n value '04', " Month4
c_5(2) type n value '05', " Month5
c_6(2) type n value '06', " Month6
c_7(2) type n value '07', " Month7
c_8(2) type n value '08', " Month8
c_9(2) type n value '09', " Month9
c_10(2) type n value '10', " Month10
c_11(2) type n value '11', " Month11
c_12(2) type n value '12'. " Month12
Selection-screen
parameters:
p_year like pc2b0-pabrj obligatory. " Payroll Year
At selection-screen
at selection-screen.
Validate the Selection Screen fields
perform validate_screen.
Start-of-Selection
start-of-selection.
Selection of Period
perform get_period.
Get PERNR from LDB
get pernr.
Get the Master data from infotype 0001
perform get_master_data.
Top-of-page
top-of-page.
Write the Report and Column Headings
perform top_of_page.
End-of-Page
end-of-page.
write /1(252) sy-uline.
End-of-Selection
end-of-selection.
Display the Output Report.
perform display_report.
Form-Routines
*& Form validate_screen
Validation of selection Screen fields
form validate_screen.
Validation of Cost Center
clear csks.
if not pnpkostl[] is initial.
select single kostl
into csks-kostl
from csks
where kostl in pnpkostl.
if sy-subrc <> 0.
message e999 with 'Invalid Cost Center'(003).
endif.
endif.
Validation of Personnel Number
clear pa0003.
if not pnppernr[] is initial.
select pernr
from pa0003 up to 1 rows
into pa0003-pernr
where pernr in pnppernr.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personal Number Entered'(002).
endif.
endif.
Validation of Personnel Area
clear t500p.
if not pnpwerks[] is initial.
select persa
from t500p up to 1 rows
into t500p-persa
where persa in pnpwerks.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Area Entered'(001).
endif.
endif.
Validation of Personnel Sub Area
clear t001p.
if not pnpbtrtl[] is initial.
select btrtl
from t001p up to 1 rows
into t001p-btrtl
where btrtl in pnpbtrtl.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Sub Area Entered'(037).
endif.
endif.
Validation of Employee Group
clear t501.
if not pnppersg[] is initial.
select persg
from t501 up to 1 rows
into t501-persg
where persg in pnppersg.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Group Entered'(038).
endif.
endif.
Validation of Employee Sub Group
clear t503k.
if not pnppersk[] is initial.
select persk
from t503k up to 1 rows
into t503k-persk
where persk in pnppersk.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Sub Group Entered'(039).
endif.
endif.
endform. "validate_screen
*& Form get_period
Get the Correct Period based on Selection screen selection
form get_period.
clear: v_year,v_mon, v_date, v_date1.
v_year = sy-datum+0(4).
v_mon = sy-datum+4(2).
if pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
elseif pnptimr2 = c_x. " Current Month
concatenate v_year v_mon c_val into v_date.
concatenate v_year v_mon c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr3 = c_x. " Current Year
concatenate v_year c_val c_val into v_date.
concatenate v_year c_val2 c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1.
pnpendda = sy-datum.
elseif pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = c_date1.
pnpendda = c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
pnpbegda = c_date1.
pnpendda = pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
endif.
endif.
endform. "get_period
*& Form get_master_data
Get the Master Data from Database Tables PA0001,0002,0003
form get_master_data.
Get data from Respective Infotypes
rp_provide_from_last p0001 space pnpbegda pnpendda.
if p0001-kostl in pnpkostl.
rep_tab-kostl = p0001-kostl.
rep_tab-pernr = p0001-pernr.
rep_tab-ename = p0001-ename.
Get the Position Text
clear t528t-plstx.
select single plstx into t528t-plstx from t528t
where plans = p0001-plans and
otype = c_type and
sprsl = sy-langu.
if sy-subrc = 0.
rep_tab-ptext = t528t-plstx.
endif.
Get the Cost Center Text
clear cskt-ltext.
select single ltext into cskt-ltext from cskt
where spras = sy-langu and
kokrs = c_kokrs and
kostl = p0001-kostl.
if sy-subrc = 0.
rep_tab-ctext = cskt-ltext.
endif.
Get the Overtime Payment Data
perform get_ot_data.
rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
append rep_tab.
clear rep_tab.
endif.
sort rep_tab by kostl pernr.
delete rep_tab where kostl = ' '.
delete rep_tab where ott = 0.
endform. "get_master_data
*& Form get_ot_data
Get the Overtime Payment Data
form get_ot_data.
cd-key = pernr-pernr.
rp-imp-c2-cd.
sort rgdir by seqnr.
To get sequence number for the payroll period
loop at rgdir where void is initial
and reversal is initial
and outofseq is initial
and srtza eq 'A'.
if rgdir-fpper+0(4) = p_year.
To consider offcycle run data
if not rgdir-ocrsn is initial.
v_seqnr = rgdir-seqnr.
exit.
endif.
v_seqnr = rgdir-seqnr.
endif.
if not v_seqnr is initial.
perform import_rx.
endif.
perform process_wagetypes.
endloop.
endform. "get_ot_data
include rpppxm00.
*& Form Import_rx
Import the RX data from Clusters
form import_rx.
rx-key-pernr = cd-key-pernr.
rx-key-seqno = v_seqnr.
rp-init-buffer.
rp-imp-c2-rx.
endform. " Import_rx
*& Form Process_wagetypes
Calculate the Overtime Amount based on Wage types
form process_wagetypes.
loop at rt.
if rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
if rgdir-fpper+0(4) = p_year.
v_mon = rgdir-fpper+4(2).
case v_mon .
when c_1.
rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
when c_2.
rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
when c_3.
rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
when c_4.
rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
when c_5.
rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
when c_6.
rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
when c_7.
rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
when c_8.
rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
when c_9.
rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
when c_10.
rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
when c_11.
rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
when c_12.
rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
endcase.
endif.
endif.
endloop.
endform. "process_wagetypes
*& Form top_of_page
Write the Report and Column Headings
form top_of_page.
format color col_heading on.
write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
/1(252) 'Overtime Payments Details'(011) centered.
format color off.
if pnptimr1 = c_x. " Current Date
write: /2 'Period From :'(036), sy-datum, 'To:'(006), sy-datum.
elseif pnptimr2 = c_x. " Current Month
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr3 = c_x. " Current Year
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr4 = c_x. " Upto Today
write: /2 'Period From :'(036), c_date1, 'To:'(006), sy-datum.
elseif pnptimr5 = c_x. " From Today
write: /2 'Period From :'(036), sy-datum, 'To:'(006), c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), c_date1, 'To:'(006), c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
write: /2 'Period From :'(036), c_date1, 'To:'(006), pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), pnpbegda,
'To:'(006), pnpendda.
endif.
endif.
write: 219 'Report Run Date:'(018), sy-datum.
if not pnpkostl[] is initial.
if pnpkostl-high is initial.
write: /2 'Cost Center :'(004), pnpkostl-low,
219 'Time :'(020), sy-uzeit.
else.
write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
'To:'(006), pnpkostl-high,
219 'Time :'(020), sy-uzeit.
endif.
else.
write: /219 'Time :'(020), sy-uzeit.
endif.
if not pnppernr[] is initial.
if pnppernr-high is initial.
write: /2 'Personal Number :'(007), pnppernr-low,
219 'User :'(021), sy-uname.
else.
write: /2 'Personal No.From:'(008), pnppernr-low,
'To:'(006), pnppernr-high,
219 'User :'(021), sy-uname.
endif.
else.
write: /219 'User :'(021), sy-uname.
endif.
write: /219 'Page No :'(022), sy-pagno.
format color col_heading.
write /1(252) sy-uline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
235 sy-vline,252 sy-vline.
format color col_heading.
write:/1 sy-vline, 2(8) 'Emp #'(019) centered,
10 sy-vline, 11(30) 'Employee Name'(012) centered,
41 sy-vline, 42(25) 'Position'(014) centered,
67 sy-vline, 68(167) sy-uline,
235 sy-vline,236(16) 'Total'(017) centered,
252 sy-vline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(13) 'JANUARY'(024) centered,
81 sy-vline, 82(13) 'FEBRUARY'(025) centered,
95 sy-vline, 96(13) 'MARCH'(026) centered,
109 sy-vline,110(13) 'APRIL'(027) centered,
123 sy-vline,124(13) 'MAY'(028) centered,
137 sy-vline,138(13) 'JUNE'(029) centered,
151 sy-vline,152(13) 'JULY'(030) centered,
165 sy-vline,166(13) 'AUGUST'(031) centered,
179 sy-vline,180(13) 'SEPTEMBER'(032) centered,
193 sy-vline,194(13) 'OCTOBER'(033) centered,
207 sy-vline,208(13) 'NOVEMBER'(034) centered,
221 sy-vline,222(13) 'DECEMBER'(035) centered,
235 sy-vline,252 sy-vline.
format color off.
write /1(252) sy-uline.
endform. "top_of_page
*& Form Display_report
Write the Report Output
form display_report.
clear v_no.
describe table rep_tab lines v_no.
if v_no = 0.
message i999 with
'No Data found for the entered Selection'(015).
endif.
loop at rep_tab.
format color 3.
at new kostl.
read table rep_tab index sy-tabix.
write:/1 sy-vline, 2(12) 'Cost Center:'(009),
14(10) rep_tab-kostl,
25(30) rep_tab-ctext,
252 sy-vline.
format color off.
write /1(252) sy-uline.
endat.
format color col_normal.
write: /1 sy-vline, 2(8) rep_tab-pernr,
10 sy-vline, 11(30) rep_tab-ename,
41 sy-vline, 42(25) rep_tab-ptext,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
at end of kostl.
write /1(252) sy-uline.
endat.
format color off.
at last.
sum.
format color 1.
write: /1 sy-vline,
10 sy-vline, 11(30) 'Total'(017) centered,
41 sy-vline,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
write /1(252) sy-uline.
endat.
format color off.
endloop.
endform. "display_report
Reward points if useful
Regards
Anji -
Experts -
I know how we can display Deleted Payroll Results using t-code SLG1 and enter Object field HRPU.
However, I would like to know in which physical table is the deleted payroll result data actually stored.
Regards,
-SonnyI don't believe it is stored anywhere. It is deleted.
-
When using PNPCE LDB, how to retrive payroll record for an employee.
Regards
ManviHi,
Please refer to the following code.
Basically the payroll data is stored in the Cluster tables PCL1 and PCL2.
If help ful please reward points.
Regards,
Irfan Hussain
*& Report ZHR_READ_CLUSTER *
REPORT ZHR_READ_CLUSTER .
TABLES : PERNR,
PCL1,
PCL2.
Infotypes : 0001,
0002.
Data : molga like t001p-molga,
num like pc261-seqnr.
STANDARD INCLUDES *
INCLUDE rpc2cd09. " Data Definition - CD Cluster INCLUDE rpc2ca00. " Data Definition Import/Export Macros for ClusterCA INCLUDE rpc2ruu0. " Data Definition for Cluster RU (USA) INCLUDE rpc2rx09. " Cluster RU Data-Definition internat. part INCLUDE rpppxd00. " Data befinition buffer PCL1/PCL2 INCLUDE rpppxd10. " Common part buffer PCL1/PCL2 INCLUDE rpppxm00. " Buffer handling routine
Start-Of-Selection.
Get Pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = pernr-pernr
IMPORTING
MOLGA = molga
tables
in_rgdir = rgdir
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
IF sy-subrc = 1.
write /: 'No Records Found'.
ENDIF.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
begin_date = pn-begda
end_date = pn-endda
IMPORTING
OUT_SEQNR = num
tables
rgdir = rgdir
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
IF sy-subrc = 1.
write :/ ' No Payroll Exist'.
ELSE.
rx-key-pernr = pernr-pernr.
rx-key-seqno = num.
rp-imp-c2-ru.
IF SY-SUBRC = 0.
PERFORM PRINT_FORM.
ELSE.
WRITE :/ 'Results Could not be read this time'.
endif.
ENDIF.
*& Form PRINT_FORM
text
--> p1 text
<-- p2 text
form PRINT_FORM .
DATA : l_betrg LIKE p0008-bet01,
l_betrg1 like p0008-bet01.
read table rgdir with key seqnr = num.
IF sy-subrc = 0.
WRITE: /1 'Empd id' COLOR 1,20 p0001-pernr COLOR 5,
/1 'Name' COLOR 1,20 p0001-ename COLOR 5,
/1 'Personnel Area' COLOR 1,20 p0001-werks COLOR 5,
/1 'Personnel Subarea' COLOR 1 ,20 p0001-btrtl COLOR 5.
SKIP 1.
WRITE: / 'For-period' COLOR 1, 30 rgdir-fpper COLOR 3,
/ 'In-period' COLOR 1, 30 rgdir-inper COLOR 3.
SKIP 1.
ENDIF.
loop at crt where lgart = '/101' or lgart = '\5UH' .
if crt-cumty = 'Q'.
l_betrg = l_betrg + crt-betrg.
endif.
endloop.
loop at crt where lgart = '/102' and cumty = 'Y'.
l_betrg1 = l_betrg1 + crt-betrg.
endloop.
l_betrg1 = l_betrg1 / 4.
l_betrg = l_betrg + l_betrg1.
write :/ l_betrg.
endform. " PRINT_FORM -
Could not read administrative data for payroll result
Hi Experts,
I am trying to extract data from ECC6.0 for datasource 0HR_PP_REC_51 and getting error:
"Personnel No. 00100062 : Could not read administrative data for payroll result HR_BIW_PP"
Can any body tell me the relevant solution for that.
Thanks in advance!
SapnaHi Sapna,
Please can you tell me how to fix this error, I have the same problem now.
Thanks in advance.
Maybe you are looking for
-
After creating a new user account, how do I move my files into the new user?
I have an issue where my 'Desktop/Screensaver' prefs seem to be corrupt somehow. When I click on that icon in System Preferences, it stalls and I get the spinning ball, thus resulting in a force quit. After reading a Mac Format magazine where someone
-
I've been trying to download some games to my son's iPod touch. I have several now in my iTunes library and have synced the iPod many times. They still do not show up on the iPod.Also, when I click on the purple iTunes app on the iPod it says that it
-
Displayport in ThinkPad Port Replicator Series 3
The displayport in my ThinkPad Port Replicator Series 3 does not work. ThinkPad T430S. The interneal mini displayport works very good... Annyone knows the problem?
-
Permanently stuck in headphone mode?
is it supposed to change back into speaker mode when i unplug the headphones? because i unplug the headphones and it still says when i adjust the volume "headphones" and it wont even play the audio when i answer calls. only through the headphones. is
-
Hi I need to create a Clob variable that will be filled with some text. After that I will use this variable in a stored procedure. I'm using the following code: Connection conn = null; Clob c = null; conn = db.getConnection(); c = conn.createClob();