Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

 

Saturday, December 29, 2007

Free Download SAP HR Report Programming in HR pdf book

Report Programming in HR

Free Download SAP HR Training and Event Management Payroll Account pdf book

Training and Event Management Payroll Account

Free Download SAP HR Reporting in Human Resource Management pdf book

Reporting in Human Resource Management

Free Download SAP HR Wage Type Statement Wage Types pdf book

Wage Type Statement Wage Types

Free Download SAP HR Wage Type Reporter (H99CWTR0) pdf book

Wage Type Reporter (H99CWTR0)

Free Download SAP HR Wage Type Distribution pdf book

Wage Type Distribution

Free Download SAP HR Wage and Salary Payments pdf book

Wage and Salary Payments

Free Download SAP HR Master Data Distribution (Human Resources) pdf book

Master Data Distribution (Human Resources)

Free Download SAP HR Tools (PY-XX-TL) pdf book

HR Tools (PY-XX-TL)

Free Download SAP HR Infotypes pdf book

HR Infotypes

Free Download SAP HR - Human Resource Management pdf book

Free Download Sap HR Funds and Position Management (PA-PM) pdf book

HR Funds and Position Management (PA-PM)

Free Download Sap HR Forms Workplace (PY-XX-FO) pdf book

HR Forms Workplace (PY-XX-FO)

Free Download Sap HR Form Editor (PY-XX-TL) pdf book

HR Form Editor (PY-XX-TL)

Free Download Sap Human Resources (HR) pdf book

Human Resources (HR)

Free Download Sap Human Resources (HR) pdf book

Human Resources (HR)

Sunday, November 11, 2007

What The Differences Between ABAP and HR-ABAP

The ABAP HR is an integral part of ABAP. Generally in ABAP the following are done:

1) Table development
2) Date Processin
3) Reprt developing
4) BAPIs /RFC s
5) Data base update
6) Screens development/enhancement
7) Scripts and smart forms.
8) Function Building
9) Java connectors etc.

This is basically done through the PROGRAMMING in ABAP builder by using ABAP 4th generation languge. This may be related to any module of my SAP ERP 2004 like HR, FICO.SD,MM,CRM Etc.,

Now when it is said ABAP HR. It is the development of ABAP in the area of HR to meet the clients requirements according to the functional specifications .They may be in any area of HR like in the areas of time aspects ,pay aspects, OM aspects and Self Services like E-recruitment, ESS etc.,

One example of ABAP PROGRAMME related to HR is given below.

Report: ZP_POSTCODE: This report has been developed by the ABAPER in the area of SAP HR to Display report of employees by postcode that includes current traveling allowances (i.e. parking, permit or transport card etc.)

*:.....................................................................: :
*: Use: Help encourage the use of car sharing and public
* transport wherever it appropriate (this is the functional requirement of the client or the functional specification
* (which is given by the functional consultants) :
*:.....................................................................:

REPORT zp_postcode.

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

To conclude the message its always advantage to have a HR consultant who knows ABAP that is why this ABAP HR Consultant are in high demand.

T-Codes For Generating Reports In HR Module

Tell some of the Tcodes for running SAP HR reports?

Some of the t-codes for generating reports in HR Module...

Employee Master data related Reports

S_PH0_48000450 - Date Monitoring
S_PH9_46000224 - Education and Training
S_PH9_46000223 - EEs Entered and Left
S_PH9_46000222 - Family Members
S_PH9_46000221 - Birthday List
S_AHR_61016360 - HR Master Data Sheet
S_AHR_61016369 - Employee List
S_AHR_61016356 - Time Spent in Each Pay Scale Area/Type/Group/Level
S_AHR_61016374 – Nationalities
PT 90 – Absences data: Calendar View
S_PH9_46000218 - Statistics: Gender Sorted by Age
S_PH9_46000217 - Statistics: Gender Sorted by Seniority

S_PH0_48000510 - Ad Hoc Query -
A tool to generate reports according to Client requirements

Organizational Management Reports

S_AHR_61016493 - Organizational Structure
S_AHR_61016494 - Organizational Structure with Positions
S_AHR_61016497 - Existing Jobs
S_AHR_61016502 - Existing Positions
S_AHR_61016503 - Staff Assignments
S_AHR_61016509 - Vacant Positions

Functional Specs For Some Payroll Report

What is the proceedure to write functional specs for some report?

My client want me to write one for some payroll report. How should I proceed onto this matter?

A functional spec should theoriically mean that the ABAPer should be able to take the design document you have prepared, go and sit in a dark corner of the office and build the whole report..... this rarely if ever happens, but I think thats the theory.

When you write a functional spec, you are meant to be turning the clients requirements into a design document that a techo can then build from.

Some of the things you may want to think about are:

Report logic - What information is the report trying to get, what logical links are required to link the data together - like master data and payroll data, and org mgt data, and how should this be linked, an important bit to remember here is the time selection, do you want all the data in the system, or only the data relevant on the day, or over a month etc.

Selection screen - What fields are required as selection options

Authorisations - Should the report check the 'runners' authorisations and tailor the output accordingly

Output - What fields are required to be output, in what order, in what file type, for example this could be a text file, or just out to the screen of the runner.

Error handling - What should the report do when it encounters a problem eg what scenarios would constitue errors - what should happen etc.

Test mode - does the report require running in test mode prior to a file being produced?

Sample HR Reports - Allocate Petrol Allowance

Two ABAP HR Programs, which are interconnected, the first takes employee numbers which should not be given Petrol allowance and the other program gives the petrol allowance to employees.

FIRST PRG
*********
REPORT ZPETROL_EXCLUDE .

TABLES SSCRFIELDS.

SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN SKIP 9.
PARAMETERS NUMBER(200) TYPE C.
SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN:
BEGIN OF LINE,
PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC,
END OF LINE.
SELECTION-SCREEN END OF SCREEN 100.

CALL SCREEN 100.

AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'PROC'.
SET PARAMETER ID: 'NUM' FIELD NUMBER.
CALL TRANSACTION 'ZP_PALLOWANCE'.
LEAVE TO SCREEN 0.
ENDCASE.

SECOND PRG
**********

REPORT ZPR_PETROL_ALLOWANCE NO STANDARD PAGE
HEADING .

*-- Infotypes
INFOTYPES : 0000, "Actions
0002, "Personal Data
0008. "Basic pay details

*-- Tables
TABLES : PERNR, "Standard Selections for HR Master Data Reporting
PC207, "Payroll Results: Results Table
PCL1, "HR Cluster 1
PCL2, "HR Cluster 2
T510, "Pay scales
T549A, "Payroll areas
T549Q, "Payroll Periods
PA0002. "Personal details

*-- Internal Tables

*-- Internal Table Declaration For Holding The Data
DATA: BEGIN OF INT_PETROL OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL.
DATA: BEGIN OF PA0015_DATA OCCURS 0,
PERNR LIKE PA0015-PERNR,
BETRG LIKE PA0015-BETRG,
END OF PA0015_DATA.

DATA:BEGIN OF INT_PETROL2 OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
VORNA LIKE PA0002-VORNA, "First Name
NACHN LIKE PA0002-NACHN, "Last Name
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL2.

DATA : TITLE TYPE LVC_TITLE.

DATA: BEGIN OF PER_NO OCCURS 0,
PERNR LIKE PA0008-PERNR,
TRFST LIKE PA0008-TRFST,
END OF PER_NO.

DATA: BEGIN OF MSG OCCURS 0,
MSG1(100) TYPE C,
END OF MSG.

DATA: FLAG TYPE I VALUE '0',
DIS_FLAG TYPE I VALUE '0'.

DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0
WITH HEADER LINE.

DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH
HEADER LINE.

DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL. "WORKAREA FOR INSERTING
VALUES.

*DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'. "CHANGE WAGE TYPE HERE
DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'. "CHANGE WAGE TYPE HERE

DATA: BEGIN OF INT_0015 OCCURS 0,
PERNR(038),
BEGDA(010),
BETRG(018),
END OF INT_0015.

*-- Internal Table To Store Error Records.
DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE.

*-- Batch Input Data of Single Transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

*-- Internal Table For Export and Import Payroll Results
DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
LGTXT LIKE T512T-LGTXT.



DATA: BEGIN OF EMP_NO OCCURS 0,
PERNR(4) TYPE C,
END OF EMP_NO.

DATA: BEGIN OF EMP_NO1 OCCURS 0,
PERNR TYPE I,
END OF EMP_NO1.

DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0.
DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA LEN1 TYPE I.

DATA: ERR LIKE MESSAGE.
DATA TEMP_NUM(200) TYPE C.


*-- Includes

*-- International Include
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 PC2RXIN0. "Cluster IN data definition
INCLUDE RPC2RX09.

*-- ALV Declaration
TYPE-POOLS : SLIS.

DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
INT_EVENTS TYPE SLIS_T_EVENT,
INT_LAYOUT TYPE SLIS_LAYOUT_ALV,
WS_EVENTS TYPE SLIS_ALV_EVENT,
WS_REPID LIKE SY-REPID.

*-- Initialization
INITIALIZATION.

WS_REPID = SY-REPID.

*-- At Selection-Screen
START-OF-SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) TEXT-002.
SELECTION-SCREEN POSITION 33.
PARAMETERS: P_RATE TYPE P DECIMALS 2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF BLOCK B3.
PARAMETERS: P_UPLOAD AS CHECKBOX,
P_FG RADIOBUTTON GROUP G1,
P_BG RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B4.
PARAMETERS: P_DI AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B4.
SELECTION-SCREEN END OF BLOCK B2.

AT SELECTION-SCREEN.

*-- Wate Type Text

SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND
MOLGA = '40' AND LGART = P_LGART1 .

*-- Data Retrieval From Logical Database PNP
GET PERNR.

PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND
PN-ENDDA.
INT_PETROL1-PERNR = P0000-PERNR.
CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED
BY SPACE.
ENDPROVIDE.

*-- Clear Data
CLEAR: RGDIR, INT_RGDIR.
REFRESH: RGDIR, INT_RGDIR.

*-- Read All The Payroll Runs For An Employee
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK RP-IMP-CD-SUBRC EQ 0.

*-- Clear Data
REFRESH: RT.

* Read IN Cluster.
LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA.
MOVE-CORRESPONDING RGDIR TO INT_RGDIR.
APPEND INT_RGDIR.
CLEAR INT_RGDIR.
ENDLOOP.

* Read the last record.
SORT INT_RGDIR BY SEQNR DESCENDING.
READ TABLE INT_RGDIR INDEX 1.
RX-KEY-SEQNO = INT_RGDIR-SEQNR.
RX-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-IN.
CHECK RP-IMP-IN-SUBRC EQ 0.

READ TABLE RT WITH KEY LGART = P_LGART1.
IF SY-SUBRC = 0.
INT_PETROL1-PALLOWANCE = RT-BETRG.
ENDIF.
APPEND INT_PETROL1.
CLEAR INT_PETROL1.

SELECT TRFST PERNR
INTO CORRESPONDING FIELDS OF TABLE PER_NO
FROM PA0008
WHERE TRFST LIKE 'L%'
AND BET01 > 0.

SORT PER_NO.
DELETE ADJACENT DUPLICATES FROM PER_NO.

*-- END-OF-SELECTION.

END-OF-SELECTION.

LOOP AT INT_PETROL1.
READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-TRFST = PER_NO-TRFST.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.
ENDIF.
ENDLOOP.

SORT INT_PETROL1.
DELETE ADJACENT DUPLICATES FROM INT_PETROL1.

CONCATENATE 'From' ' : ' PN-BEGDA+6(2) '.' PN-BEGDA+4(2) '.' PN-
BEGDA+0(4)
' To' ' : ' PN-ENDDA+6(2) '.' PN-ENDDA+4(2) '.' PN-ENDDA+0(4)
INTO TITLE.

IF P_DI = 'X'. "TO DISPLAY PETROL ALLOWANCE ONLY
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
DIS_FLAG = 1.
ENDIF.

IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
* CASES - NO RATE GIVEN, RATE GIVEN
* CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB
SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN- BEGDA AND ENDDA = PN-ENDDA.
ENDSELECT.
IF SY-DBCNT = 0.
MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.
ELSE.
FLAG = 1.
ENDIF. "OF SY-DBCNT

IF P_RATE > 0 AND FLAG = 1. " PETROL RATE EXSISTS.
SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA
FROM PA0015
WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA
GROUP BY PERNR.

SELECT A~PERNR A~TRFST B~VORNA B~NACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.

SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
DIS_FLAG = 1.

ENDIF. "P_RATE > 0 AND FLAG = 1.

IF P_RATE > 0 AND FLAG = 0. "CURRENT PERIOD AND DATA NOT UPLOADED
SELECT A~PERNR A~TRFST B~VORNA B~NACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.

SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.

PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.

PERFORM CAL_ALLOWANCE.
ENDIF. " OF P_RATE > 0
DIS_FLAG = 1.
ENDIF. " OF CURRENT PERIOD CHECK.

ENDIF. " OF CHECK DISPLAY.

*----BDC
IF P_UPLOAD = 'X'.
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'.
LEAVE SCREEN.
ENDIF.
IF P_RATE > 0.
* IF P_RATE > 0 OR P_RATE = 0.
IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
WA_PET_ALLOWANCE-BEGDA = PN-BEGDA.
WA_PET_ALLOWANCE-ENDDA = PN-ENDDA.
WA_PET_ALLOWANCE-RATE = P_RATE.
WA_PET_ALLOWANCE-CURR = 'INR'.
INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE.

SELECT A~PERNR A~TRFST B~VORNA B~NACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
WHERE A~TRFST IN ('L1' , 'L2' , 'L3')
AND A~BET01 > 0.

SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.

PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE

LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.

PERFORM CAL_ALLOWANCE.
DIS_FLAG = 1.

SORT INT_PETROL1.
LOOP AT INT_PETROL1.
MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR,
INT_PETROL1-PALLOWANCE TO INT_0015-BETRG.
CONCATENATE PN-ENDDA+6(2) PN-ENDDA+4(2) PN-ENDDA+0(4) INTO
INT_0015-BEGDA SEPARATED BY '.'.
APPEND INT_0015.
CLEAR INT_0015.
ENDLOOP.

LOOP AT INT_0015.
PERFORM F_BDCDATA.
IF P_FG = 'X'.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'.
ELSE.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.
ENDIF.

*-- Handling Error records.
IF SY-SUBRC <> 0.

*-- Handling Error Messages
PERFORM ERROR_MSG.
MOVE-CORRESPONDING INT_0015 TO E_INT_0015.
APPEND E_INT_0015.
CLEAR E_INT_0015.
ENDIF.
REFRESH BDCDATA.
ENDLOOP.

*-- Downloading Error Records.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Errors.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = E_INT_0015.

*-- Downloading Error Messages.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Err_Msg.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = MSG.

ENDIF. " FOR CURRENT PERIOD
* ENDIF.
ELSE.
MESSAGE I455(0) WITH 'Enter Petrol Rate'.
LEAVE TO SCREEN 0.
ENDIF. " FOR PETROL RATE
ENDIF. " FOR UPLOAD

IF DIS_FLAG = 1.
INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004.
INT_LAYOUT-TOTALS_TEXT = TEXT-004.
INT_LAYOUT-ZEBRA = 'X'.
PERFORM FILL_FIELDCAT.
PERFORM GET_EVENTS_ALV.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = WS_REPID
IS_LAYOUT = INT_LAYOUT
IT_FIELDCAT = INT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IT_EVENTS = INT_EVENTS
TABLES
T_OUTTAB = INT_PETROL1
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.
ENDIF.

*&------------------------------------------------
--------------------*
*& Form GET_VALUE
*&------------------------------------------------
--------------------*
* text
*-------------------------------------------------
--------------------*
FORM GET_VALUE.

GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.
IF TEMP_NUM <> ''.
LEN1 = STRLEN( TEMP_NUM ).
PERFORM GET_PERNR.
APPEND TEMP_NUM TO EMPNO.

LOOP AT EMPNO INTO EMP_NO.

CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
EXPORTING
* DFELD = ' '
DMZEI = ','
DTYPE = 'STRING'
* DYPNO = ' '
EFELD = EMP_NO-PERNR
* FNAME = ' '
* PROGR = ' '
* IMP_DECIMALS = '0'
IMPORTING
* ERROR =
IFELD = EMP_NO1-PERNR
MESSG = ERR
* MSGLN =
.
IF ( ERR-MSGID = '' ).
APPEND EMP_NO1 TO EMPNO1.
CLEAR EMP_NO1-PERNR.
ELSE.
MESSAGE I455(0) WITH 'Could not convert employee number'.
LEAVE TO SCREEN 0.
ENDIF.
ENDLOOP.
ENDIF.

ENDFORM. "GET_VALUE

*&------------------------------------------------
--------------------*
*& Form GET_PERNR
*&------------------------------------------------
--------------------*
* text
*-------------------------------------------------
--------------------*
FORM GET_PERNR.
SPLIT TEMP_NUM AT ',' INTO EMP_NO TEMP_NUM.
APPEND EMP_NO TO EMPNO.
CLEAR EMP_NO.
SEARCH TEMP_NUM FOR ','.
IF SY-SUBRC = 0.
PERFORM GET_PERNR.
ENDIF.
ENDFORM. "GET_PERNR

*&------------------------------------------------
---------------------*
*& Form ERROR_MSG
*&------------------------------------------------
---------------------*
* text
*-------------------------------------------------
---------------------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------
---------------------*
FORM ERROR_MSG.

IF SY-SUBRC <> 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
LANG = SY-LANGU
IMPORTING
MSG = MSG-MSG1.
APPEND MSG.
CLEAR MSG.
ENDIF.

ENDFORM. "ERROR_MSG

*&------------------------------------------------
--------------------*
*& Form F_BDCDATA
*&------------------------------------------------
--------------------*
* text
*-------------------------------------------------
--------------------*
FORM F_BDCDATA.

PERFORM BDC_DYNPRO USING 'SAPMP50A' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INS'.
PERFORM BDC_FIELD USING 'RP50G-PERNR'
INT_0015-PERNR.
PERFORM BDC_FIELD USING 'RP50G-TIMR6'
'X'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RP50G-CHOIC'.
PERFORM BDC_FIELD USING 'RP50G-CHOIC'
'0015'.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'Q0015-BETRG'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P0015-LGART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.

ENDFORM. "F_BDCDATA

*&------------------------------------------------
---------------------*
*& Form BDC_DYNPRO
*&------------------------------------------------
---------------------*
* text
*-------------------------------------------------
---------------------*
* -->P_0732 text
* -->P_0733 text
*-------------------------------------------------
---------------------*
FORM BDC_DYNPRO USING VALUE(P_0732) TYPE C
VALUE(P_0733) TYPE C.
CLEAR BDCDATA.
BDCDATA-PROGRAM = P_0732.
BDCDATA-DYNPRO = P_0733.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.

ENDFORM. " BDC_DYNPRO

*&------------------------------------------------
---------------------*
*& Form BDC_FIELD
*&------------------------------------------------
---------------------*
* text
*-------------------------------------------------
---------------------*
* -->P_0755 text
* -->P_0756 text
*-------------------------------------------------
---------------------*
FORM BDC_FIELD USING VALUE(P_0755) TYPE C
VALUE(P_0756) TYPE C.
CLEAR BDCDATA.
BDCDATA-FNAM = P_0755.
BDCDATA-FVAL = P_0756.
APPEND BDCDATA.

ENDFORM. " BDC_FIELD

*&------------------------------------------------
--------------------*
*& Form CAL_ALLOWANCE
*&------------------------------------------------
--------------------*
* text
*-------------------------------------------------
--------------------*
FORM CAL_ALLOWANCE.

LOOP AT INT_PETROL1 INTO INT_PETROL.
IF INT_PETROL-TRFST = 'L1'.
INT_PETROL-PALLOWANCE = P_RATE * 100. "CHANGE TO SELECT WHEN
DISPLAY
ELSEIF INT_PETROL-TRFST = 'L2'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L3'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L4'.
* INT_PETROL-PALLOWANCE = P_RATE * 200.
ELSEIF INT_PETROL-TRFST = 'L5'.
* INT_PETROL-PALLOWANCE = P_RATE * 250.
ENDIF.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE.
ENDLOOP.
ENDFORM. "CAL_ALLOWANCE

*&------------------------------------------------
---------------------*
*& Form FILL_FIELDCAT
*&------------------------------------------------
---------------------*
* text
*-------------------------------------------------
---------------------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------
---------------------*
FORM FILL_FIELDCAT.

INT_FIELDCAT-COL_POS = 1.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PERNR'.
INT_FIELDCAT-SELTEXT_L = TEXT-005.
INT_FIELDCAT-OUTPUTLEN = 10.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.

INT_FIELDCAT-COL_POS = 2.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'NAME'.
INT_FIELDCAT-SELTEXT_L = TEXT-006.
INT_FIELDCAT-OUTPUTLEN = 25.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.

INT_FIELDCAT-COL_POS = 3.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'TRFST'.
INT_FIELDCAT-SELTEXT_L = TEXT-007.
INT_FIELDCAT-OUTPUTLEN = 5.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.

INT_FIELDCAT-COL_POS = 4.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.
INT_FIELDCAT-SELTEXT_L = TEXT-008.
INT_FIELDCAT-OUTPUTLEN = 16.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.

ENDFORM. " FILL_FIELDCAT

*&------------------------------------------------
---------------------*
*& Form GET_EVENTS_ALV
*&------------------------------------------------
---------------------*
* text
*-------------------------------------------------
---------------------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------
---------------------*
FORM GET_EVENTS_ALV.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = INT_EVENTS[]
EXCEPTIONS
LIST_TYPE_WRONG = 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.

READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME =
SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WS_EVENTS-FORM = 'TOP'.
MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.
ENDIF.

ENDFORM. " GET_EVENTS_ALV

*&------------------------------------------------
--------------------*
*& Form TOP-OF-PAGE
*&------------------------------------------------
--------------------*
* text
*-------------------------------------------------
--------------------*
FORM TOP.

*-- ALV Declarations

DATA: WS_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.

*-- Title

WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TEXT-009.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.

WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TITLE.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.

WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.

WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = WS_HEADER
I_LOGO = 'LOGO'.

ENDFORM. "TOP-OF-PAGE

List of Employees Who Have Completed Certain Yrs of Service

*&---------------------------------------------------------------------*
*& Report ZPV003HR_ANIV_EMP
*&---------------------------------------------------------------------*

REPORT zpv003hr_aniv_emp .

TABLES: pernr.
INFOTYPES: 0002,
0001.

DATA: age TYPE d,
serv TYPE d,
curdate TYPE d.

DATA: years TYPE d,
enddate TYPE d .

DATA: BEGIN OF int_empinfo OCCURS 0,
pernr LIKE p0002-pernr,
nachn LIKE p0002-nachn,
vorna LIKE p0002-vorna,
gbdat LIKE p0002-gbdat,
begda LIKE p0001-begda,
emp_age TYPE d,
emp_serv TYPE d,
END OF int_empinfo.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS: 5_years RADIOBUTTON GROUP g1 DEFAULT 'X',
10_years RADIOBUTTON GROUP g1,
15_years RADIOBUTTON GROUP g1.
*curdate type d DEFAULT '00050101' .
SELECTION-SCREEN END OF BLOCK block1.


START-OF-SELECTION .
IF 5_years = 'X'.
curdate = '00050101'.
ELSEIF 10_years = 'X'.
curdate = '00100101'.
ELSEIF 15_years = 'X'.
curdate = '00150101'.
ENDIF.

GET pernr.
PERFORM get_0002.
PERFORM get_0001.
IF int_empinfo-emp_serv NE '00000000'.
APPEND int_empinfo.
ENDIF.

END-OF-SELECTION.

IF int_empinfo[] IS INITIAL.
WRITE:/ 'NO EMPLOYEE WITH', curdate+2(2), 'YEARS OF SERVICE' COLOR 6
.
ENDIF.

PERFORM write_empinfo.


*&---------------------------------------------------------------------*
*& Form get_0002
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_0002 .

rp-provide-from-last p0002 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'. "record found

age = sy-datum - p0002-gbdat.

MOVE:
p0002-pernr TO int_empinfo-pernr,
p0002-vorna TO int_empinfo-vorna,
p0002-nachn TO int_empinfo-nachn,
p0002-gbdat TO int_empinfo-gbdat,
age TO int_empinfo-emp_age.

ELSE.
REJECT.
ENDIF.


ENDFORM. " get_0002

*&---------------------------------------------------------------------*
*& Form write_empinfo
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_empinfo .

LOOP AT int_empinfo.
WRITE:/
int_empinfo-pernr,
20 int_empinfo-nachn,
35 int_empinfo-vorna,
50 int_empinfo-gbdat,
75 int_empinfo-emp_age+2(2),
85 int_empinfo-emp_serv+2(2) .

ENDLOOP.


ENDFORM. " write_empinfo
*&---------------------------------------------------------------------*
*& Form get_1001
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_0001 .
rp-provide-from-last p0001 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'. "record found

enddate = p0001-endda .
years = sy-datum - p0001-begda.
IF years > curdate AND enddate >= '99991231' .

MOVE:
years TO int_empinfo-emp_serv.
ENDIF.
ELSE.
REJECT.
ENDIF.
ENDFORM. " get_1001

TOP-OF-PAGE.
WRITE:/
'EMP_PERNR',
20 'LAST_NAME',
35 'FIRST_NAME',
50 'DOB',
75 'EMP_AGE',
85 'EMP_SERVICE' .
ULINE.

Getting description of RFC method arguments

Subject: HR: Getting description of RFC method arguments

Is there some documentation out there for translating the arguments for the
RFC methods after COM-enabling them via the DCOM connector? An example is, I
have created a COM object with, amongst others, the BAPI_PERSDATA_GETLIST
RFC. The second, required, argument for the GETLIST method is displayed as
personaldatakey - I have no idea what this argument translates to in SAP. Is
it an infotype? A data field? any help would be greatly welcome.

Regards,

-----Reply Message-----
Subject: RE: HR: Getting description of RFC method arguments

All RFCs and BAPIs (a form of RFCs) have IMPORTING, EXPORTING and TABLES
parameters. I believe, that is what you refer to when you speak of
arguments. Use transaction SE37 in SAP to display the function module.
Enter the name (in your case BAPI_PERSDATA_GETLIST) and select documentation
somewhere in the menu. If you are lucky, you will find helpful hints. If
not - and not all modules are documented well - you can look at the
parameters in the respective section, e.g., IMPORTING. You will find a
reference variable or domain there. You can probably double-click on it or
use SE11 (data dictionary) to find out the purpose of the variable. Again,
if you are lucky you find a description or even documentation. If you are
totally unlucky and nothing yields a result, go into the source code. You
will see a comment block of all the parameters. You can look through the
code to see, how it is used. This requires a little bit of understanding -
both ABAP and the functionality, but if you are programming for RFCs you
should be somewhat familiar and able to understand the overall meaning of
the parameters by reading through it. Don't worry about the detail level,
just get the big picture. There is a good chance you find some comments in
the source code, too. If you are lucky, they are in English.

You see that a lot depends on the grace of SAP as far as explanations and
documentation are concerned. But you will always have the source code to
look at, which is only helpful in understanding what the call does. I
generally recommend looking at the code you want to call on a high level
anyway.

Hope this gets you started.

Best regards,

HR report from Cummulate results table

----Original Message-----
Subject: HR report from Cummulate results table

Very new to HR-ABAP - need report desperately - I can see the totals I need when I use the following path but don't know how to get at them for the report. We are using 4.0 w/4.6 GUI frontend.
Path is: Human Resources->Payroll->key in 10->key in 10->Tools->Payroll Results->Display--> Dbl click on a week-->select CRT-->dbl click on the name Cummulated Results Table. All the totals I need for the report are there.
Report column headers are YTD totals for:
reg/hrs...O/T hrs...Prm/Hours...Total YTD/Hrs...Reg/Cost...O/T
Cost...Prm/Cost...Standby/Cost...Misc/Cost...Total YTD Cost
The total hrs & YTD total costs I can sum from the fields shown in this table. I just can't figure out how to extract them from there or how they got there.
Can somebody please help - time is running out for me - I'm already at my deadline. Everytime I try something- it's a dead end.

-----Reply Message-----
Subject: RE: HR report from Cummulate results table

A program has to be written to extract the CRT data based on the particular employee and payroll period you are getting.

Try this.

Example program to read SAP payroll results using GET PAYROLL

If you need to do a form to report wages and the data is stored in the PCL4 Cluster.

You can look at this example report or form that retrieves data from this cluster based on several parameters that are entered when the report is executed online (like employee number and tax year).

In SE38 or SA38, execute the sample program EXAMPLE_PNP_GET_PAYROLL

Report RHINTE00 for Integration between OM and PA

Have a problem while running the report RHINTE00 for integration between OM and PA.

1) After running RHINTE, the text in present and previous positions has got truncated to a maximum of 19 / 20 characters.

2) The relationship between position and person for the previous position held by the person is not getting delimited in the OM module i.e., if a person w.e.f. 01.04.2005 is Manager - IT and his previous position was Associate Manager - IT then the relationship between the person and the previous position should have be delimited as on 31.03.2005. However this did not happen.

Let me comment here that RHINTE00 is to transfer data from PA to OM (not from OM to PA). For transferring data from OM to PA we use RHINTE30.

Now coming to the issues you have raised...

1) After running RHINTE, the text got truncated:

Based on your settings in t77s0 (last letter is zero)for PLOGI-TEXTO, PLOGI-TEXTS and PLOGI-TEXTC (for org unit, job and position respectively), when RHINTE00 is run, two options are possible.

a) Integration is active (an entry 'X' in t77s0): In this case the TEXT of the object (O, C or P) will be entered in the 'object abbreviation' field in IT1000. In this case the text is truncated by the system.

b) Integration is not active (an entry ' ' in t77s0): In this case the OBJECT ID of the object (O, C or P) will be entered in the 'object abbreviation' field in IT1000. (No truncation happens).

In both cases, the OBJECT TEXT is transferred to the OBJECT NAME field in IT1000.

2) The previous relationship between position and person not getting delimited:

Please note that you can run the report with three different selection options with regard to delimitation of old holder relationships.

1. None
2. Only positions from IT0001
3. All.

(Please see 'Report Specific Settings' area in the selection screen.

If you select the second option, ie 'Only positions from IT0001, the old 'holder' relationships will be delimted in IT1001.

(But please keep in mind that incase you have the scenario where a person occupies more than one position, only one holder relationship for each IT0001 record selected (the one that is saved in IN0001) will be delimited.

Reports Involved in Payroll

What are the reports involved in payroll?

Kindly note down the some of the reports used in payroll

1) You can use report RPCSC000 (Scheduler for Parallel Accounting) to split the personnel numbers into small sets and run payroll in parallel in the background. In this way you reduce the payroll runtime.

2) To create payroll jobs call the Scheduling of Payroll Jobs report (RPCPRC10) using this function.

3) Rreport RPCDTBX0 (Preliminary Data Medium Exchange Program for Separate Payment Run) has to be created for a preliminary document for a wage types

4) Use Report RPUCTP00 (Generation of Payroll Periods) to generate the payroll periods for every period parameter that you have assigned to a payroll area

5) Check the payroll results for an employee using the report Displaying the Payroll Results H99_DISPLAY_PAYRESULT). You can use this report to display the contents of all tables in which the system has saved data for the employee's payroll result.

6) RPDLGA20 report generates a list of the wage types available for a selected country.

Structural Authorization vs Role Authorization

What is the difference between sturctural Authorization and Role Authorization. In what situation we need to maintain the Structural Authorization? For Role Authorization, we maintain it in PFCG. Where and how do we maintain Structural Authorization?

The role authorisation is used for regular authorisation. for example Transaction codes : PA20, PR20, CAT2,CADO, PPMDT, PR05 - It is done based on role assigned by Basis group.

The user id mentioned in IT 0105 is assigned to the TC PFCG

The structural authorisation is typically belongs to HR module. It has both benefits of positive and negative tests.

Steps to do Structural Authorisation:

Step1 : TC OOAC
Activate the Structural Authorisation switch

Step 2 : TC OOSP
Create Structural Authorisation profiles

Step 3 : Assign Structural Authorisation profile to user Id
TC : SE38 and assign report RHRPROFL0 enter object id for example ( Org unit )

Assign regular Role authorisation..

Reporting on Infotypes limited by security

----Original Message-----
Subject: Reporting on Infotypes limited by security

I have set up security so that you can only access certain subtypes in an infotype. When I view someones record from PA20 it only shows me the subtypes I have access to from security, but in ABAP query when I select these subtypes nothing comes back in the report. Is this because the report loops round the Infotype finds a subtype I can not access so refuses access, if so how can I get round this as you can see them in PA20 ?

Cheers

-----Reply Message-----
Subject: RE: Reporting on Infotypes limited by security

If you are using "ABAP QUERY" you will need to reference the logical database which provides the same security
checking...also look in the SU53 after the report execution to see if ther failure report says something of use... You may also have
to debug the code in the QUERY, HR acts differently than other security

-----End of Message-----

Main HR Authorization Object for Security

Some of the main HR authorisation objects are:

Object: PLOG Personnel Planning
Fields: PLVAR Plan Version
OTYPE Object Type
INFOTYP Infotype
SUBTYP Subtype
ISTAT Planning Status
PPFCODE Function Code

Definition:
The present object is used by the authorization check for PD data.

Field Details:
PLVAR - Plan version This field defines which plan version(s) the user may access.
OTYPE - Object type This field defines which object types the user may access.
INFOTYP - Infotype This field defines, which infotypes, that is, attributes, of an object the users (generally) may access.
SUBTYP - Subtype This field determines which subtypes the user may access for given infotypes.

Relationships are special subtypes for infotype 1001. Consequently, the relationships for which a user should have access authorization can also be limited in this field.
ISTAT_D - Planning status This field determines in which planning status the user may access information.
OKCODE - Function code This field defines for which type of information processing (Display, Change ) the user is authorized.
The possible values are defined in table T77FC. This protection against unauthorized access is extended by the structural authorization check. Two types of function codes are distinguished in HR management. By marking the processing method Maintenance in table T77FC the function codes are indicated, with which objects may be maintained within the structure; Otherwise, only Display is allowed. The function code has effects in connection with the structural authorization. In table
T77PR, authorization profiles can be indicated which are to have maintenance authorization for the structure. Without this authorization, you can only display structures. Consequently, the overall authorization results from the intersection between basis authorization and structural authorization.

Object: P_ABAP HR: Reporting

Fields: REPID ABAP Program Name
COARS Degree of simplification for authorization check

Definition:
The authorization object HR reporting (P_ABAP) is used in many ways:
HR Reporting with HR Reporting are reports with the RE.SAPDBPNP logical database PNP .
Report: RPUAUD00 Logged changes in infotype data
Processing person-related data using payment medium programs from Accounting.
To 1. You can use the relevant authorization for these objects to control how the objects UO.P_ORGIN HR: Master data (P_ORGIN), UO.P_ORGXX HR: Master data - extended check (P_ORGXX) and CHAP.OHIX0010 structural authorization check are used in specified reports to check the authorization for INFTY HR infotypes . In this way, you can carry out a fine-tuned control on reports for infotype authorization. This can be useful for functional reasons or to improve
performance at runtime of the corresponding reports.
For this object, specify the report name(s) and the degree of simplification to be used for the authorization check.

Note:
Note that this object differs from the object UO.S_PROGRAM ABAP: Program run checks . The latter is used for general program authorization checks. In HR reports, these checks are carried out in addition to the HR infotype authorization check. HR: Reporting , however, overrides the HR infotype authorization check for selected reports, with the result that the authorization checks are weakened or completely switched off.

Examples:
In your company, the authorization for infotypes is, for example, independent of the authorization for specific organizational units (one administrator may be authorized to access address, personal and education data only for personnel area 0101 - but not for address data in personnel area 0101 and personal data in personnel area 0102). If you enter 1 in the Degree of
simplification field, the above facts are taken into account in the specified report and the check is carried out more quickly for a user with this authorization. If certain HR reports are not critical (telephone lists etc.) and authorization protection is not required, enter the report name and = * in the Degree of simplification field. The system then checks whether the person starting the report is authorized to do so (object - ABAP/4: Program run checks), but performs no other checks (object - HR: Master data).

In your company, one user may have access to all HR infotype data. For this user, enter * in the Report name and Degree of simplification fields. The system then only checks whether this user is authorized to start the report in question but not whether he/she is authorized to display the requested HR infotype data.

