Search on this Website

Thursday, May 24, 2007

Report: ZSXP_ABSENCE_DATA

************************************************************************
* Report: ZSXP_ABSENCE_DATA *
* *
* Author: abap code *
* *
* Date : 25.05.2007 *
* *
* Description: Retrieve maternaty/Sickness Absence data
* *
************************************************************************


REPORT ZSXP_ABSENCE_DATA
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


Other Useful Link:

ZP_POSTCODE Staff by Post code report
ZP_GET_SXP_ABSENCE_DATA Retrieve actual sickpay values (ABAP)
ZDOWNEMPDATA Download various employee data to excel/tab flat files
Download Human Resources (HR) tutorial1Human Resources (HR) tutorial2
Download HR Form Editor (PY-XX-TL) tutorial
Download HR Forms Workplace (PY-XX-FO) tutorial
Download HR Funds and Position Management (PA-PM) Tutorial
Download HR - Human Resource Management Tutorial
Download HR Tools (PY-XX-TL) Tutorial
Download HR Infotypes tutorial

No comments: