06-13-2007 11:49 AM
hi
iam new to HR module please help me .Its very urgent i need to write extract program for this.
my requirement is to identify the employees ( by emp no -pernr) who meet this criteria:
all employees who have a record in CRT table (cluster pcl2) with cumulation type of 'y' in the calender year of 2007.
06-13-2007 1:01 PM
just copy and paste the below it is for Cummulative salary display of the Employees.
just place the <b>PNP</b> logical data base in the attribute of the program ..
*.......................................................................
*: Report: ZPAYROLL_RESULTS :
*: :
*: Description: Demonstrate retrieving payroll results data, please :
*: note program does not produce any meaningful output :
* is simply a demonstration of how to access the data :
*:.....................................................................:
REPORT ZPAYROLL_RESULTS.
NODES: pernr.
INFOTYPES: 0000, 0001, 2001.
TABLES: t554s, pcl1, pcl2.
INCLUDE rpclst00.
INCLUDE rpc2rx09. "Payroll results datadefns-Intl.
INCLUDE rpc2rxx0. "Payroll results datadefns-Intl.
INCLUDE rpc2rgg0. "Payroll results datadefns-GB
INCLUDE rpcfdcg0. "Payroll results datadefns-GB
INCLUDE rpcdatg0.
INCLUDE rpc2cd00. "Cluster Directory defns.
INCLUDE rpc2ps00. "Cluster: Generierte Schematas
INCLUDE rpc2pt00.
INCLUDE rpcfdc10.
INCLUDE rpcfdc00.
INCLUDE rpppxd00.
INCLUDE rpppxd10.
INCLUDE rpcfvp09.
INCLUDE rpcfvpg0.
INCLUDE rpppxm00.
TYPES: BEGIN OF t_salrate,
seqnr TYPE pc261-seqnr,
begda TYPE p2001-begda,
endda TYPE p2001-endda,
split(2) TYPE c,
val TYPE p DECIMALS 2,
END OF t_salrate.
DATA: it_salrate TYPE STANDARD TABLE OF t_salrate INITIAL SIZE 0,
wa_salrate TYPE t_salrate.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_awart FOR p2001-awart.
SELECTION-SCREEN END OF BLOCK block1.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
GET pernr.
* get payroll results data
rp-init-buffer.
CLEAR rgdir. REFRESH rgdir.
CLEAR crt. REFRESH crt.
CLEAR: rx-key.
* set key to current pernr
MOVE pernr-pernr(8) TO cd-key-pernr.
* retrieves payroll results for specific pernr(personnel number)
rp-imp-c2-cd.
IF rp-imp-cd-subrc = 0. "rgdir success
rx-key-pernr = pernr-pernr.
SORT rgdir BY seqnr ASCENDING.
CLEAR rgdir.
ENDIF.
SORT rgdir BY fpbeg fpend ASCENDING seqnr DESCENDING.
* RGDIR the table where all payroll results periods are stored
LOOP AT rgdir WHERE abkrs IN pnpabkrs "pay area
AND srtza EQ 'A'
AND void NE 'V'.
IF sy-subrc NE 0.
* set key to specific payroll results period(current RGDIR loop pass)
UNPACK rgdir-seqnr TO rx-key-seqno.
* Retrieves data for specific payroll results period (current RGDIR
* loop pass)
rp-imp-c2-rg.
* Loop at wpbp data for specific payroll results period
LOOP AT wpbp.
wa_salrate-seqnr = rgdir-seqnr.
wa_salrate-begda = wpbp-begda.
wa_salrate-endda = wpbp-endda.
wa_salrate-split = wpbp-apznr.
* loop at rt data for specific payroll results period
LOOP AT CRT WHERE lgart EQ '/010' AND "wage type
CUMTY = 'Y' .
wa_salrate-val = crt-BETRG .
APPEND wa_salrate TO it_salrate.
ENDLOOP.
ENDLOOP.
* Process BT table
LOOP AT BT.
ENDLOOP.
* Process NIPAY table
LOOP AT NIPAY.
ENDLOOP.
* etc................
ENDIF.
ENDLOOP.
reward points if it is usefull ....
Girish
06-13-2007 1:01 PM
just copy and paste the below it is for Cummulative salary display of the Employees.
just place the <b>PNP</b> logical data base in the attribute of the program ..
*.......................................................................
*: Report: ZPAYROLL_RESULTS :
*: :
*: Description: Demonstrate retrieving payroll results data, please :
*: note program does not produce any meaningful output :
* is simply a demonstration of how to access the data :
*:.....................................................................:
REPORT ZPAYROLL_RESULTS.
NODES: pernr.
INFOTYPES: 0000, 0001, 2001.
TABLES: t554s, pcl1, pcl2.
INCLUDE rpclst00.
INCLUDE rpc2rx09. "Payroll results datadefns-Intl.
INCLUDE rpc2rxx0. "Payroll results datadefns-Intl.
INCLUDE rpc2rgg0. "Payroll results datadefns-GB
INCLUDE rpcfdcg0. "Payroll results datadefns-GB
INCLUDE rpcdatg0.
INCLUDE rpc2cd00. "Cluster Directory defns.
INCLUDE rpc2ps00. "Cluster: Generierte Schematas
INCLUDE rpc2pt00.
INCLUDE rpcfdc10.
INCLUDE rpcfdc00.
INCLUDE rpppxd00.
INCLUDE rpppxd10.
INCLUDE rpcfvp09.
INCLUDE rpcfvpg0.
INCLUDE rpppxm00.
TYPES: BEGIN OF t_salrate,
seqnr TYPE pc261-seqnr,
begda TYPE p2001-begda,
endda TYPE p2001-endda,
split(2) TYPE c,
val TYPE p DECIMALS 2,
END OF t_salrate.
DATA: it_salrate TYPE STANDARD TABLE OF t_salrate INITIAL SIZE 0,
wa_salrate TYPE t_salrate.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_awart FOR p2001-awart.
SELECTION-SCREEN END OF BLOCK block1.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
GET pernr.
* get payroll results data
rp-init-buffer.
CLEAR rgdir. REFRESH rgdir.
CLEAR crt. REFRESH crt.
CLEAR: rx-key.
* set key to current pernr
MOVE pernr-pernr(8) TO cd-key-pernr.
* retrieves payroll results for specific pernr(personnel number)
rp-imp-c2-cd.
IF rp-imp-cd-subrc = 0. "rgdir success
rx-key-pernr = pernr-pernr.
SORT rgdir BY seqnr ASCENDING.
CLEAR rgdir.
ENDIF.
SORT rgdir BY fpbeg fpend ASCENDING seqnr DESCENDING.
* RGDIR the table where all payroll results periods are stored
LOOP AT rgdir WHERE abkrs IN pnpabkrs "pay area
AND srtza EQ 'A'
AND void NE 'V'.
IF sy-subrc NE 0.
* set key to specific payroll results period(current RGDIR loop pass)
UNPACK rgdir-seqnr TO rx-key-seqno.
* Retrieves data for specific payroll results period (current RGDIR
* loop pass)
rp-imp-c2-rg.
* Loop at wpbp data for specific payroll results period
LOOP AT wpbp.
wa_salrate-seqnr = rgdir-seqnr.
wa_salrate-begda = wpbp-begda.
wa_salrate-endda = wpbp-endda.
wa_salrate-split = wpbp-apznr.
* loop at rt data for specific payroll results period
LOOP AT CRT WHERE lgart EQ '/010' AND "wage type
CUMTY = 'Y' .
wa_salrate-val = crt-BETRG .
APPEND wa_salrate TO it_salrate.
ENDLOOP.
ENDLOOP.
* Process BT table
LOOP AT BT.
ENDLOOP.
* Process NIPAY table
LOOP AT NIPAY.
ENDLOOP.
* etc................
ENDIF.
ENDLOOP.
reward points if it is usefull ....
Girish
06-13-2007 6:07 PM
thanks Girish helpful answer.
can i sopy and paste that program for my requirement.
thanks& regards
hari prasad
06-13-2007 6:38 PM
Thank you very much girish
i just copy the program and tested , when i entered data in selection screen and pressing execute.it is not giving any output.
i need to extract list of employee numbers based on criteria above and download to a file on presentation server.
please give some idea
thank
06-14-2007 4:04 AM
please cut & paste the below program for the employee List ...
in the program attributes palce PNP logical database ..
you can store 3 different types of Employee data into 3 different files .
*.......................................................................
*: Report: ZDOWNEMPDATA :
*: :
*: Description: Downloads employee data to TAB delimited flat files :
*: :
*:.....................................................................:
REPORT zdownempdata .
INFOTYPES: 0000, 0001, 0007, 0008, 0121, 0615.
NODES: pernr.
TABLES: t001p.
TYPES: BEGIN OF t_employee,
* INCLUDE STRUCTURE hrms_biw_io_occupancy.
begda TYPE begda,
endda TYPE endda,
pernr TYPE pernr_d,
rfpnr TYPE rfpnr,
bukrs TYPE bukrs,
werks TYPE persa,
btrtl TYPE btrtl,
persg TYPE persg,
persk TYPE persk,
orgeh TYPE orgeh,
stell TYPE stell,
plans TYPE plans,
kokrs TYPE mast_coar,
kostl TYPE mast_cctr,
abkrs TYPE abkrs,
molga TYPE molga,
trfar TYPE trfar,
trfgb TYPE trfgb,
trfkz TYPE trfkz,
trfgr TYPE trfgr,
trfst TYPE trfst,
bsgrd TYPE bsgrd,
ansal TYPE ansal_15,
ancur TYPE ancur,
empct TYPE empct,
stat2 TYPE stat2,
ncsdate TYPE hiredate,
sltyp TYPE p_sltyp,
slreg TYPE p_slreg,
slgrp TYPE p_slgrp,
sllev TYPE p_sllvl,
ansvh TYPE ansvh,
vdsk1 TYPE vdsk1,
sname TYPE smnam,
END OF t_employee.
DATA: it_employee TYPE STANDARD TABLE OF t_employee INITIAL SIZE 0,
wa_employee TYPE t_employee.
TYPES: BEGIN OF t_emptexts,
* INCLUDE STRUCTURE hrms_bw_txt_employee.
DATEFROM TYPE RSDATEFROM,
DATETO TYPE RSDATETO,
PERNR TYPE PERSNO,
TXTMD TYPE EMNAM,
END OF t_emptexts.
DATA: it_emptexts TYPE STANDARD TABLE OF t_emptexts INITIAL SIZE 0,
wa_emptexts TYPE t_emptexts.
TYPES: BEGIN OF t_contract,
* INCLUDE STRUCTURE pa0615.
pernr TYPE p0615-pernr,
begda TYPE p0615-begda,
endda TYPE p0615-endda,
aedtm TYPE p0615-aedtm,
ctype TYPE p0615-ctype,
cbeg TYPE p0615-cbeg,
cend TYPE p0615-cend,
END OF t_contract.
DATA: it_contract TYPE STANDARD TABLE OF t_contract INITIAL SIZE 0,
wa_contract TYPE t_contract.
DATA: it_tabemp TYPE filetable,
gd_subrcemp TYPE i,
it_tabempt TYPE filetable,
gd_subrcempt TYPE i,
it_tabcont TYPE filetable,
gd_subrccont TYPE i.
DATA: gd_downfile TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS: p_emp LIKE rlgrap-filename,
p_empt LIKE rlgrap-filename,
p_cont LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK block1.
***********************************************************************
*at selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_emp.
REFRESH: it_tabemp.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
initial_directory = 'C:'
multiselection = ' ' "No multiple selection
CHANGING
file_table = it_tabemp
rc = gd_subrcemp.
LOOP AT it_tabemp INTO p_emp.
ENDLOOP.
***********************************************************************
*at selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_empt.
REFRESH: it_tabemp.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
initial_directory = 'C:'
multiselection = ' ' "No multiple selection
CHANGING
file_table = it_tabempt
rc = gd_subrcempt.
LOOP AT it_tabempt INTO p_empt.
ENDLOOP.
***********************************************************************
*at selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cont.
REFRESH: it_tabcont.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
initial_directory = 'C:'
multiselection = ' ' "No multiple selection
CHANGING
file_table = it_tabcont
rc = gd_subrccont.
LOOP AT it_tabcont INTO p_cont.
ENDLOOP.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
GET pernr.
* Selecting the latest infotype record
rp_provide_from_last p0000 space pn-begda pn-endda.
rp_provide_from_last p0001 space pn-begda pn-endda.
rp_provide_from_last p0007 space pn-begda pn-endda.
rp_provide_from_last p0008 space pn-begda pn-endda.
rp_provide_from_last p0121 space pn-begda pn-endda.
rp_provide_from_last p0615 space pn-begda pn-endda.
MOVE-CORRESPONDING p0001 TO wa_employee.
wa_employee-rfpnr = p0121-rfp01. "?????
MOVE-CORRESPONDING p0007 TO wa_employee.
MOVE-CORRESPONDING p0008 TO wa_employee.
MOVE-CORRESPONDING p0000 TO wa_employee.
SELECT SINGLE molga
FROM t001p
INTO wa_employee-molga
WHERE werks EQ p0001-werks AND
btrtl EQ p0001-btrtl.
SELECT SINGLE trfkz
FROM t503
INTO wa_employee-trfkz
WHERE persg EQ p0001-persg AND
persk EQ p0001-persk.
CALL FUNCTION 'HR_ENTRY_DATE'
EXPORTING
persnr = pernr-pernr
* RCLAS =
* BEGDA = '18000101'
* ENDDA = '99991231'
* VARKY =
IMPORTING
entrydate = wa_employee-ncsdate
* TABLES
* ENTRY_DATES =
EXCEPTIONS
ENTRY_DATE_NOT_FOUND = 1
PERNR_NOT_ASSIGNED = 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.
* append employee data
APPEND wa_employee TO it_employee.
CLEAR: wa_employee.
wa_emptexts-datefrom = p0001-begda.
wa_emptexts-dateto = p0001-endda.
wa_emptexts-pernr = p0001-pernr.
wa_emptexts-txtmd = p0001-ename.
* append employee texts data
APPEND wa_emptexts TO it_emptexts.
CLEAR: wa_emptexts.
MOVE-CORRESPONDING p0615 TO wa_contract.
* append employee contract data
APPEND wa_contract TO it_contract.
CLEAR: wa_contract.
************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.
* download employee data
IF NOT p_emp IS INITIAL.
gd_downfile = p_emp.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = gd_downfile
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_employee.
IF sy-subrc EQ 0.
WRITE:/ 'Employee file downloaded to',
gd_downfile.
ELSE.
WRITE:/ 'There was an error downloading Employee file to',
gd_downfile.
ENDIF.
ENDIF.
* download employee texts data
IF NOT p_empt IS INITIAL.
gd_downfile = p_empt.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = gd_downfile
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_emptexts.
IF sy-subrc EQ 0.
WRITE:/ 'Employee text file downloaded to',
gd_downfile.
ELSE.
WRITE:/ 'There was an error downloading Employee text file to',
gd_downfile.
ENDIF.
ENDIF.
* download contract data
IF NOT p_cont IS INITIAL.
gd_downfile = p_cont.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = gd_downfile
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_contract.
IF sy-subrc EQ 0.
WRITE:/ 'Employee contract file downloaded to',
gd_downfile.
ELSE.
WRITE:/ 'There was an error downloading Employee contract file to',
gd_downfile.
ENDIF.
ENDIF.
reward points if it is usefull ...
Girish
06-14-2007 5:47 PM
hai girish
my requirement is to identify the employees (pernr) who meets this criteria:
all empl's who have a record in crt table( cluster pcl2) wit h cumulation of type 'y' in calender year of 2007.
write list of thwese emp no 's to a file on presentation server.
i writed below code and i dont know how to retrive employee no's based on my criteria.
i tested in debugging mode that data is coming in pernr-pernr and prt1 like crt tables.
please help me girish ,its urgent i need to complete.
please make changes and send code .
TABLES:PERNR, "Standard Selections for HR Master Data Reporting
PCL1, "HR CLUSTER 1
PCL2, "HR CLUSTER 2
T549S, "PERSONNEL DATE SPECIFICATIONS PER PAYROLL PERIOD
T549A, "PAYROLL ACCOUNTING AREAS
T549Q, "PAYROLL PERIODS
PA0001. "HR MASTER RECORD INFOTYPE 0001(ORG. ASSIGNMENT)
************************************************************************
DATA
************************************************************************
INCLUDE rpc2cd09. "Cluster CD data definition
INCLUDE rpc2ca00. "Cluster CA Data-Definition
INCLUDE rpppxd00. "Data Definition buffer PCL1/PCL2 Buffer
INCLUDE rpppxd10. "Common part buffer PCL1/PCL2
INCLUDE rpppxm00. "Buffer Handling routine
*COUNTRY SPECIFIC INCLUDE
INCLUDE rpc2rkk0. "Cluster IN data definition
INCLUDE rpc2rx09.
DATA: rgdir1 LIKE rgdir OCCURS 10 WITH HEADER LINE.
DATA: rgdir2 LIKE rgdir OCCURS 10 WITH HEADER LINE.
DATA: BEGIN OF temp_rgdir1 OCCURS 10. "LIKE EVP
INCLUDE STRUCTURE pc261.
DATA: END OF temp_rgdir1.
DATA: BEGIN OF prt1 OCCURS 10. "LIKE CRT
INCLUDE STRUCTURE pc208.
DATA: END OF prt1.
DATA: BEGIN OF IT_ITAB OCCURS 0.
INCLUDE STRUCTURE pernr.
data: end OF IT_ITAB.
DATA: gd_downfile TYPE string.
************************************************************************
Selection screen Parameters
************************************************************************
PARAMETERS: P_CUMTY LIKE CRT-CUMTY,
P_CUMYR LIKE CRT-CUMYR.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS: P_EMP LIKE rlgrap-filename,
P_T588B LIKE rlgrap-filename,
P_T5K8C LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK block1.
at selection-screen on value-request for p_emp.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_emp.
at selection-screen on value-request for p_t588b.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_t588b.
at selection-screen on value-request for p_t5k8c.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_t5k8c.
GET pernr.
CLEAR prt1.
CLEAR temp_rgdir1.
REFRESH prt1.
REFRESH temp_rgdir1.
CLEAR rgdir.
cd-key-pernr = pernr-pernr.
rp-imp-c2-cu.
LOOP AT rgdir.
MOVE-CORRESPONDING rgdir TO temp_rgdir1.
APPEND temp_rgdir1.
SORT temp_rgdir1 BY seqnr DESCENDING.
READ TABLE temp_rgdir1 INDEX 1.
rx-key-seqno = temp_rgdir1-seqnr.
rx-key-pernr = pernr-pernr.
rp-imp-c2-rk.
IF rp-imp-rk-subrc <> 0.
REJECT.
ENDIF.
prt1[] = crt[].
endloop.
IF NOT p_emp IS INITIAL.
gd_downfile = p_emp.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = gd_downfile
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'x'
TABLES
DATA_TAB = it_itab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
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.
thanks& regards
hari prasad reddy