Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Generating HR report in pre-defined format but source is not found.

Former Member
0 Kudos

hi all,

There is TCODE i.e. PC00_M99_CWTR to generate report for HR. Report is right. I have to develop report for PROVIDEND FUND section. This report is for govt. and is in predefined format. But i did not find any helpful technical specification to generate my report in required format.

In other words, i did not found the source from which i can get my data. If anyhow I found source then there is possibility to generate the report.

Can anyone please tell me.

Regards,

Jitesh

1 REPLY 1

Former Member
0 Kudos

Hi,

Hi,

I have some reports but but i dont know to which extent it will useful to you.

_______________________________________

Report 1

REPORT Ztest LINE-COUNT 20 LINE-SIZE 420.

*Table Diclarations

TABLES: PERNR.

*Infotype Diclarations

INFOTYPES: 0000,

0001,

0002,

0006,

0021.

*Data Diclarations

DATA: BEGIN OF ITAB OCCURS 0,

PERNR TYPE P0000-PERNR,

STAT2 TYPE P0000-STAT2,

BUKRS TYPE P0001-BUKRS,

PLANS TYPE P0001-PLANS,

STELL TYPE P0001-STELL,

VORNA TYPE P0002-VORNA,

NACHN TYPE P0002-NACHN,

ANZKD TYPE P0002-ANZKD,

NAME2 TYPE P0006-NAME2,

STRAS TYPE P0006-STRAS,

ORT01 TYPE P0006-ORT01,

PSTLZ TYPE P0006-PSTLZ,

NAME21 TYPE P0006-NAME2,

STRAS1 TYPE P0006-STRAS,

ORT011 TYPE P0006-ORT01,

PSTLZ1 TYPE P0006-PSTLZ,

FAVOR TYPE P0021-FAVOR,

FANAM TYPE P0021-FANAM,

FGBDT TYPE P0021-FGBDT,

*SUBTY TYPE P0006-SUBTY,

END OF ITAB.

*Start of Selection

START-OF-SELECTION.

GET PERNR.

RP_PROVIDE_FROM_LAST P0006 '2' PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

MOVE: P0006-NAME2 TO ITAB-NAME2 ,

P0006-STRAS TO ITAB-STRAS ,

P0006-ORT01 TO ITAB-ORT01 ,

P0006-PSTLZ TO ITAB-PSTLZ.

P0006-SUBTY TO ITAB-SUBTY.

ENDIF.

RP_PROVIDE_FROM_FRST P0006 '1' PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

MOVE :P0006-NAME2 TO ITAB-NAME21 ,

P0006-STRAS TO ITAB-STRAS1 ,

P0006-ORT01 TO ITAB-ORT011 ,

P0006-PSTLZ TO ITAB-PSTLZ1.

P0006-SUBTY TO ITAB-SUBTY.

ENDIF.

PROVIDE * FROM P0000

from p0001

from p0002

from p0021

BETWEEN PN-BEGDA AND PN-ENDDA

WHERE P0000-STAT2 = '2' OR

P0000-STAT2 = '3' AND

P0021-SUBTY = '2'.

MOVE: P0000-PERNR TO ITAB-PERNR,

P0000-STAT2 TO ITAB-STAT2,

P0001-BUKRS TO ITAB-BUKRS,

P0001-PLANS TO ITAB-PLANS,

P0001-STELL TO ITAB-STELL,

P0002-VORNA TO ITAB-VORNA,

P0002-NACHN TO ITAB-NACHN,

P0002-ANZKD TO ITAB-ANZKD.

move p0006-name2 to itab-name2.

move p0006-stras to itab-stras.

move p0006-ort01 to itab-ort01.

move p0006-pstlz to itab-pstlz.

*

IF P0002-ANZKD > 0.

MOVE: P0021-FAVOR TO ITAB-FAVOR,

P0021-FANAM TO ITAB-FANAM,

P0021-FGBDT TO ITAB-FGBDT.

ENDIF.

APPEND ITAB.

CLEAR ITAB.

ENDPROVIDE.

END-OF-SELECTION.

WRITE:/1(420) SY-ULINE.

WRITE:/1 SY-VLINE, 'pernr',

20 SY-VLINE, 'stat2',

40 SY-VLINE, 'bukrs',

60 SY-VLINE, 'plans',

80 SY-VLINE, 'stell',

100 SY-VLINE, 'vorna',

120 SY-VLINE, 'nachn',

140 SY-VLINE, 'anzkd',

160 SY-VLINE, 'name2',

180 SY-VLINE, 'stras',

200 SY-VLINE, 'ort01',

220 SY-VLINE, 'pstlz',

240 SY-VLINE, 'favor',

250 SY-VLINE, 'fanam',

285 SY-VLINE, 'fgbdt',

310 SY-VLINE, 'name21',

350 SY-VLINE, 'stras1',

370 SY-VLINE, 'ort011',

400 SY-VLINE, 'pstlz1',

420 SY-VLINE.

WRITE:/1(420) SY-ULINE.

LOOP AT ITAB.

WRITE:/1 SY-VLINE, ITAB-PERNR COLOR 1,

20 SY-VLINE, ITAB-STAT2 COLOR 1,

40 SY-VLINE, ITAB-BUKRS COLOR 3,

60 SY-VLINE, ITAB-PLANS COLOR 3,

80 SY-VLINE, ITAB-STELL COLOR 3,

100 SY-VLINE, ITAB-VORNA COLOR 4,

120 SY-VLINE, ITAB-NACHN COLOR 4,

140 SY-VLINE, ITAB-ANZKD COLOR 4,

160 SY-VLINE, ITAB-NAME2 COLOR 5,

180 SY-VLINE, ITAB-STRAS COLOR 5,

200 SY-VLINE, ITAB-ORT01 COLOR 5,

220 SY-VLINE, ITAB-PSTLZ COLOR 5,

240 SY-VLINE, ITAB-FAVOR COLOR 6,

250 SY-VLINE, ITAB-FANAM COLOR 6,

285 SY-VLINE, ITAB-FGBDT COLOR 6,

310 SY-VLINE, ITAB-NAME21 COLOR 7,

350 SY-VLINE, ITAB-STRAS1 COLOR 7,

370 SY-VLINE, ITAB-ORT011 COLOR 7,

400 SY-VLINE, ITAB-PSTLZ1 COLOR 7,

420 SY-VLINE.

421 ITAB-SUBTY.

ENDLOOP.

WRITE:/1(420) SY-ULINE.

else.

write:/ 'The employee has no children'.

write:/ itab-pernr,

/ itab-stat2,

/ itab-bukrs,

/ itab-plans,

/ itab-stell,

/ itab-vorna,

/ itab-nachn,

/ itab-anzkd,

/ itab-name2,

/ itab-stras,

/ itab-ort01,

/ itab-pstlz.

*

endif.

*uline.

____________________________________________________________________

3. Report

&----


*& Report ZHR_003

*&

&----


*&

*&

&----


REPORT ZHR_003.

*.......................................................................

*: Report: ZP_POSTCODE :

*: :

:

*: :

*: Date : 2004 :

*: :

*: Description: Displays report of employees by postcode area, :

*: includes current travelling allowances (i.e. parking :

*: permit or transport card etc..) :

*: :

*: Use: Help encourage the use of car sharing and public :

*: transport where appropriate. :

*:.....................................................................:

type-pools: slis. "ALV Declarations

NODES: pernr.

INFOTYPES: 0000, 0001, 0002, 0006, 0008, 0014, 0105, 0121.

SELECTION-SCREEN BEGIN OF BLOCK pcode WITH FRAME TITLE text-s01.

SELECT-OPTIONS: so_pcode FOR p0006-pstlz.

SELECTION-SCREEN END OF BLOCK pcode.

TYPES: BEGIN OF t_output,

pernr TYPE p0001-pernr, "personnel name

anredtxt TYPE t522t-atext, "title (based on p0002-anred)

fname TYPE p0002-vorna, "first name

lname TYPE p0002-nachn, "last name

orgtx TYPE t527x-orgtx, "dept

fte TYPE p0008-bsgrd, "fte

parking(20) TYPE c,

payslip TYPE t526-sachn, "payslip address

telno TYPE p0105-usrid_long, "tel number(p0105-usrty = 0020)

email TYPE p0105-usrid_long, "email (p0105-usrty = MAIL)

postcode type p0006-pstlz,

END OF t_output.

DATA: it_output TYPE STANDARD TABLE OF t_output INITIAL SIZE 0,

wa_output TYPE t_output.

*ALV data declarations

data: fieldcatalog type slis_t_fieldcat_alv with header line,

gd_tab_group type slis_t_sp_group_alv,

gd_layout type slis_layout_alv,

gd_repid like sy-repid,

gt_events type slis_t_event,

gd_prntparams type slis_print_alv,

gd_count(6) type n,

gd_outtext(70) type c,

gd_lines type i.

************************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

clear: gd_count.

GET pernr.

Infotype 0121 is used to store multiple contracts for personnel.

Field p0121-hpern contains the personnel number for the main contract.

PROVIDE * from p0121 between pn-begda and pn-endda.

Check if main contract

if p0121-pernr ne p0121-hpern.

reject.

endif.

ENDPROVIDE.

add 1 to gd_count.

concatenate 'Processing personnel data'(m10) gd_count into gd_outtext

separated by ' '.

Display indicator for employee count

perform progress_indicator using gd_outtext.

Retrieve datd from infotypes

rp_provide_from_last p0000 space pn-begda pn-endda.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp_provide_from_last p0002 space pn-begda pn-endda.

rp_provide_from_last p0006 space pn-begda pn-endda.

rp_provide_from_last p0008 space pn-begda pn-endda.

rp_provide_from_last p0014 space pn-begda pn-endda.

Check post code

CHECK p0006-pstlz IN so_pcode. "cp

Post code

wa_output-postcode = p0006-pstlz.

Personnel number

wa_output-pernr = pernr-pernr.

Personnel title

SELECT SINGLE atext

FROM t522t

INTO wa_output-anredtxt

WHERE sprsl EQ sy-langu AND

anred EQ p0002-anred.

First name

wa_output-fname = p0002-vorna.

Last name

wa_output-lname = p0002-nachn.

Organizational Unit text (dept)

SELECT SINGLE orgtx

FROM t527x

INTO wa_output-orgtx

WHERE sprsl EQ sy-langu AND

orgeh EQ p0001-orgeh AND

endda GE sy-datum.

FTE

wa_output-fte = p0008-bsgrd.

Parking / travel deducted?

CASE p0014-lgart.

WHEN '7180' OR '7181' OR '7182'.

wa_output-parking = text-002.

WHEN '7183'.

wa_output-parking = text-001.

WHEN '7171' OR '7172' or '7173' or '7174' or

'7175' or '7176' or '7177' or '7178'.

wa_output-parking = text-003.

ENDCASE.

Payslip Address

SELECT SINGLE sachn

FROM t526

INTO wa_output-payslip

WHERE werks EQ p0001-werks AND

sachx EQ p0001-sacha.

PROVIDE * from p0105 between pn-begda and pn-endda.

Telephone numbers

if p0105-usrty = '0020'.

wa_output-telno = p0105-usrid_long.

endif.

Email address

if p0105-usrty = 'MAIL'.

wa_output-email = p0105-usrid_long.

endif.

ENDPROVIDE.

append wa_output to it_output.

clear: wa_output.

************************************************************************

*END-OF-SELECTION.

END-OF-SELECTION.

describe table it_output lines gd_lines.

if gd_lines gt 0.

perform build_fieldcatalog.

perform build_layout.

perform display_alv_report.

else.

message i003(zp) with 'No records found'.

endif.

&----


*& Form PROGRESS_INDICATOR

&----


Displays progress indicator on SAP screen

-


form progress_indicator using p_text.

call function 'SAPGUI_PROGRESS_INDICATOR'

exporting

PERCENTAGE = 0

text = p_text.

endform. " PROGRESS_INDICATOR

&----


*& Form BUILD_FIELDCATALOG

&----


Build Fieldcatalog for ALV Report

-


form build_fieldcatalog.

fieldcatalog-fieldname = 'PERNR'.

fieldcatalog-seltext_m = 'Personnel No.'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

fieldcatalog-do_sum = 'X'.

fieldcatalog-no_zero = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'ANREDTXT'.

fieldcatalog-seltext_m = 'Title'.

fieldcatalog-col_pos = 1.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'FNAME'.

fieldcatalog-seltext_m = 'First Name'.

fieldcatalog-col_pos = 2.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'LNAME'.

fieldcatalog-seltext_m = 'Last Name'.

fieldcatalog-col_pos = 3.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'ORGTX'.

fieldcatalog-seltext_m = 'Department'.

fieldcatalog-col_pos = 4.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'FTE'.

fieldcatalog-seltext_m = 'FTE'.

fieldcatalog-col_pos = 5.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'PARKING'.

fieldcatalog-seltext_m = 'Parking/Metrocard'.

fieldcatalog-col_pos = 6.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'PAYSLIP'.

fieldcatalog-seltext_m = 'Payslip Add.'.

fieldcatalog-col_pos = 7.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'TELNO'.

fieldcatalog-seltext_m = 'Telephone'.

fieldcatalog-col_pos = 8.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EMAIL'.

fieldcatalog-seltext_m = 'E-mail'.

fieldcatalog-col_pos = 9.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'POSTCODE'.

fieldcatalog-seltext_m = 'Post code'.

fieldcatalog-col_pos = 10.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

endform. " BUILD_FIELDCATALOG

&----


*& Form BUILD_LAYOUT

&----


Build layout for ALV grid report

-


form build_layout.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

gd_layout-zebra = 'X'.

endform. " BUILD_LAYOUT

&----


*& Form DISPLAY_ALV_REPORT

&----


Display report using ALV grid

-


form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_output

exceptions

program_error = 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.

endform. " DISPLAY_ALV_REPORT

_______________________________________________________________-

4. Report

************************************************************************

Report: ZSXP_ABSENCE_DATA *

Date : 12.02.2003 *

Description: Retrieve maternaty/Sickness Absence data

************************************************************************

REPORT ZHR_004

LINE-SIZE 100 NO STANDARD PAGE HEADING

MESSAGE-ID 5g.

TABLES: t554s, pernr, 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.

INFOTYPES: 0001, "Organisational assignment

0002, "Personal Data

0003, "Payroll Status

0088, "SMP

2001, "Absences

0086. "SSP/SMP Exlclusions

DATA: ssp_weeks TYPE p DECIMALS 2 VALUE 0.

DATA: ssp_total TYPE p DECIMALS 2 VALUE 0,

total_val TYPE p DECIMALS 2 VALUE 0,

smp_weeks TYPE p DECIMALS 2 VALUE 0,

smp_value TYPE p DECIMALS 2 VALUE 0,

gross LIKE pc207-betrg,

dis_gross TYPE p DECIMALS 2 VALUE 0.

DATA: gd_begda(10) TYPE c,

gd_endda(10) TYPE c.

DATA: ld_orgtxt LIKE t527x-orgtx.

DATA: name(30).

DATA: BEGIN OF itab OCCURS 0,

pernr LIKE p0002-pernr,

perid LIKE p0002-perid,

name LIKE name,

END OF itab.

TYPES: BEGIN OF t_report,

pernr TYPE pernr-pernr, "8

name TYPE name, "30

awart TYPE p2001-awart, "4

begda TYPE p2001-begda, "10

endda TYPE p2001-endda, "10

wkspaid TYPE p DECIMALS 2, "10

amtpaid TYPE p DECIMALS 2, "10

END OF t_report.

DATA: it_report TYPE STANDARD TABLE OF t_report INITIAL SIZE 0,

wa_report TYPE t_report.

DATA: moabw LIKE t001p-moabw.

DATA: printheader TYPE i VALUE 1,

gd_success TYPE i.

NCALE declarations

TYPES : BEGIN OF pfra0_pcale,

annee(4) TYPE c.

INCLUDE STRUCTURE pcint.

TYPES : END OF pfra0_pcale.

TYPES : pfra0_tab_pcale TYPE pfra0_pcale OCCURS 0.

DATA: it_ncale TYPE STANDARD TABLE OF pcnat INITIAL SIZE 0,

wa_ncale TYPE pcnat,

it_pcale TYPE pfra0_tab_pcale,

pcale TYPE pfra0_tab_pcale.

SMP/SSP absence data

data begin of it_msa occurs 0.

include structure pc27j.

data end of it_msa.

parameters: p_memid type char30.

************************************************************************

*STAR-OF-SELECTION

START-OF-SELECTION.

gd_begda = pn-begda.

gd_endda = pn-endda.

gd_begda+6(2) = '01'.

gd_endda+6(2) = '01'.

refresh: it_msa.

clear: it_msa.

GET pernr.

PERFORM IMPORT_PC USING GD_SUCCESs.

PERFORM get_rgdir.

while gd_begda le gd_endda.

PERFORM get_new_rg USING gd_begda.

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

DAYS = '0'

MONTHS = '1'