A time adminstrator should carry out time evaluations (report HR: Time - time evaluation (RPTIME00) for employees with the organizational key 0001TIMEXXX . For certain additional information that is needed internally (the program user either cannot see this, or can only partially see it), the Basic pay infotype (0008)must be imported, for example, to time
evaluation. To carry out time evaluation, the administrator must therefore have display authorization for the Basic pay infotype (0008). If the administrator is not to have display authorization for this infotype, the read authorization for the Basic pay infotype can be restricted for individuals with the organizational key 0001TIMEXXX for the report HR: Time - Time
evaluation (RPTIME00). For this, use the following authorization

Object HR: Master data (P_ORGIN) (two authorizations)
Infotype 0008 ' '
Subtype * ' '
Authorization level R ' '
Organizational key ' ' 0001TIMEXXX

Object HR: Reporting (P_ABAP)
Report name RPTIME00
Degree of simplification 1

In this way, a simple check is carried out for the authorization check infotype in conjunction with the report HR: Time - Time evaluation (RPTIME00): The infotype, subtype, level are checked, and then, independently, the organizational assignment (in the example, the Organizational key field) (according to degree of simplification 1 ). In report HR: Time - Time evaluation
(RPTIME00), infotype Basic pay (0008) can also be read. However, if the check is not in conjunction with the report HR: Time – Time evaluation (RPTIME00), all fields of the object HR:

Master data (P_ORGIN) are checked together, but in this way there is no read access to the Basic pay infotype (0008). TO 2. Evaluations of the logged changes in infotype data are subject to infotype authorization checks. However, usually, someone, who starts such an evaluation, has extensive authorizations. In this case, it is useful, in order to ensure improved
performance, to do without the check of individual data and instead, grant the user global authorization for logging evaluations using the report Logged changes in the infotype data (RPUAUD00). For this, use an authorization for the object, by specifying the value RPUAUD00 in the Report name field, and the value 2 in the Degree of Simplification field. To 3 The payment medium program of accounting processes, in particular, confidential personal data. In addition the check to see whether the user is authorized to start the program, a check to see whether the corresponding authorization exists for the object is also carried out, as an additionl security measure : The name of the payment medium program must be entered in the Program name field, the value 2 (or * must be entered in the Degree of simplification field.

Field Details:
Report name
COARS Degree of simplification

Object: P_APPL HR: Applicants

Fields: INFTY Infotype
SUBTY Subtype
AUTHC Authorization level
PERSA Personnel Area
APGRP Applicant group
APTYP Applicant range
VDSK1 Organizational Key
RESRF Personnel officer responsible for application

Definition:
This object is used for the applicant data authorization check. This check is carried out when INFTY applicant infotypes are edited or read. When a transaction for editing applicant data is accessed, the system first checks whether the user has the minimum authorization. Depending on the transaction this may be write authorization or read authorization ( AUTHC_D authorization level = '*' or R). If the user has the minimum authorization, a further and more detailed authorization check is carried out within the transaction itself.

Field Details:
INFTY Infotype
SUBTY Subtype
AUTHC_D Authorization level
PERSA Personnel area
APGRP Applicant group
APTYP Applicant range
VDSK1 Organizational key
RESRF Personnel officer responsible for applicant

Object: P_ORGIN HR: Master Data

Fields: INFTY Infotype
SUBTY Subtype
AUTHC Authorization level
PERSA Personnel Area
PERSG Employee Group
PERSK Employee Subgroup
VDSK1 Organizational Key

Definition:
The object HR: Master data (P_ORGIN) is used for authorization checks of personal data. Checks are performed only when INFTY HR infotypes are edited or read.
When you call up a transaction for editing of personal data, the system checks that you at least have one read authorization ( AUTHC_D authorization level R). If you do, a more specific authorization check is carried out within the transaction. In HR reports that use the

Program run checks and UO.P_ABAP HR:
Reporting must also be taken into account.
Note that values specified for the individual fields do not generally contain other values. The value ' ' must therefore be specified explicitly. The value ' ' must always be used for the subtype field (reason: the field is initial if the infotype does not support any subtypes, or if the subtype has not been specified).

Field Details:
INFTY Infotype
SUBTY Subtype
AUTHC_D Authorization level
PERSA Personnel area
PERSG Employee group
PERSK Employee subgroup
VDSK1 Organizational key

Object: P_ORGXX HR: Master Data - Extended Check

Fields: INFTY Infotype
SUBTY Subtype
AUTHC Authorization level
SACHA Payroll Administrator
SACHP Administrator for HR Master Data
SACHZ Administrator for Time Recording
SBMOD Administrator Group

Definition:
The object HR: Master data - Extended check (P_ORGXX) can be used to check authorization for personal data INFTY (HR infotypes) This check is not active in the standard system. The program switch HR: Master data - Extended check (ORGXX) can be used to add this check in the standard system or set it as an alternative to UO.P_ORGIN HR: master data . The main switch settings can be processed using transaction HR: Authorization switch (OOAC)

Field Details:
Administrator for the person being processed (stored in the
organizational assignment infotype)
SACHA Payroll administrator
SACHZ Time data administrator
SACHP HR master data administrator
SBMOD Administrator group

View of data:
INFTY Infotype
SUBTY Subtype
AUTHC_D Authorization level (write, read, write with lock indicator, unlock).

Object: P_PCLX HR: Clusters

Fields: RELID Area identifier for cluster in tables PCLx
AUTHC Authorization level

Definition:
This object is used in the authorization check when accessing PCLx (x = 1, 2, 3,4) HR files using the PCLx buffer (interface supported by HR).

Field Details:
Cluster ID: enter the cluster name in this field. Authorization level: in this field you must specify the operation to be carried out on the cluster along with the cluster ID specified above.

The values which can be entered here are R (read), U (update database) and S (export data to PCLx buffer without database update).

HR: v4.0b - Table PCL4

----Original Message-----
Subject: HR: v4.0b - Table PCL4

All,

Can anyone explain what is the significance of table
PCL4 (HR cluster 4)..? In particular, one of the key
fields RELID..? How is this cluster updated..? And
what are the possible values that RELID could have
(LA, SA, etc..)..and what do they mean..?
If someone could refer to a good document in SAP, that
would be useful.

-----Reply Message-----
Subject: RE: HR: v4.0b - Table PCL4

In 3.xx version, transparent table PCL4 stores the key to the cluster PCL4.
This cluster stores the changes made to infotype documents for personnel and
applicants. This needs to be activated in the IMG. You can infact store
field by field changes. Field RELID stores the LA - long term employee data
and LB - long term applicant data. It could also have values of SA and SB,
I've seen these used in the prenotification process of the payroll.
All the changes can be extracted and viewed using report RPUAUD00.

-----End of Message-----

Logged changes in infotype data

There is a program RPUAUD00 provided by SAP which allows us to see any changes that happens to data in an infotype through add / modify / delete. When you execute this this program and specify the employee code and infotype in the selection screen, it gives us details of when the data was changed, who changed the data and what data was changed in a particular infotype.

There are few standard infotypes like 0000, 0001, 0002 and few of your own created infotypes starting with 9 (9XXX) for which you are able to see the log through this program.

But there are certain other infotypes like 0008, 0581 for which this log is not coming.

There are some configuration or customising is to be done so that this log starts generating for these infotypes and RPUADU00 can read it.

The IMG menu path is:

Personnel Management > Personnel Administration > Tools > Revision > Set up change document

When you execute this node choose

'HR Documents - infotypes to be logged'

Add entries in this table to audit more infotypes.

Transaction class A is for HR master data, class B is for applicant data.

Extracting Daily Changes from HR Infotypes

Subject: HR: Extracting Daily Changes from HR Infotypes

I am looking for recommendations for extracting daily changes from HR and
Payroll Infotypes to populate outbound interfaces. We will have approximately
300,000 employees active and inactive implemented in our system. We are
currently reviewing a strategy to extract records based on the Updated Date from
the header portion of an infotype. Our concern is performance. The Updated Date
field is not part of the primary infotype key. We have considered putting a
secondary index of that field to help with performance.

Another strategy is to use the audit function to create log entries each time
fields have been changed on an infotype. Has anyone used this functionality?

Has anyone implemented HR with at least 100,000 employees? How did you tackle
this issue? What types of performance problems were encountered? Which
strategy is the most efficient?

Any information you could provide would be helpful.
We are running SAP Version 3.1G, on SUN Hardware with Solaris Operating system
over an Oracle database residing in UNIX.



-----Reply Message-----
Subject: RE: HR: Extracting Daily Changes from HR Infotypes

I have used the audit functionality in a couple of implementations, It
sounds like you can use for your requirements. here is what you need to do:

1. You need to configure three tables, T585A, T585B, and T585C (if you use
SM31, enter table name, do customizing, it'll take to the place in the IMG
in 3.0 versions)
2. you need to run the report RPUAUD00

There are some issues you need to think about before configuring the audit
log tables;
1. You have to analyze what you need to audit, do not audit all fields on
an infotype, and by no means audit all infotypes.
2. Depending on how much you want to audit, the log report could be
extremely big, hence putting a strain in the performance of your system
3. Frequency of the report

I hope this will help you.

Regards,

TEM - Deleting Business Events after Historically Recording

Assuming that One of your TEM users was testing in production. After having a problem with the automated correspondence. The user created a business event, booked people into the event, then followed up on the event. Unfortunately, the user also historically recorded the event.

If this happened, you need to delete the event because it will give the people which the user booked credit for having
attended an invitation only type of leadership seminar.

Using report RHRHDL00 (menu path in 4.6C : Human Resources / Training and Event Management / Tools / Database / Delete database records), you can delete data records from the Personnel Planning Database.

Of course, be careful while making the selections for deletion and do a test run first.

What is Wage Type Permissibility

What is permissibility check? What it is? Wage type permissibility?

There are two things here.

1. Permissibility of WT for infotypes---This is for permitting your WT as input in the concerned IT. Look into table V_T512Z

2. Permissibility of WT for EE subgrouping and PSA.---This for permitting your WT for the ESG and PSA. Look into table V_511_B

Wage type permissibilty is more or less a part of wage type tool for configuring wage types.

The Wage Type Tool is a method of quickly and easily configuring wage types in your system.

It consists of a series of eight wizards. These wizards are step-by-step, question-and-answer-driven screen entries that replace and simplify the previous configuration procedures. You can:

* View all the characteristics of a model wage type (for example, eligibility, valuation etc.)
* Select the individual wage type(s) you wish to copy
* Set the basic configurations for the wage type

The wage type tool will help you to:

* Reduce implementation costs
* Simplify and shorten the implementation process
* Decrease training needed for end users

To start the Wage Type Tool, enter the transaction hrwtt00main in the SAP Easy Access screen.

The system displays the tool with a list of wizards and step-by-step, on-screen instructions.

Linking Employee Photos using SAP Archive Link

Linking employee photos (Assign Facsimiles in transaction PA30) using SAP Archive link functionality (not through ESS).

### 1) You'll find the customizing settings in :-
IMG - Personnel management - personnel administration - customizing user interfaces - change screen header.

Regarding the archiving part you better ask your basis admin to set that up for document type HRICOLFOTO.

### 2) Photo in the PA IT0002 In version 4.0B it worked
1. Define physical archives using transaction OAC0 Arx. ZZ

2. Assign objects types & document types to archive & documents tables for Obj PREL , doc.type HRIEMPFOTO,
Arx. ZZ using transaction OAC3

3. Define number range using transaction OANR

4. Using transaction OAC2 define doc.typ & tech doc types for exmpl. HRIEMPFOTO - TIF

5. Create protocol for Archive link using transactions OAA3 for exmpl. Comm.prot.,version. Generate it will define
application type from list and so on.

6. In the table 585O define relevant infotype for object and document type for exmpl. for it0002

7. Using transaction OAAD create link for PERNR with relevant infotype & files on the server, which described on the
first step.

### 3)

In addition to any infotype fields you can also include passport photos of your employees in the infotype header in Infotype Header Definition view (T588J).

In the System Table view (T77S0), determine the document type with which you want to enter the passport photos in the optical archive.

V. Sridhar

I have customized by seeing photos in PA20, PA30, ... but it doesn´t run correctly. When I execute the OAAD transaction the result is ok, but when I look at PA30 I can´t see the photo.

In PA30 if I look by "Extras-> display all facsimiles" the photo appears correctly, so the photo is assigned to the employee number.

Then my problem is in the initial screen in PA20, PA30,... (when the photo doesn´t appears. I have read in other topics that you have changed the table T588J, but I don´t know what to change.

You have to use PERNR PIC somewhere in the lay-out you use !

I have changed it but the photo doesn´t appears. There is something else wrong.

From an OSS message from SAP:

For using an employee picture in the PA20/PA30 please check that you have a correct customization for the infotype header.

For further information please have a look at the corresponding point in the customizing for 'Personnel Administration' - 'Define Dynpro header'.

You have to check the table T588J and T77S0 (define document type for pictures). Additionally, remember that the photo should be in JPG format."

You may find helpful note 353949.

T588J could look like:

00 1 60 0001 PERNR PIC

The problem is solved. It was a authoritation requirement.

How to assign wage type to adjustment in compensation module?

Subject: How to assign wage type to adjustment in compensation module

Hi!

I have some problem in assigning wage type to adjustment in compensation.
In IMG( Compenation management--> Adjustment--> Define wage type models for adjustment), I set wage types for
adjustment, however, I cannot figure out how to integrate wage types with adjustment.
In "Define adjustment"(IMG) there is no column where I can set wage type.

Give me some tips!

Have a nice day!

-----Reply Message-----
Subject: RE: How to assign wage type to adjustment in compensation module

You first select the model. For the model, define the wagetype (eg. CM01). You assign the model to the adjustment type. Then when you actually do the adjustment, the system will use the wage type in creating an IT 0380 and also update 0008.

Some wage type questions

We are implementing Version 4.0B at a company in Dubai, just 'across the way' from you. I have been working on payroll in South Africa since the beginning of 1998 and this is my first implementation on the new international version, without a country-specific payroll to use as a base.
We have had some strange problems with odd HR policies and it has certainly added to the challenge of implementing payroll in the UAE.
Our mandate here as consultants is to implement SAP standard, so we are extremely limited when it comes to ABAPs or any such thing. We have used features to the best of our knowledge to do what we can, but there are a number of validations that the users wish to do, but are limited because of the project management rules on the mandate.
The ABAPs we have had approved are absolute necessities without which we would have only a half-baked implementation. I would like to if possible provide some solutions to the validation issues our client has.

I've heard through the SAP grapevine that one can use features to validate payroll master data for wage types. For example, the situation we have come across here is that the company would like to validate a number of different parts of master data for certain wage types that their employees do or don't get: For a wage type "Bachelor Allowance" (which refers to bachelor apartments - confusing!) they want to validate against the marital status of the employee. If he is single he gets X amount according to his grade, if he is married he gets Y amount according to his grade. So T510 alone is not enough. And the two wage types should be mutually exclusive, i.e. if he gets one, he can't have the other on an additional IT0014 record.
Another example is validating the employee's basic salary against a table like T510N. The problem being that T510N validates against ANNUAL salary not monthly and I cannot find anywhere in the system where one can set it to look at the amount field for the basic salary wage type rather than the annual salary field. Also this is the only table I can find that allows for validation against a range per wage type per grade (payscale group).
We are currently looking at user exits to try and make a plan, but that's a bit limited for the complexity of this issue.

If there are any features that you perhaps know of that can be adjusted to validate certain payroll master data against wage types, I would be glad of your advice.

Now I've rattled on enough, but I'd be happy to share ideas and our experiences on this side if there is any way I can help.
Thanks for taking the time to read this mail.
Best wishes for the new year ahead,
Regards,
Iris Cunningham
CDE Middle East

-----Reply Message-----
Subject: Re: Some wage type questions
From: Steers, Philip L

Most of the work you are describing is outside of payroll. Much of this can be done through the benefits module or using IT0014 or IT0015. Some of these types of payments are just dynamically generated wage types that you will have to create based n the employee sub group or other parameters that exist. For example, we have transportation allowance based on where the employee lives and where he works. We will set up a separate IT0006 subtype for these and then read them in payroll and then make a decision on them. (We will also look at what other countries are using and use them as a model
to support our needs.)

We have only seen T510N used successfully in the USA with the US payroll. The same for benefits. We have chosen to set our country code to the US because our corporate model follows the USA patterns for payroll the closest. We still will have to write a lot of PCRs, etc.

Without writing a user exit we don't know how to use table t510n, except on an annual basis. We have tried to use it on a monthly basis also.

We have written SAP about that and they said we were the only other company outside of the USA that wanted that. Now, of course, you could let them know your problems, too. (SAP will deny that we asked them about this, unless you are very clear with them, that others are really interested in using this functionality.)

We want to run payrolls with 4 currencies. And SAP has problems with that also. Watch out for fake FX gains and losses.

We are now working with 4.5A.

We are going to have quite a few dynamically generated wage types, because of which employee group or subgroup or personnel area or sub area an employee is in. (These will not appear in any IT).

How to Delete the Personnel Numbers created in the Server?

For deleting a personnel number, please follow these steps:

1. Note down the position to which the employee belongs..Go to PO13 and delete the relationship of the position with the holder.

2. Now go to PU00, enter the personnel number and execute. In the next screen, select all infotypes using F7.
DO NOT select one by one infotype and try to delete. Once all infotypes are selected, use the trash can symbol to complete the delete process.

Deleting personnel numbers in SAP HR

If you have some duplicated, personnel numbers on the system and the data is not complete.

You try to delete these and get the message "record cannot be deleted (time constraint 1)".

The fastest and simplest way to delete employees is to use program RPUDELPN.

Either that or from PA30, click to Utilities -> Delete Personnel Number.

Certain infotypes have the time constraint set so that you cannot delete them which is why it is giving you the message.

To avoid problems, use the above methods.

Change of Employee Position

During the course of a person employment, the employee may changes positions, cost centers, or is moved to another subsidiary and the organizational assignment need to be change.

Do take note that you cannot change the employee’s payroll area for a period for which the employee’s payroll has already run. You can only change the payroll area at the end of the payroll period.

In Personnel Actions, PA40 :-

1. Input the Personnel Number
2. Select Organizational reassignment and click the execute button
3. Input the Start date for the reassignment
4. Click the save button and the Position Change screen will appear
5. Save your entries

Recruitment and Joining Formalities

I would like to know that once the candidate's data has been key in, what we need to do at the time of his joining formalities. Can the data be directly transfered from the rect. module to PA module. In such a case what steps we need to follow.

Anand

If you like to transfer a candidate from the recruiting (PB) to the personnel administration (PA), you should use transaction code PA40 with action 'Hiring candidate'.

Infotype 0139 stores the PB-number of the new person.

Michael

I have completed all the entries in Rect. module. I have filled the applicant actions till "Prepare to hire", now what is to be done further in PB60. or if I am wrong, then can you explain me how it is to be done. If you can send me the flow chart that will be of great help.

Anand

Just understand that if you want to hire an applicant you can do so from PA Environment which is much advisable in case of External applicant. In case of internal applicant you can do so from both Rec. as well as PA. when the final status of applicant is "prepare to hire" you reached to final status in Recruitment and now you come down to PA environment and run the action from PA40 - Hire applicant or what ever customized action you have.

Most important is you have to have pass doors between Recruitment and Pers. Admn i.e. set integrations (here the Features needs to be activated i.e. PAPLI, PRELR, PRELI). If you have set right integrations than data can flow between Recruitment and PA. Data flow means, certain infotypes which are maintained during selection process in Recruitment will then automatically updated in PA i.e. Education, Personal details, address, Skills/Qualifications etc.

As Micheal has rightly told that Basic applicant details will be stored in infotype 0139.

Hope I addressed to your point. But I like to have one question here open for you, try to explore. "How does the system know that i am trying to hire an applicant i.e from Recruitment or directly without Recruitment process"? I put it in other way what is the difference between "Hire Employee" action and "Hire applicant" action. If you try to explore answers to these questions you will have more clarity on these sub modules.

Explanation on Deduction Rules

Deduction Rules rules according to which attendances and absences are to be deducted from the attendance/absence quotas.

EXAMPLE: Total Abscence Quota is 20 , in that 20,
Casual leave -05, Sick Leave-10, Privilege Leave-05

Now when the Employee applies for leave, which of these leave will come to picture FIRST i.e the deduction sequence from abscence quotas is determined through deduction rules.Whether first it will be deducted fromPL , OR CL OR SL

Sequence in which attendance and abscence has to be deducted from Attendance and abscence quota is based on the following criteria:

1. Attendance/absence quota types
2. Start and end of validity period of the quotas-Until which date the quota is valid
3. Start or end of quota deduction period PERIOD IN A YEAR IN WHICH QUOTA DEDUCTION IS POSSIBLE

Deduction Priority:
Here you enter the criteria, according to which sequence the system should sort existing employee quotas to make them available for deduction. You can enter the priority levels 1 to 5 for the criteria quota type, start of validity period, end of validity period, start of deduction period and end of deduction period

Collective Agreement Provisions: (CAP)

A standard agreement designates the same pay scale groups and level for both hourly wage earners and salaried employees, however the user must still be able to enter hourly or monthly values in the pay scale table.

1 – Industrial workers / hourly wage
2 – Industrial workers / monthly wage
3 – Salaried employee
4 – Non Pay scale employees
5 – Public servant

What Is The Difference Between PCR and CAP

Personnel Calculation Rule:(PCR)

It is the instructions to execute defined tasks in Time Management and Payroll. A Personnel Calculation Rules consist of one or more operations. It also contains one or more subarea. A personnel calculation rule is a frame of work instruction that is checked with the existing conditions and a resulting action is performed. The Personnel Calculation rule allows one wage type to be processed in different ways in payroll accounting. The value of the standard pay wage type should be used as a basis of valuation for hourly wage earners. The value of the standard pay wage type should be divided by the planned working hours before being used as a basis of valuation for salaried employees.

1 – Hourly wage earner
2 – Monthly wage earner
3 – Salaried employee

Collective Agreement Provisions: (CAP)

A standard agreement designates the same pay scale groups and level for both hourly wage earners and salaried employees, however the user must still be able to enter hourly or monthly values in the pay scale table.

1 – Industrial workers / hourly wage
2 – Industrial workers / monthly wage
3 – Salaried employee
4 – Non Pay scale employees
5 – Public servant *-- PaTri

General Idea About UK, US, Indian Payroll

These are the differences among Indian, U.K and U.S payrolls:

Differnce between the US and Indian payroll can be broadly categoried on two basis :-

1. For Contract Employees
2. For Salaried Employees

For salaried employees, mostly the norms are same, but most of the employees are on contract basis Therefore their classification is mainly on two grounds W2 and 1099. In W2 company pay the taxes and in 1099 employee pay the taxes.

The contract employee fee is mainly based on hourly basis for which they are billed. But the vendor takes care of the contract employee salary. This means the company send a time sheet to the vendor and vendor then makes the payment to employee.

SAP has given country specific payrolls for more than 38 countries and periodically SAP is releasing the country versions for new countries Each country specific version is called country version. When sap says country version it includes country specific civil, tax laws, contributory and other tax laws (all these details are populated in the country specific info types).

Pay roll driver and Schema:
- For each Payroll country version there is a country-specific payroll driver with the technical name RPCALCx0 or HxxCALC0 .
- For programs with the technical name RPCALCx0 , the x is replaced with a country indicator, for example, Z for South Africa D for Germany, , or X for "Other countries".
- For programs with the technical name HxxCALC0, the xx is replaced with the ISO code of the respective country, for example MX for Mexico, or G.B for U.K.

Pay roll schema:
- The payroll schema contains calculation rules to be used by the payroll driver during payroll. SAP has developed country-specific schemas which are based on standard schema X000. When it is country specific ,the first character in the name refers to the country indicator (for example, G for U.K, F for France D for Germany etc.). When you run any country’s pay roll in the sap system some common info groups which are part of international pay roll and personnel administration.

Some of them are:
- Personnel data ( address-6, bank details97 personal data-2,challenges-4 etc..)
- Actions ( 0000 info type)
- Organizational data
- Contractual and contract agreements (Company Instructions info type 0035 , Corporate Function 0034 ) Etc.,

So when run a pay for a specific country, besides general information valid for the international pay roll, one needs to enter specific details in the particular info types for example if you are running U.K pay roll you need enter The National Insurance number (NI number) used by the Contributions Agency (CA) to uniquely identify an employee in the info type 0002-personal data and if its U S pay roll there is social security number and if its south Africa it some SARS code etc.. all these are available in personal data-national features.

Apart from these they are some country specific info types for each country pay roll. For U.K pay roll there are some specific info types:
- Tax Data Info type 0065—PAYE (Pay as you earn) details are stored
- WFTC/DPTC Info type 0087- employees tax credit details are stored
- National Insurance Info type 0069 National Insurance –Info type 0069
- Pension Funds Info type -0071
- Court Orders/Student Loans (info type 0070) record for them with the appropriate court order subtype
- Court Orders/Student Loans (Info type 0070): to record and deduct student loan repayments as specified by the Inland Revenue.
- Company Cars- Info type 0442
- Offshore Tax GB -Info type 0570

This info type allows you to record an employee's tax details for Isle of Man, Jersey, or Guernsey and Alderney Offshore Social Security GB -Info type 0571 to record an employee's social security details for Jersey or Guernsey and Alderney.
Then there is SMP SSP details specific to U.K pay roll:
- SMP is Statutory Maternity pay.
- SMP is Statutory Sickness pay
- SAP -Statutory Adoption Pay and
- SPP- Statutory Paternity Pay.

The rates for SMP,SSP,SPP and SAP vary, so accordingly they need to be updated with the latest changes. Every year like Indian Tax rates , there in U.K also changes take place with regard to Tax slabs ( which needed to be reflected in PAYE.. Pay as you earn), civil and social and tax laws. In fact from Oct 2006 this year, there are going to be many changes in the various laws related to employees in U.K All this need to be populated in respective info types. Like wise U.S pay roll has got some specific info types which are large in number as it has a complex system in place.

This is general idea about U.K pay roll.

Creating Customer Specific Functions for HR Payroll

During the execution of payroll, 'Personnel Calculation Schema' (created using Transaction: PE01) is used to calculate the employee's salary. The schema comprises of funtions (created using Transaction: PE04), inorder to incorporate cutomer specific calculation routines during execution of payroll, SAP allows you to create payroll functions in customer namspace (Starting from Y or Z).

Step by Step creation of SAP Payroll Funcitons:

1) Follow the menu path
Human Resources>>Time Management>>Administration>>Tools>>Funtions/Operations
or transaction PE04. Enter a four digit name for e.g ZIABC, and press the create
button, enter the description. On creation the system proposes the name of
the routine use it, or enter a name of your choice by selecting the option 'Self-defined'.

2) During the execution of payroll some tables are filled with wage types and there amounts
to make these tables available to your routine enter the name of the table for e.g (RT or
CRT) in the input parameters, and to make the changes done to the data in the tables
avaiable to the payroll enter the name of the table in the Output parameters as well.

Input Parameters
----------------
Ctry Num Object Name
----------------------------------------------------------------
99 1 RT
99 2 CRT

and same shall be done in the Output Paramters if required.

3) Create an include in the program PCBURZ990 (using Transaction:
SE38), in which create a subroutine with the name supplied by SAP or the
name selected by you during Funtion creation,
in our case, it is FUZIABC.
Note: The program PCBURZ990 is in SAP Namespace, so an Access Key
will be required before you can proceed. But it will not be overwritten during any upgrade.

*Example of the subroutine
*-------------------------


FORM FUZIABC.
*enter the code
ENDFORM.
4) After this activate the program the Funtion and add it in the schema used for payroll processing.

Khusro Habib
SAP 4.7 ABAP Certified Consultant
SIEMENS Pakistan

Recent Topics

Content