START_DATE = gd_begda

IMPORTING

RESULT_DATE = gd_begda.

endwhile.

msa] = it_msa[.

EXPORT msa TO MEMORY ID p_memid.

&----


*& Form GET_RGDIR

&----


FORM get_rgdir.

rp-init-buffer.

CLEAR rgdir.

REFRESH rgdir.

MOVE pernr-pernr(8) TO cd-key-pernr.

rp-imp-c2-cd.

IF rp-imp-cd-subrc = 0. "rgdir success

SORT rgdir BY seqnr ASCENDING.

CLEAR rgdir.

ENDIF.

ENDFORM.

-


FORM get_new_rg *

-


........ *

-


--> search_date *

-


FORM get_new_rg USING search_date.

DATA: rg_day TYPE d,

rgbeg TYPE d,

rgend TYPE d.

MOVE: search_date TO rg_day.

CLEAR: msa.

LOOP AT rgdir WHERE void NE 'V'.

MOVE: rgdir-fpbeg TO rgbeg,

rgdir-fpend TO rgend.

IF ( rgbeg <= rg_day ) AND

( rgend >= rg_day ) AND

rgdir-srtza = 'A'. "Must be periods actual set of results

EXIT.

ENDIF.

ENDLOOP.

UNPACK rgdir-seqnr TO rx-key-seqno.

MOVE pernr-pernr(8) TO rx-key-pernr(8).

rp-imp-c2-rg.

append lines of msa to it_msa.

IF rp-imp-rg-subrc 0.

rg fail

ELSE.

rg success

ENDIF.

ENDFORM.

*Text elements

*----


001 Sickness History for SSP 1

002 Employee Name.

003 National Insurance Number.

004 Payroll Number.

005 Sickness Start Date

006 Sickness End Date

007 Number of weeks paid

008 system-error:

009 No SSP / SMP record found

010 Absence type

011 No. weeks paid

012 Amount

013 Organisation Unit.

T01 Sickness Absence types

*Selection texts

*----


SO_SAP SAP Att./absence types

SO_SMP SMP Att./absence types

SO_SPP SPP Att./absence types

SO_SSP SSP Att./absence types

_____________________________________________________________

5. Report

*.......................................................................

*: Report: ZDOWNEMPDATA :

*: :

:

*: Date : 2004 :

*: :

*: Description: Downloads employee data to TAB delimited flat files :

*: :

*:.....................................................................:

REPORT ZHR_005 .

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 default 'c://emp.xls',

p_empt LIKE rlgrap-filename default 'c://empt.xls',

p_cont LIKE rlgrap-filename default 'c://cont.xls'.

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.

________________________________________________________________

6. Report

......................................................................

: Report ZIT0019_TXT :

😘

:.....................................................................

: Description : :

:.............: :

: Retrieves comment text for infotype 0019 form PCL1 cluster table :

: :

:....................................................................:

REPORT zhr_006. .

NODES: pernr.

INFOTYPES: 0019.

TYPE-POOLS: slis.

-


Daten zu Cluster TX (Infotyptexte) *

-


INCLUDE RPC1TX00.

*INCLUDE rpcitx00.

*INCLUDE rpcitd00.

TYPES: BEGIN OF t_reptab,

pernr TYPE pernr-pernr,

subty TYPE p0019-subty,

termn TYPE p0019-termn,

text LIKE ptext-line,

END OF t_reptab.

DATA: it_reptab TYPE STANDARD TABLE OF t_reptab INITIAL SIZE 0,

wa_reptab TYPE t_reptab.

*ALV data declarations

DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

gd_tab_group TYPE slis_t_sp_group_alv,

gd_layout TYPE slis_layout_alv,

gd_repid LIKE sy-repid,

it_sortcat TYPE slis_sortinfo_alv OCCURS 1,

wa_sort LIKE LINE OF it_sortcat.

SELECTION-SCREEN BEGIN OF BLOCK subtyp WITH FRAME TITLE text-001.

SELECT-OPTIONS: so_sub FOR p0019-subty.

SELECTION-SCREEN END OF BLOCK subtyp.

************************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

GET pernr.

*rp_provide_from_last p0019 space pn-begda pn-endda.

PROVIDE * FROM p0019 BETWEEN pn-begda AND pn-endda.

CHECK p0019-subty IN so_sub.

MOVE-CORRESPONDING p0019 TO tx-key.

tx-key-infty = '0019'.

rp-imp-c1-tx.

IF sy-subrc = 0.

LOOP AT ptext.

MOVE-CORRESPONDING p0019 TO wa_reptab.

wa_reptab-text = ptext-line.

APPEND wa_reptab TO it_reptab.

CLEAR: wa_reptab.

ENDLOOP.

ENDIF.

ENDPROVIDE.

SORT it_reptab BY pernr subty.

************************************************************************

*END-OF-SELECTION.

END-OF-SELECTION.

PERFORM build_fieldcatalog.

PERFORM build_layout.

PERFORM build_sortcat.

PERFORM display_alv_report.

&----


*& Form BUILD_FIELDCATALOG

&----


Build Fieldcatalog for ALV Report

-


FORM build_fieldcatalog.

fieldcatalog-fieldname = 'PERNR'.

fieldcatalog-seltext_m = 'Personnel Num'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

fieldcatalog-do_sum = 'X'.

fieldcatalog-no_zero = 'X'.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'SUBTY'.

fieldcatalog-seltext_m = 'Sub Type'.

fieldcatalog-col_pos = 1.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'TERMN'.

fieldcatalog-seltext_m = 'Sub Type'.

fieldcatalog-col_pos = 1.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'TEXT'.

fieldcatalog-seltext_m = 'Text'.

fieldcatalog-col_pos = 2.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

ENDFORM. " BUILD_FIELDCATALOG

&----


*& Form BUILD_LAYOUT

&----


Build layout for ALV grid report

-


FORM build_layout.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

gd_layout-totals_only = 'X'.

gd_layout-f2code = 'DISP'. "Sets fcode for when double

"click(press f2)

gd_layout-zebra = 'X'.

gd_layout-group_change_edit = 'X'.

gd_layout-header_text = 'helllllo'.

ENDFORM. " BUILD_LAYOUT

&----


*& Form DISPLAY_ALV_REPORT

&----


Display report using ALV grid

-


FORM display_alv_report.

gd_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

i_callback_user_command = 'USER_COMMAND'

i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

it_sort = it_sortcat

it_special_groups = gd_tabgroup

IT_EVENTS = GT_XEVENTS

i_save = 'X'

is_variant = z_template

TABLES

t_outtab = it_reptab

EXCEPTIONS

program_error = 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.

ENDFORM. " DISPLAY_ALV_REPORT

&----


*& Form build_sortcat

&----


text

-


--> p1 text

<-- p2 text

-


FORM build_sortcat .

wa_sort-spos = 1.

wa_sort-fieldname = 'PERNR'.

gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

wa_sort-spos = 2.

wa_sort-fieldname = 'SUBTY'.

gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

wa_sort-spos = 3.

wa_sort-fieldname = 'TERMN'.

gd_sortcat-tabname

APPEND wa_sort TO it_sortcat.

ENDFORM. " build_sortcat

_________________________________________________________________

REPORT ZHR_007 LINE-SIZE 100.

declaration

TABLES: pernr.

INFOTYPES: 0002, "Personal Data

0006. "Address

DATA: name LIKE pernr-ename.

Processing

GET pernr.

PROVIDE * FROM p0002

FROM p0006 BETWEEN pn-begda AND pn-endda

WHERE p0006-subty = '1'.

IF p0006_valid EQ 'X'.

CONCATENATE p0002-nachn p0002-vorna INTO name

SEPARATED BY SPACE.

PERFORM print_data.

ENDIF.

ENDPROVIDE.

-


FORM PRINT_DATA

-


FORM print_data.

WRITE: / p0002-pernr NO-ZERO,

sy-vline,

p0002-begda,

sy-vline,

p0002-endda,

sy-vline,

(30) name,

sy-vline,

(20) p0006-ort01.

ENDFORM.

8. Report

&----


*& Report ZHR_008

*&

&----


*&

*&

&----


REPORT ZHR_008 LINE-SIZE 80 .

Declaration

TABLES: pernr,

t555v. "Job Titles

INFOTYPES: 0002, "Personal Data

0007. "Planned Working Time

DATA: name LIKE pernr-ename.

Processing

GET pernr.

PROVIDE nachn vorna FROM p0002

zterf FROM p0007 BETWEEN pn-begda AND pn-endda.

IF p0007_valid EQ 'X'.

CONCATENATE p0002-nachn p0002-vorna INTO name

SEPARATED BY space.

PERFORM re555v USING p0007-zterf.

FORMAT RESET COLOR 6 INTENSIFIED OFF.

WRITE: /1(10) pernr-pernr COLOR 5 ,

11 SY-VLINE,

12(20) name COLOR 1,

32 SY-VLINE,

33(25) t555v-ztext COLOR 2,

58 SY-VLINE,

59(10) p0007-begda COLOR 3,

69 SY-VLINE,

70(10) p0007-endda COLOR 4,

80 SY-VLINE.

WRITE :/11 SY-VLINE,

32 SY-VLINE,

58 SY-VLINE,

69 SY-VLINE,

80 SY-VLINE.

ENDIF.

ENDPROVIDE.

ULINE.

-


FORM RE555v *

-


Read Time Management Status *

-


FORM re555v USING value(tm_status).

CHECK sy-langu NE t555v-sprsl OR

tm_status NE t555v-zterf.

SELECT SINGLE * FROM t555v WHERE sprsl EQ sy-langu

AND zterf EQ tm_status.

IF sy-subrc NE 0.

MOVE space TO t555v.

ENDIF.

ENDFORM.

9. Report

&----


*& Report ZHR_009

*&

&----


*&

*&

&----


REPORT zhr_009.

Declaration

TABLES: pernr,

t512t, "Wage type text

t001p. "Plant section

INFOTYPES: 0001, "Organ. assignment

0014. "Recur.Payments/Deds.

START-OF-SELECTION.

rp_set_data_interval 'P0014' pn-begda pn-endda.

Processing

GET pernr.

CHECK LINES( p0014 ) GT 0.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp-read-t001p p0001-werks p0001-btrtl space.

SKIP 2.

WRITE: / pernr-pernr,

(20) pernr-ename,

p0001-werks,

t001p-btext.

LOOP AT p0014 WHERE endda GE pn-begda

AND begda LE pn-endda.

CHECK p0014-betrg NE 0.

PERFORM print USING

p0014-lgart

p0014-betrg

p0014-begda

p0014-endda.

ENDLOOP.

-


FORM PRINT *

-


Print List *

-


FORM print USING

value(wtype)

value(amount)

value(begda)

value(endda).

PERFORM re512t USING t001p-molga wtype.

WRITE: / wtype UNDER pernr-ename,

t512t-lgtxt,

amount,

begda,

endda.

ENDFORM. "print

-


FORM RE512T *

-


Read Wagetype Texts *

-


FORM re512t USING value(country_grouping)

value(wtype).

CHECK t512t-sprsl NE sy-langu

OR t512t-molga NE country_grouping

OR t512t-lgart NE wtype.

SELECT SINGLE * FROM t512t

WHERE sprsl EQ sy-langu

AND molga EQ country_grouping

AND lgart EQ wtype.

IF sy-subrc NE 0.

CLEAR t512t.

ENDIF.

ENDFORM. "re512t

10. Report

REPORT zhr_010.

declaration

TABLES: pernr, t548t. "Date Types

INFOTYPES: 0001, "Org.Assignment

0041. "Date Specifications

$$- Start of INCLUDE ZPSOL050_DATA_STRUCTURES --$$

&----


*& Include ZPSOL050_DATA_STRUCTURES *

&----


TYPE-POOLS: slis.

DATA: BEGIN OF dtype , "Work area for IT0041

dar LIKE p0041-dar01,

dat LIKE p0041-dat01,

END OF dtype.

TYPES: BEGIN OF data_struc, "Data table structure

pernr LIKE pernr-pernr,

ename LIKE pernr-ename,

eindt LIKE p0016-eindt,

dar LIKE p0041-dar01,

dtext LIKE t548t-dtext,

dat LIKE p0041-dat01,

END OF data_struc.

DATA: data_tab TYPE TABLE OF data_struc,

data_tab_wa TYPE data_struc.

DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,

alv_layout TYPE slis_layout_alv.

DATA: filled_lines LIKE sy-index,

stru_disvar TYPE disvariant.

$$--- End of INCLUDE ZPSOL050_DATA_STRUCTURES --$$

SELECT-OPTIONS: datetype FOR p0041-dar01 DEFAULT '01'.

Processing

GET pernr.

CHECK lines( p0041 ) GT 0.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp_provide_from_last p0041 space pn-begda pn-endda.

IF pnp-sw-found EQ 0.

REJECT.

ELSE.

DO 12 TIMES VARYING dtype FROM p0041-dar01

NEXT p0041-dar02.

IF dtype-dar IS INITIAL.

EXIT.

ELSE.

IF dtype-dar IN datetype.

CLEAR data_tab_wa.

MOVE-CORRESPONDING pernr TO data_tab_wa.

MOVE-CORRESPONDING dtype TO data_tab_wa.

PERFORM read_hiredate.

PERFORM re548t USING sy-langu dtype-dar.

MOVE t548t-dtext TO data_tab_wa-dtext.

APPEND data_tab_wa TO data_tab.

ENDIF.

ENDIF.

ENDDO.

ENDIF.

END-OF-SELECTION.

PERFORM fieldcat_init USING alv_fieldcat.

alv_layout-colwidth_optimize = 'X'.

alv_layout-zebra = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_INTERFACE_CHECK = ' '

I_BUFFER_ACTIVE = ' '

i_callback_program = 'ZPSOL060'

I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = ' '

I_CALLBACK_TOP_OF_PAGE = ' '

I_CALLBACK_HTML_TOP_OF_PAGE = ' '

I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME =

I_BACKGROUND_ID = ' '

I_GRID_TITLE = 'Date Specifications'

I_GRID_SETTINGS =

is_layout = alv_layout

it_fieldcat = alv_fieldcat

IT_EXCLUDING =

IT_SPECIAL_GROUPS =

IT_SORT =

IT_FILTER =

IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = stru_disvar

IT_EVENTS =

IT_EVENT_EXIT =

IS_PRINT =

IS_REPREP_ID =

I_SCREEN_START_COLUMN = 0

I_SCREEN_START_LINE = 0

I_SCREEN_END_COLUMN = 0

I_SCREEN_END_LINE = 0

IT_ALV_GRAPHICS =

IT_ADD_FIELDCAT =

IT_HYPERLINK =

IMPORTING

E_EXIT_CAUSED_BY_CALLER =

ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = data_tab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc = 1.

WRITE: 'Program error'(002).

ENDIF.

-


FORM READ_HIREDATE

-


Retrieving hiredate from infotype 0000

-


FORM read_hiredate.

CALL FUNCTION 'RP_GET_HIRE_DATE'

EXPORTING

persnr = p0001-pernr

check_infotypes = '0000'

IMPORTING

hiredate = data_tab_wa-eindt

EXCEPTIONS

OTHERS = 1.

ENDFORM.

-


FORM RE548T

Read date specification texts

-


VALUE (LANGUAGE)

--> VALUE(DTYPE)

-


FORM re548t USING value(language)

value(dtype).

CHECK t548t-sprsl NE language

OR t548t-datar NE dtype.

SELECT SINGLE * FROM t548t

WHERE sprsl EQ language

AND datar EQ dtype.

IF sy-subrc NE 0.

CLEAR t548t.

ENDIF.

ENDFORM.

$$- Start of INCLUDE ZPSOL050_FILL_FIELDCAT --$$

&----


*& Include ZPSOL050_FILL_FIELDCAT *

&----


-


FORM FIELDCAT_INIT

-


FORM fieldcat_init USING p_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'PERNR'.

ls_fieldcat-ref_tabname = 'PERNR'.

ls_fieldcat-key = 'X'.

APPEND ls_fieldcat TO p_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'ENAME'.

ls_fieldcat-ref_tabname = 'PERNR'.

APPEND ls_fieldcat TO p_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'EINDT'.

ls_fieldcat-ref_tabname = 'P0016'.

APPEND ls_fieldcat TO p_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'DAR'.

ls_fieldcat-ref_fieldname = 'DAR01'.

ls_fieldcat-ref_tabname = 'P0041'.

APPEND ls_fieldcat TO p_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'DTEXT'.

ls_fieldcat-ref_tabname = 'T548T'.

APPEND ls_fieldcat TO p_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'DAT'.

ls_fieldcat-ref_fieldname = 'DAT01'.

ls_fieldcat-ref_tabname = 'P0041'.

APPEND ls_fieldcat TO p_fieldcat.

ENDFORM.

$$--- End of INCLUDE ZPSOL050_FILL_FIELDCAT --$$

Reward points if found helpful.....

Cheers,

Chandra Sekhar.