HR Abap PDF
HR Abap PDF
HR Abap PDF
Table of Content
1 OBJECTIVE .................................................................2
2 HR ABAP PROGRAMMING ............................................2
2.1 Concepts in HR Programming ............................................. 2
2.1.1 Overview & Features in HR Programming ........................................................... 2
2.1.2 Difference from conventional ABAP ....................................................................... 2
2.1.3 Overview of PA/PD/& Integration between PA & PD........................................ 2
2.1.4 Concepts of Infotypes (Structure/Processing etc.) ............................................ 5
2.1.5 Concepts of Clusters (Import/Export etc.), cluster directory ........................ 9
2.1.6 Concepts of Macros (Import/Export etc.) ........................................................... 13
2.1.7 Retrieval of data using LDBs (PNP/PAP/APP/PCH) without LDBs. .......... 19
2.2 Personnel Administration (PA) .......................................... 20
2.2.1 Importance of Dates and periods in payroll ...................................................... 22
2.2.2 Overview of date fields and period-Ex. for period/in-period/ payroll ....... 23
2.2.3 Repetitive Structures processing .......................................................................... 24
2.2.4 Guidelines to retrieve Payroll data (Mainly US/UK/Ireland) ....................... 25
2.2.5 Retroactive accounting/ Retroactive pay calculation ..................................... 33
2.2.6 Time Management...................................................................................................... 34
2.2.7 Guidelines to retrieve Time data ........................................................................... 39
2.2.8 Benefits.......................................................................................................................... 42
2.2.9 Case Studies ................................................................................................................ 49
2.3 Utilities: ........................................................................... 49
2.3.1 List of standard Commands for Macros/ infotyes etc.................................... 49
2.3.2 HR Standard Reporting tools ................................................................................. 50
2.3.3 FAQ, Hints, Tips and tricks in HR, Do & not to do (Warnings)................... 52
2.3.4 List of HR tables & Transactions .......................................................................... 58
2.3.5 List of Standard Reports, Function modules & Utilities available ............. 58
2.3.6 Available Enhancements/User exists.................................................................. 60
2.3.7 Report assignment category/ Customising Report Selection Screens...... 62
2.3.8 Authorization checks ................................................................................................ 65
2.3.9 Views/Join/Projection.............................................................................................. 66
2.3.10 Case Studies ................................................................................................................ 72
HR-ABAP
1 Objective
The Purpose of this document is to:
2 HR ABAP Programming
2.1 Concepts in HR Programming
2.1.1 Overview & Features in HR Programming
The aim in the Human Resources component is to be able to process employee
related data according to business requirements in an effective structure.
The Human Resources module uses a system of data grouped together called
infotypes.
Infotypes mirror a quantity of connected data records; infotypes are identifiable
through a four character numerical string [e.g. infotype Addresses (0006)] and a
complete listing is included.
You can save the infotypes as time-dependent to enable a retroactive evaluation of
Employee data
The infotypes appear as an entry screen for the user, through which you can
maintain infotype records. Infotypes can be processed individually or in fast entry
mode.
In HR ABAP use of select statements significantly less than in other areas of ABAP
development, Logical databases have limited applications in other modules but are
very useful in HR. Also, you really need to understand the infotype time constraint
concept, When you cannot get the information that you need out of the logical DB
look at the function modules starting with HR* and RH*. These function modules will
provide you with multiple ways of accessing data to save time. Worst-case scenario,
use a select statement.
This explains how to use the ABAP programs, which set integration between PA and
PD/OM. They are mainly used after data conversion, bulk updates or to correct
errors caused by other programs.
Page 2 of 72
HR-ABAP
Each program is explained in detail so you can decide which ones you need to run.
To set up/fix full integration between PA and PD, they should be run in this
sequence:
Overview
It is important to realize that in PA, there are tables that contain objects from OM,
i.e. for those items displayed on infotype 0001 Organizational Assignment.
Sometimes the tables can get ‘out of step’ with those in PD – table HRP1000.
RHINTE00
This loops through all employees in PA by looking at positions on infotype 0001. It
checks the corresponding person to position relationship exists in PD (A008), if not it
is created.
RHINTE10
Generally, the program RHINTE20 will be used instead of this one. This program
loops through the PD table HRP1000. For each job, position, work centre and
organization unit, corresponding entry is created in the PA tables, which are shown
above. Run this with evaluation path o_s_p, which runs through Org units, jobs and
positions or find a suitable alternative if you wish to update work centers also. The
main difference with this program as opposed to RHINTE20 is that this one has the
option to delete items from the PA tables, which no longer exist in PD.
RHINTE20
This program loops through the PD table HRP1000. For each job, position, work
centre and organization unit, corresponding entry is created in the PA tables, which
are shown above. Run this with evaluation path o_s_p, which runs through Org
units, jobs and positions or find a suitable alternative if you wish to update work
centers also. An example output will show:
Page 3 of 72
HR-ABAP
Expand the tree items to display a list of objects that can be created:
RHINTECHECK
When the above programs have been run, use this check program, which looks
through all employees and reports any inconsistencies found between PA and PD.
Tick each item that you wish to be created, or click on the text
and click ‘select subtree’ to select them all then click to perform
Page 4 of 72
HR-ABAP
multiple updates. This program can prove to be ‘problematic’. If difficulties arise
with it, try using RHINTE10 instead.
RHINTE30
This will create an infotype 0001 record with correct entries for org unit, job,
position and work centre by looking through the organization structure. It creates a
batch job, which must be run via SM35. More details to follow.
RHCHECKV
This will check inverse relationships and create missing ones.
Infotypes:
• Time constraint 1: Exactly one valid data record of the infotype in question must
exist for the entire time that the employee belongs to the enterprise.
• Time constraint 2: No more than one valid data record of the infotype in question
can exist at any one time.
• Time constraint 3: Any number of valid data records of the infotype in question can
exist at any one time.
The prerequisites for the existence of a personnel or applicant number are infotypes
0000 Actions, 0001 Organizational Assignment, 0002 Personal Data, and 0003
Payroll Status.
Page 5 of 72
HR-ABAP
• PAnnnn for transparent tables in Personnel Administration
• PBnnnn for transparent tables in Recruitment
• HRPnnnn for transparent tables in Personnel Planning
Example: For Infotype 0000, the corresponding database table associated with it is
PA0000
T777D
T77ID
T582A T77CD
The primary key of transparent table PAnnnn consists of the following key fields:
• PERNR: the personnel number is the only unique key within a client for identifying
an employee. It is used to access the display and maintenance screens for an
employee’s master data and working time data (infotypes).
• SUBTY: subtypes are subdivisions of infotypes. An infotype’s subtypes can have
different time constraints and form their own histories.
• OBJPS: the object identification is used to make a distinction between records with
the same infotype, subtype, lock indicator, start date, and end date. For example,
the child number in infotype 0021 Family/Related Person.
• SPRPS: the lock indicator for HR master data is used to lock and unlock data
records, which enables the “double verification principle” to be put into practice. In
Page 6 of 72
HR-ABAP
accordance with this principle, at least two users are involved in the process of
writing an active data record to the database. One of the users creates a locked
infotype record, and the other user unlocks - that is, activates - the data record.
• ENDDA: end date.
• BEGDA: start date.
• SEQNR: The Sequential Number is used to make a distinction between infotype
records that have the same key and time constraint '3' (any number of valid infotype
data records at any one time). Unlike the object identification, it is assigned by the
system automatically.
Structure:
The Data Dictionary contains a Pnnnn structure for each infotype nnnn. The
infotype structure Pnnnn corresponds to the table PAnnnn. The Pnnnn structure of
the infotype is used as the field structure for the infotype entry screen (Transaction
code PA30).
• If name option is not given in the syntax then the internal table will be created
with the name p<nnnn>
• If occurs clause in not given then the size of an internal table would be 10 * size
of the structure pnnnn. That is in the place of ‘m’ it would be 10.
• If valid clause is not given then the comp1 and comp2 values will be 01/01/1800
and 31/12/9999 respectively.
• Mode n this clause can only be used with the LDB’s PCH and PNP. This addition
stops this infotype being automatically filled at the GET PERNR command.
The infotype records can be processed using the infotype structure when the report
is run.
Processing Infotypes
Processing Single Infotype Record
Page 7 of 72
HR-ABAP
We can process the Single records of an infotype using the following
macros.
Syntax:
PROVIDE * FROM Pnnnn BETWEEN PN-BEGDA AND PN-ENDDA.
ENDPROVIDE
nnnn stands for 4-digit infotype number. The relationship between the data and
the selection period is established using the PN-BEGDA and PN- ENDDA variables.
Infotype List
Page 8 of 72
HR-ABAP
0048 Residence Status
0077 Additional Personal Data
0094 Residence Status
0105 Communication
0167 Health Plans
0168 Insurance Plans
0169 Savings Plans
0170 Flexible Spending Accounts
0171 General Benefits Information
0172 FSA Claims
0207 Residence Tax Area
0208 Work Tax Area
0209 Unemployment State
0210 Withholding info W4/W5 US
0377 Miscellaneous Plans
0378 Adjustment Reasons
9001 DOD/MWR Specific Data
9002 Payroll Import Data
9003 Retirement Plan Data at Termination
9005 KRONOS Information
Each database object, for example, PCL1 or PCL2, with the type Import/Export file
consists of related areas. These areas are known as clusters, for example. RX, RD.
Cluster objects are dependent on the super ordinate database object.
Cluster objects RX, RD, B2 can be selected for the database PCL2. If the database
object has the type master data then there will be no cluster object.
Import/Export files
Importing and Exporting of data is managed with the commands IMPORT and
EXPORT These commands store objects such as fields, field strings, or internal tables
on the database, or read these from the database. Data is read from and written to
the database using a unique key. RMAC provides two macros for importing and
exporting data RP-IMP-Cn-xx and RP-EXP-Cn-xx; only these macros should be used.
Page 9 of 72
HR-ABAP
o The EXPORT command causes one or more 'xy' KEY data objects to be written to
cluster xy.
o The cluster definition is integrated with the INCLUDE statement.
REPORT ZHREXPRT.
TABLES: PCLn.
INCLUDE: RPCnxxy0. "Cluster definition
* Fill cluster KEY
xy-key-field = <value>.
* Fill data object
....
* Export record
EXPORT TABLE1 TO DATABASE PCLn (xy) ID xy-KEY.
IF SY-SUBRC EQ 0.
WRITE: / 'Update successful'.
ENDIF.
REPORT ZHREXPRT.
*Buffer definition
INCLUDE RPPPXD00. INCLUDE RPPPXM00. "Buffer management
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
...
RP-EXP-Cn-xy.
IF SY-SUBRC EQ 0.
PERFORM PREPARE_UPDATE USING ‘V’.
ENDIF.
• The IMPORT command causes data objects with the specified key values to be
read from PCLn.
• If the import is successful, SY-SUBRC is 0; if not, it is 4.
REPORT RPIMPORT.
TABLES: PCLn.
INCLUDE RPCnxxy0. "Cluster definition
* Import record
IMPORT TABLE1 FROM DATABASE PCLn (xy) ID xy-KEY.
IF SY-SUBRC EQ 0.
Page 10 of 72
HR-ABAP
* Display data object
ENDIF.
Example
REPORT RPIMPORT.
*Buffer definition
INCLUDE RPPPXD00.
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
*Import data to buffer
RP-IMP-Cn-xy.
....
*Buffer management routines
INCLUDE RPPPXM00.
Cluster Authorization
Simple EXPORT/IMPORT statement does not check for cluster authorization.
Use EXPORT/IMPORT via buffer, the buffer management routines check for cluster
authorization.
• Payroll results are stored in cluster Rn of PCL2 as field string and internal
tables.
n - Country identifier.
• Standard reports read the results from cluster Rn. Report RPCLSTRn lists all
payroll results;
• All the field string and internal tables stored in PCL2 are defined in the
ABAP/4 dictionary. This allows you to use the same structures in different
definitions and nonetheless maintain data consistency.
Page 11 of 72
HR-ABAP
• The structures for cluster definition comply with the name convention PCnnn
Unfortunately 'nnn' can be any set of alphanumeric characters.
*Key definition
DATA: BEGIN OF RX-KEY.
INCLUDE STRUCTURE PC200.
DATA: END OF RX-KEY.
*Payroll directory
DATA: BEGIN OF RGDIR OCCURS 100.
INCLUDE STRUCTURE PC261.
DATA: END OF RGDIR.
Example
REPORT ZHRIMPRT.
TABLES: PERNR, PCL1, PCL2.
INLCUDE: rpc2cd09. "Definition cluster CD
PARAMETERS: PERSON LIKE PERNR-PERNR.
...
RP-INIT-BUFFER.
*Import cluster Directory
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK SY-SUBRC = 0.
LOOP AT RGDIR.
RX-KEY-PERNR = PERSON.
UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
*Import data from PCL2
RP-IMP-C2-RU.
ENDLOOP.
Page 12 of 72
HR-ABAP
Example
Authorization Check
Authorization for Persons
· In the authorization check for persons, the system determines whether the user
has the authorizations required for the organizational features of the employees
selected with GET PERNR.
· Recruits for which the user has no authorization are skipped and appear in a list at
the end of the report.
· Authorization object: 'HR: Master data'
Introduction
Programs that process the cluster data (for example, RX) do not access the cluster
independently. The data is accessed using a defined interface created with macros.
Macro contains some part of source code, which it will be useful for number of
applications. Macro is module, which is stored
Page 13 of 72
HR-ABAP
Defining:
• Macros can also be defined as RMAC macros. The source code of these
modules is stored in the function section of the control table TRMAC. The
coding is grouped under a specific name in the table key.
According to conventions, the first two letters of the name must stand for
the application. The rest of the name is freely definable.
• When you change a RMAC macro in the table TRMAC, the reports that use this
macro are not regenerated automatically. You must regenerate them
manually.
Standard HR Macros
Page 14 of 72
HR-ABAP
o The macro RP-PROVIDE-FROM-LAST retrieves the last (latest) data record,
which is valid in the data selection period.
o The macro RP-READ-INFOTYPE retrieves the data record(s), which is valid
in the data selection period.
For every macro, whether the operation was successful or not will be checked with
PNP-SW-FOUND.
The program code pertaining to this macro is stored in the control table RMAC
o RP_PROVIDE_FROM_FRST
Prerequisites
• The validity begin date of the time period must be before or the same as the
validity end date.
• Validity start and end dates are correct (preferably of the type DATE).
• The infotype table is sorted in ascending order. Otherwise, you would receive
the first fitting table entry that might not necessarily correspond to the first
time entry.
Features
The first entry for a specified period is placed in the table header entry from an
internal infotype table.
Parameters
Page 15 of 72
HR-ABAP
4) Validity end date of the time interval
Example
ENDIF.
or
RP_PROVIDE_FROM_FRST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing' REJECT.
ENDIF.
o RP_PROVIDE_FROM_LAST
Prerequisites
• The validity begin date of the time period must be before or the same as
the validity end date.
• Validity start and end dates are correct (preferably of the type DATE).
Features
The macro RP_PROVIDE_FROM_LAST makes sure that the last entry for a
specified period is placed in the table header entry of the report output list.
Page 16 of 72
HR-ABAP
Parameters
Example:
OR
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing'. REJECT.
ENDIF.
• RP_READ_INFOTYPE
You can use the macro in all programs at any point. You can also use it in
function modules. In database PNP, an infotype is usually read with GET PERNR.
Using macro RP_READ_INFOTYPE is an exception.
You can also use the function module HR_READ_INFOTYPE. For information on how
to use the function module, see the documentation on Function Modules.
Prerequisites
• The validity begin date of the time period must be before or the same as the
validity end date.
Page 17 of 72
HR-ABAP
• Validity begin and end are correct date specifications (preferably of the type
DATE).
• The infotype table must match the infotype number.
• The program using the macro must contain the include DBPNPMAC.
Features
The macro RP_READ_INFOTYPE makes sure that all data records for a person for the
specified period are placed in an internal infotype table.
Parameters
3) Internal infotype table, containing all matching records for which the
user is authorized (this table can also be empty).
Example
INFOTYPES: 0001.
RP-LOWDATE-HIGHDATE.
DATA: PERNR LIKE P0001-PERNR.
DATA: BEGDA LIKE P0001-BEGDA, ENDDA LIKE P0001-ENDDA.
PERNR = '12345678'.
BEGDA = LOW-DATE + 15
ENDDA = HIGH-DATE - 5.
RP-READ-INFOTYPE PERNR 0001 P0001 BEGDA ENDDA.
Page 18 of 72
HR-ABAP
IF PNP-SW-AUT-SKIPPED-RECORD EQ '1'.
WRITE: / 'Insufficient authorization'. STOP.
ENDIF.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Infotype 0001 missing'. STOP.
ENDIF.
Logical database
A logical database is a special ABAP/4 program which combines the contents of
certain database tables. Using logical databases facilitates the process of reading
database tables.
To use logical database PNP in your program, specify in your program attributes.
• Date selection
Date selection delimits the time period for which data is evaluated. GET
PERNR retrieves all records of the relevant infotypes from the database.
When you enter a date selection period, the PROVIDE loop retrieves the
infotype records whose validity period overlaps with at least one day of
this period.
• Person selection
Person selection is the 'true' selection of choosing a group of employees
for whom the report is to run.
• Sorting Data
· The standard sort sequence lists personnel numbers in ascending order.
· SORT function allows you to sort the report data otherwise. All the
sorting fields are from infotype 0001.
• Report Class
· You can suppress input fields, which are not used on the selection screen
by assigning a report class to your program.
· If SAP standard delivered report classes do not satisfy your
requirements, you can create your own report class through the IMG.
Page 19 of 72
HR-ABAP
0002, "PERSONAL DATA
0008. "BASIC PAY
2. Fill data structures with the infotype records.
Start-of-selection.
GET PERNR.
End-0f-selection.
• Infotype structures (after GET PERNR) are internal tables loaded with data.
• The infotype records (selected within the period) are processed sequentially
by the PROVIDE - ENDPROVIDE loop.
GET PERNR.
PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. Endif.
ENDPROVIDE.
• Period-Related Data
All infotype records are time stamped.
Which record to be read depends on the date selection period specified on the
selection screen. PN/BEGDA PN/ENDDA.
• Current Data
IT0006 Address - 01/01/1990 12/31/9999 present
Master Data is stored in Infotypes. Infotypes are tables (for user Data entry screen)
that contain logically related employee data. Data can be stored for specific periods,
which includes current and historical.
Components of PA:
Page 20 of 72
HR-ABAP
Personnel Area: represents a division of a company code into subunits. It is an
organizational entity representing an area within an organization defined by specific
aspects of personnel administration, time management and payroll. Personnel areas
are subdivided into personnel subareas. Personnel area is specific to HR and is a four
character alphanumeric identification. E.g. Personnel area 100 is for employees in
Karnataka, 200 is for Chennai.
Employee Groups: divides or groups employees into various categories. E.g. Active
employees, Retired employees, Contractors Employee groups are used to generate
default values for payroll accounting area and basic pay.
Employee Subgroups: are further differentiated within the employee group. E.g.
Salaried employees, Hourly employees, unionized employees, Executives The
employee subgroup grouping for the payroll rule allows you to define different payroll
procedures for different employee subgroups. For e.g. you can specify whether an
employee's pay should be determined on hourly or monthly basis. The employee
subgroup grouping for the work schedule defines the validity of work schedule, and
the attendance or absence quota type determines the validity of time quotas.
Page 21 of 72
HR-ABAP
Here is a simple ABAP example of reading DATE types stored in infotype 0041.
There can be a maximum of 12 dates stored in this infotype. Here is an example of
an infotype 0041 record:
Page 22 of 72
HR-ABAP
To read through this in ABAP, the easiest way is to use the DO VARYING statement.
Here is a simple demonstration ABAP:
Note: to print the text of the date type, e.g. “Leave year entry” select from table
T548T.
REPORT ZDATES1.
TABLES: PERNR.
INFOTYPES 0041.
GET PERNR.
IN-PERIOD: The payroll period (start and end date of a period) in which a payroll
result is created or generated.
Example: For every employee payroll should be run, it may be bi-weekly, monthly,
or quarterly. Say it is monthly, then for an employee a payroll should be run for this
month and it is run next month then. For-period start date is 01/9/2003 and end
date is 30 and in-period end date will be the date it is run 15/10/2003.
In-Period View
Page 23 of 72
HR-ABAP
An in-period view is a selection of payroll results from the payroll directory (for
example, RPCLSTRD Payroll Result for Germany,) for a number of in-periods. The
payroll results that were generated for the required number of payroll periods in the
selected period are selected.
Payroll Result
For-Period View
A for-period view is a selection of payroll results from the payroll directory (for
example, RPCLSTRC Payroll Result for Switzerland) for a number of for-periods. The
payroll results that were generated in the required number of payroll periods for the
selected period are selected.
Explanation
The payroll result 1 for the payroll period (for-period) 01/1997 has the start date
01.01.1997 and the end date 31.01.1997. This payroll result was generated in the
payroll period (in-period) 02/1997.
Say, for an employee you want to know that for what all wage types an employee
is eligible for the latest period you mentioned on the selection screen.
Program:
Report zhk_repstru.
Page 24 of 72
HR-ABAP
Tables Pernr.
Infotypes 0008.
• Now knowing for what all wage types the employee is eligible.
Do 20 times varying s_wagetypes from p0008-lga01 next p0008-
lga02. If s_wagetypes-wagetype is initial.
o Here the data is stored sequentially, i.e., if the employee is eligible for 5 wage types
then all the 5 wage types are stored sequentially in lga01 to lga05 respectively. So, if
say the lga05 is initial then it is understood that, employee is eligible for only 4 wage
types and from lga05 to lga20 structures will be empty so, we need not process
further
Exit.
Else.
Write: / s_wagetypes-wagetype,
S_wagetypes-amount.
Endif.
Enddo.
Before directly going into the Guidelines to retrieve Payroll Data let us look in to the
basic concepts of the Payroll.
Introduction to Payroll
To calculate the remuneration for work done for each employee
Page 25 of 72
HR-ABAP
Payroll does not just involve the calculation of remuneration, but consists of a variety
of processes that are becoming increasingly important due to the employer’s
increased obligation to supply benefits and medical welfare. These benefits are
products of:
• Labor law
• Tax law
• Contribution law
• Benefits law
• Civil law
• Reporting law
• Information law
• Statistics law
Payroll in the SAP System: In the SAP Human Resources Management System, payroll
accounting is executed using the Payroll driver.
Process Flow:
When you access Payroll, the payroll driver calls the accompanying payroll schema, which
consists of a sequence of functions. For each activity, the individual functions import data
from internal tables and payroll relevant files.
Payroll Integration:
Payroll Driver
Payroll driver is a special report for Payroll.
SAP has developed country-specific payroll drivers, which are based on report
RPCALCx0.
The country-specific net calculation of pay must be developed explicitly for every
country.
Page 26 of 72
HR-ABAP
Separate country programs, which meet the tax and insurance requirements of the
respective country, can be created from the basic report RPCALCx0. Since the
payroll driver has a modular structure, you can use the Customizing functions to
quickly modify the payroll procedure to meet the particular requirements of your
enterprise.
Integration
Calculation rules and other reports are stored in an accompanying schema, which
also contains the activities carried out by the payroll driver during payroll. All data is
stored in internal tables and saved in files with a cluster structure.
When you access Payroll, the payroll driver calls the accompanying payroll schema,
which consists of a sequence of functions. For each activity, the individual functions
import data from internal tables and payroll relevant files.
Payroll Schema:
It contains calculation rules to be used by the payroll driver during payroll.
SAP has developed country-specific schemas, which are based on schema X000.
With country-specific reports, the first character in the name refers to the country
indicator.
For example,
D for Germany
F for France
U for USA
Example:
The classic example is the payroll for salaried employees at the end of the month
in contrast to the wage accounting of hourly workers in the middle of the following
month.
Page 27 of 72
HR-ABAP
On the Selection screen, you can give Payroll Period Parameter as per the
requirement else you can give Payroll Area, by which system calculates the payroll
period.
Payroll results are stored in cluster Rx of the PCL2. The cluster key is not
mnemonic; it contains only the PERNR (personnel number) and SEQNO (sequential
number) fields.
The internal table RGDIR (PC261 - Cluster Directory for Export and Import of
Payroll Results) contains a directory entry for each payroll result.
Payroll results can only be imported if the payroll cluster key (PC200) contains
the personnel number and sequential number.
This Function Module populates payroll results of all employees with PERNR & SEQNR
as key.
Macro Modules:
We have populated Results Directory & retrieved Sequential Number, we need
to call an import macro module for retrieving the required payroll results. For this we
Page 28 of 72
HR-ABAP
need to pass the unique identification of an Employee payroll Result i.e. rx-key-
pernr = v_pernr.
rx-key-seqno = v_seqnr.
To that import macro.
Calling Import Module: RP-imp-c2-RU.
This Macro populates all the cluster tables required for Payroll, by importing
from PCL2 Cluster Directory. After that we can loop through these cluster tables for
required fields.
Guideline to write a program, which retrieves the data for, specified country
• Get the PERNRs for which you want to obtain payroll results.
• Populate Results Directory RGDIR with PERNR & Molga (Country) calling FM
CU_READ_RGDIR.
• Get the Unique Sequential Number with PERNR, From Date & Last Date calling
CD_READ_LAST.
Integration
All data is stored in internal tables and saved in files with a cluster structure.
The system imports data to these tables and used them to calculate new data. This
data is then also saved in internal tables.
At the start of the payroll run, the system reads the values from the results
tables to the old results table (ORT). Data from the previous period is, therefore,
available in the current payroll period.
Page 29 of 72
HR-ABAP
•• Results table (RT)
Table RT contains the results of the period for which payroll has been run. The
system saves this data in the PCL2 file in cluster RX.
• PCL1
The PCL1 file contains primary information, in other words, data from the master
data and time recording systems.
• PCL2
The PCL2 file contains secondary information, in other words, derived data and all
generated schemas
Integration
When you start payroll, the system imports the relevant master data from the
Pnnnn files (for example, basic pay and tax class) and imports the time data from
the PCL1 file to the IT table.
The system imports the payroll results from the previous month from table
ORT (for example, to form averages).
The system processes this data and saves the payroll results and generated
schemas in the PCL2 file.
Payroll Control
Use
This function is used to control Payroll.
During Payroll the master data for the personnel numbers to be included in the
payroll run can not be changed for the past or present,
Page 30 of 72
HR-ABAP
Example You should not perform payroll, when master data is being processed for
the personnel numbers for which payroll should be run.
Scope of Function
• Payroll Control Record
• Payroll Status
• Payroll Area
• Payroll Period
Structure
The control record contains the following information:
• Payroll area
• Payroll status
• Payroll period
• Earliest possible retroactive accounting period
• Last change made to the control record
For example,
The system stores the date of the last payroll run performed for the employee in the
Payroll Status infotype (0003).
The system can flag an employee that was rejected in the payroll run.
Use
The system automatically creates this infotype when the employee is hired. In
general, the system updates the infotype and writes the changes to the payroll past.
Page 31 of 72
HR-ABAP
Payroll Area
A group of employees for whom payroll should be run together, and at the same
time
Use
You can perform Payroll separately for different employee groups, using different
payroll areas. This is necessary if the payroll period is not the same for all employee
groups.
Examples:
• Industrial worker (monthly, on the 4th day of next month)
• Salaried employee (monthly, on 15th day of the month)
• Company pensioner (monthly, on 20th day of previous month)
• Weekly paid employee (weekly, on Friday)
When you run payroll, you must specify the payroll area in the payroll driver
selection screen. The payroll area has the following functions:
In the Payroll Period block it is used to determine the exact payroll period.
In the Selection block it is used to select the personnel numbers that should be
grouped together during the payroll.
Structure
The payroll area contains the following information:
Payroll area text
Eg: Monthly, Weekly, and BI-Weekly
Period parameters
Its two digit numerical parameter
Eg: 01 - Monthly, 02 - BI - Weekly.
• Date Modifiers
Eg: DDMMYYYY, MMDDYYYY etc.
Payroll Period
Exact period in which the regular payroll is carried out
Its (2, 4) digit numerical parameter where first is a unit & second is Year
• A payroll period is usually a month or a week
• A 'special case' (especially in USA)
• A payroll can also be one day
Example
14-day payroll periods have been defined for your enterprise for a particular
year (2003).
The first period begins on 1 January. If you carry out Payroll for payroll period 09,
the payroll period is 01 to 15 May.
01 - 1 Jan to 15 Jan of 2003
02 - 16 Jan to 31 Jan of 2003
03 - 01 Feb to 15 Feb of 2003
09 - 01 May to 15 May of 2003
The method used for defining the payroll period is dependent on whether you are
carrying out a test run or a live payroll run:
• For a test run, you generally enter the specific payroll period.
Page 32 of 72
HR-ABAP
• For a live payroll run, the system uses the value that is in the payroll control record
as the current payroll period.
In the payroll driver selection screen, enter the payroll area for which you want to
run payroll. The system derives the exact start and end date of the payroll for this
payroll area, which are stored in the payroll area or in the payroll control record.
Example
In your enterprise, the first payroll period for 2002 begins on 1 January. It
does not matter which period parameter you use as a basis, for example weekly or
monthly, the payroll period 05 2002 can still have the following meaning:
• Weekly period parameter:
Period 05 2002 = 01-07 February 2002
Retroactive Accounting
If you change the master or time data for an HR master record for a period for which
payroll has already been run, the old payroll results must be checked in the next regular
payroll run, and, if necessary, the payroll run must be repeated.
The system automatically creates a retroactive accounting run in the payroll past
Only changes to master and time data are relevant for retroactive accounting since previous
Payroll results must be corrected.
Example
An employee’s Basic Pay is increased from $3,500 to $3,700 from Sep 1, 2003.
The payroll has already run for this employee for the period up to Oct 30, 2003.
If you change the Basic Pay record, the system performs retroactive accounting when the
next payroll runs for this employee. This ensures that the increase in basic pay, effective as
of Nov 1, 2003, is taken into retroactive consideration.
Off-Cycle Activities
Purpose
As an addition to regular payroll, which carries out payroll at fixed regular intervals, this
function enables you to carry out specific off-cycle payroll activities for individual employees
on any day.
The Off-Cycle Workbench is a special user interface in the SAP System for various off-
cycle operations.
Example
• You can pay an employee in advance before he or she takes leave.
Page 33 of 72
HR-ABAP
• You can give a bonus to an employee for special work.
• Off-Cycle Activities are not available in all country versions
Time data is used to process Payroll, internal & external reporting Payroll needs time
data to process:
• Hours worked
• Overtime
• Shift times
• Vacation
• Absence to be paid
Page 34 of 72
HR-ABAP
• Internal reporting - by management to evaluate and project costs.
• External reporting - tracking of time data for Labor Union requirement etc. For
e.g. Labor union requires statistical data concerning the amount of overtime
spent on certain shifts etc.
Time data is stored in various infotypes. This data is evaluated according to various
rules during time evalution and the processed data is transferred to payroll.
Time data is generally collected by a third party recording terminal. Time data is
recorded in various ways. E.g. Punch cards, Manual time sheets that stores hours
worked for each day along with any absences.
All the absence's and attendance in a day are uploaded into SAP and analyzed using
the pre-defined times in the employees Work Schedule rule. After processing the
time events, the system generates wage types and time types based on pre-defined
rules within the time evaluation program. These wage types and time types are then
used for Interfacing to payroll, reporting etc.
• The employee work schedule is an integral part of R/3 Time Management containing
the planned specifications for employee working time.
• An employee’s planned working time is represented in a work schedule. The work
schedule is generated from a period work schedule and a public holiday calendar.
The period work schedule comprises a set sequence of daily work schedules. The
daily work schedule contains information on a day’s working time including breaks.
Page 35 of 72
HR-ABAP
The sequence can reflect regular and variable working times. The period work
schedule is applied to the calendar, taking into account specifications in the public
holiday calendar. The work schedule rule encompasses all the specifications required
to define the work schedule.
The work schedule is used as the basis for time data evaluation.
Examples
The work schedule shows how many hours’ salaried employees must work to be
entitled to their full salary. Depending on the specifications defined for the
individual employee, any additional hours worked are identified as overtime in
R/3 Time Evaluation.
If you only record deviations to the work schedule, planned working time is used
as the basis for time evaluation.
You assign a work schedule to an employee in the Planned Working Time infotype
(0007) using work schedule rules.
• The standard R/3 System already contains public holiday calendars that include
regional public holidays. You can change existing and define new public holidays in
the public holiday list. In addition, you can change existing or define new public
holiday calendars. You assign a public holiday calendar to personnel subarea.
• Public holidays are taken into account when determining bonuses or calculating
leave, for example.
Page 36 of 72
HR-ABAP
In R/3 Time Management, there are certain infotype records that you must create for
every employee. Time management data is stored in the same master data records
used by other HR areas, such as R/3 Payroll Accounting or R/3 Personnel Planning
and Development.
• The following master data infotypes are required for Time Management:
• Organizational Assignment (0001)
• Personal Data (0002)
• Planned Working Time (0007):
You must have entered the appropriate Time Management status, determining
whether the employee‘s time data is processed in R/3 Time Evaluation or in R/3
Payroll Accounting.
• Time Recording Info (0050):
This infotype is used in R/3 Time Evaluation. It can contain interface data on the
subsystem and additional data on the employee that is relevant for time
evaluation. Employees leave entitlement is managed in the Absence Quotas
infotype (2006).
Page 37 of 72
HR-ABAP
• If an employee records his or her actual times at a time recording system, you can
view the recorded time events in the Time Events infotype (2011).
• You can use the Time Events infotype (2011) to enter or correct time events that
were not uploaded or that were incorrectly uploaded to the SAP R/3 System. You can
use list entry to enter several time events for one personnel number at the same
time.
• The infotype contains information on the origin of the record (whether it was
recorded manually or by a subsystem) and on the terminal ID, for instance.
The infotype can also store information on a different payment (premium, different
pay scale group, and so on) or a different cost center. The information can either be
entered manually or by a time recording system.
Page 38 of 72
HR-ABAP
You should not load all time infotype records from the lowest to highest system dates
Into the main memory. This would quickly lead to a memory overload, especially if a
Page 39 of 72
HR-ABAP
Front-end time recording system is connected to your HR system.
This is why time data should be read only for a specific period.
Use the infotype declaration supplement MODE N to define that the internal time
Infotype tables should be declared but not filled at the GET PERNR time point.
Later you can fill these tables using a statement with selection period parameters.
Use the following report to read time data:
REPORT RPABAP05.
TABLES: PERNR.
INFOTYPES: 2001 MODE N.
GET PERNR.
RP-READ-ALL-TIME-ITY PN/BEGDA PN/ENDDA.
LOOP AT P2001.
WRITE: / P2001-ABWTG.
ENDLOOP.
An ABAP/4 macro reads the time data. This macro uses the data selection period
Parameter of the selection screen.
Due to the time constraint of infotypes, several special features must be taken into
account when processing time data. Views of time data are generally not practical.
In time infotypes, data is determined on the basis of the validity period.
When you enter an absence record, the number of days of absence is calculated on
the basis of the absence period.
In a view, new partial periods are created without any changes being made to
infotype data. This would lead to incorrect results in time infotypes, since this data
depends on the validity period.
For example, if, a leave record extends from the middle of January to the middle of
February and 20 days of leave are calculated for this period, then a view for the
month of February would result in a leave record which extends from the beginning
to the middle of February. The number of days of leave would not have changed and
the information would be incorrect.
In master data, the time constraint is a definite feature of the infotype or subtype.
There are no time dependencies between infotypes and subtypes.
Time data is basically different. Let us assume that an employee becomes sick during
vacation. The leave record is then delimited on the first day of the sickness, and the
sickness record follows. Likewise, the system prohibits the entry of a leave record
that coincides with a sickness record. The same also applies to overtime during a
sickness. The time dependency of time infotype records is not limited only to
dependencies between records of one and the same infotype, but covers all infotypes
and subtypes. The time constraint of time infotypes is not an attribute but is defined
by the relationships between infotypes.
Moreover, certain time infotype records have specific clock-in/clock out times.
Several records may therefore exist for one infotype on a particular day. Since views
require explicit data and this prerequisite is not fulfilled by time infotypes, you should
not use joins and projections for time data.
Time infotype tables are processed with the LOOP statement since the PROVIDE
statement limits, and thus changes, the infotype begin and end dates to the data
selection period.
Page 40 of 72
HR-ABAP
Page 41 of 72
HR-ABAP
2.2.8 Benefits
The Benefits application component offers comprehensive tools for administering employee
benefits in an organization. It provides all the concepts and functions that are needed to
manage extensive and highly individual benefits packages for the employees of an
organization.
Benefits integrates to SAP's International Payroll, however, it does not integrate to every
SAP Country Payroll version.
If we want to use Benefits for a Country Payroll version that is not integrated, in conjunction
with non-SAP payroll software or an external payroll service, we must provide our own
interface for the transfer of data.
The Benefits Administration component provides the functions needed to handle the
organization's benefits administration processes. It enables us to perform the following key
activities:
ENROLLMENT
This is a process of enrolling employees of an organization for Benefit
Plans depending on their eligibility
The Enrollment function enables us to enroll employees and, where possible, make changes
to employee benefit elections as required for the following tasks:
• Enrollment of employees during an open enrollment period in plans for the coming
Season
• Enrollment of new hires in plans that are automatically offered
• Enrollment of new hires in default plans as an interim measure, until they have made
their benefits choices
• Adjustment of plan enrollments as a result of employee life or job changes
Page 42 of 72
HR-ABAP
3. Automatic Enrollment Offer and
4. Adjusted Enrollment Offer
OPEN ENROLLMENT
An open offer is the most unrestricted type of offer. It is generated by the system when you
start enrollment for a date that lies within an open enrollment period. Only those plans are
available in an open offer for which the employee fulfills certain eligibility criteria, as defined
in Customizing.
A period of time during which an organization allows its employees to enroll in new benefits
plans or change existing benefits elections
The benefits offer set up for open enrollment is valid only during the open enrollment
period. Plans available for selection during the open enrollment start on a future date,
typically at the beginning of the coming year
Example
A company allows its employees to choose their benefits on an annual basis for the coming
year. The open enrollment period is 1 Oct 1999 to 30 Nov 1999, and any new benefits
elected by employees are valid from 1 Jan 2000 to 31 Dec 2000.
Default
A plan in which employees can be enrolled before they communicate their benefits elections
to the benefits office
Default plans are typically used for giving short-term coverage to new hires and therefore
often allow little flexibility to the employee regarding the plan terms.
Automatic
A plan in which employees are enrolled without the requirement that they consent to the
enrollment or make any elections within the plan An employee is enrolled in all relevant
automatic plans at all times.
Automatic plans are often provided at no extra cost to the employee and often allow little
flexibility to the employee regarding the plan terms.
Adjusted
In the SAP System, the adjustment reason is a user-defined parameter to which certain
adjustment permissions are assigned for different types of benefit plan.
Page 43 of 72
HR-ABAP
The following are examples of adjustment reasons:
• Marriage
• New dependent
• Hiring (initial enrollment)
• Job change
Benefit Area
Benefit areas allow you to have separate administration of different benefit plan pools.
This division is primarily for administrational purposes and would not normally be used
for eligibility.
Benefit areas are set up and function completely independently of each other.
Typically, employees will be enrolled in a benefit area that groups them according to
common attributes such as country or organizational assignment.
Page 44 of 72
HR-ABAP
Benefit Category:
• Health Plans
• Insurance Plans
• Savings Plans
• Stock Purchase Plans
• Flexible Spending Accounts
• Credit Plans
• Miscellaneous Plans
These categories are predefined because the system handles each differently. In
order to reflect your own requirements regarding the categorization of plans, you
define plan types within these categories.
Benefit Category is the highest level in the Benefit Plan structure. Benefit Categories
are again divided into Plan types. Every Category may consist of one or more Benefit
Plan types.
Plan types are a control mechanism for enrollment, since the system does not allow
an employee to enroll in more than one benefit plan per plan type. This allows you,
for example, to offer a choice of regular health care from different providers under
one plan type, without the risk of accidentally enrolling an employee in more than
one of these benefit plans.
Within each plan category (for example, Insurance Plans) you should define one plan
type for each sort of benefit plan that the employee is likely to elect (for example,
Page 45 of 72
HR-ABAP
Life Insurance, Spousal Life, Supplemental Life). Thus an employee can elect a plan
from the Life Insurance as well as from the Spousal Life plan type.
Example
The following are examples of plan types for each of the plan categories:
Health Plans
Insurance Plans
Savings Plans
• Retirement plan
• Savings plan
Credit Plans
• Cafeteria plan
Miscellaneous Plans
• Company car
Benefit Plans
Page 46 of 72
HR-ABAP
The Granularity level in the Benefit Plans Structure is identified by Benefit Plans.
Many Benefit plans may be grouped together under a particular plan type. The
benefit Plans are also identified by a unique identifier, which is of a maximum of four
characters.
Ex: MEDI, DENT, VISI for Health Plans Category (MEDI Plan Type)
Benefit plans within the health plan category cover the basic health needs of an
employee. A typical health plan might provide the employee with medical, dental or
vision coverage.
The first program grouping is a method of grouping employees for purposes of macro
eligibility. The second program grouping is a second, identical method of grouping
employees into other macro eligibility groups.
The cross reference of these two groupings places every employee into a benefit
program.
First program groupings are a means of identifying a group of employees who share
a common set of benefits and eligibility criteria.
Example
An organization offers one set of benefit plans for hourly-paid employees and a
different set for salaried employees. Hourly-paid employees may enroll in medical,
dental and life insurance plans after a four-month waiting period. Salaried employees
may enroll in medical, dental, life and vision plans after a one-month waiting period.
The cross reference of these two groupings places every employee into a benefit
program.
Page 47 of 72
HR-ABAP
Eligibility
The important part in the Benefits is Identifying the all the Eligible Employees for a
given Benefit Plan.
This can be achieved using function module
Similarly to determine the Eligibility date and the Participation date of an employee
for a benefit plan we can use the function module(s)
‘HR_BEN_CALC_ELIGIBILITY_DATE’ for eligibility and
‘HR_BEN_CALC_PARTICIPATION_DATE’ for participation date.
Page 48 of 72
HR-ABAP
2.3 Utilities:
2.3.1 List of standard Commands for Macros/ infotyes etc
Some important infotypes (List)
Infotype Description
0000 Actions
0001 Org Assignment
0002 Personal Data
0003 Payroll Status
0006 Address (all types)
0007 Plan Work Time
0008 Basic Pay
0009 Bank Details
0014 Recur Pmts & Deductions
0016 Contract Elements
0015 One Time Pmts
0017 Travel Privileges
0022 Education
0041 Date Specifications
0105 Communications
0167 Health Plans
0168 Insurance Plans
0169 Savings Plans
0170 Flex Spend Account
0171 Gen Benefit Info
0194 Garnishment doc
0195 Garnishment order
0207 Resident Tax Area
0208 Work Tax Area
0209 Unemployment State
0210 W4/W5 Withhold Info
0216 Garnishment adjust
0221 Payroll results adjust
0234
0267 Off Cycle One Time
Page 49 of 72
HR-ABAP
0377 Miscellaneous Plans
Time Management
2001 Absences
2002 Attendances
2005 Overtime
2006 Absence Quota
2007 Attendance Quota
2010 EE Remuneration
Reporting Tools
• HIS : Reporting tool that gives you easy access to existing reports
• InfoSet Query : Enables to create your own reports, with no programming skills
• SAP Query : Enables to create your own reports, with no programming skills
InfoSet Query:
You can use InfoSet Query to report on data from Human Resources (HR) by
using InfoSets based on HR logical databases (PNP, PCH, PAP).
InfoSet Query is used in HR to create reports to meet requirements that are not
satisfied by standard reports. By selecting selection fields and output fields, you can
access data stored anywhere within the Human Resources System. You do not
require programming skills to create reports using InfoSet Query.
InfoSet Query has been integrated with HR information systems to enable you to
perform ad-hoc reporting; that is, you can create and save queries in the standard
query area. However, there is no transport link to the Workbench Organizer. In this
context, InfoSet Query is known in HR as Ad Hoc Query.
Before data is output, a set of objects is selected for which you can output data
as required. You can edit the selected set of objects before output. For example,
Page 50 of 72
HR-ABAP
you can display the list of objects, display details on individual objects, and use
the set of objects as a new reporting set, or relate two sets to each other.
In basic mode, the report’s list of results is output immediately without a hit
list being generated first.
This method of working has the advantage of enabling you to use all InfoSet
fields for selection purposes. Working with object selection restricts these
options.
The following sections describe how to work with object selection. Always use object
selection to create reports for HR. If you require further information on how to work
with InfoSet Query in basic mode
Integration
• You can use InfoSet Query to continue processing and report on sets of
persons selected using Manager’s Desktop or HIS. You can start InfoSet
Query directly from these applications. The selected set of persons is
transferred to InfoSet Query as a reporting set.
• You can branch from InfoSet Query to general reporting. In this case, you
only use the first InfoSet Query level, that is, you select an object set. To
report on this hit list, you use a standard report.
• You can enhance queries created using InfoSet Query by adding features that
are only supported by SAP Query. If you require further information.
Features
If object selection is switched on, working with InfoSet Query consists of two steps:
• In the first step, you select a set of objects (= hit list) in accordance with
selection criteria that you can specify as required. You can then process the
hit list. You can also use InfoSet Query to create two hit lists. You can add
them together, subtract one from the other, or use them to create
intersections.
• In the second step, you output data as required for the objects selected in the
first step. You can display and forward reporting results using the following
options: you can choose a type of output list (basic list, statistics, or ranked
list), and you can determine how data is output to the full screen (for
example, SAP List Viewer, standard list, spreadsheet, word processing). On
the InfoSet Query screen, data is always output to SAP List Viewer.
Furthermore, the preview of output includes formatting options such as
summation and sorting.
Page 51 of 72
HR-ABAP
2.3.3 FAQ, Hints, Tips and tricks in HR, Do & not to do (Warnings)
FAQ:
4. What are the logical Databases that we use in the HR? And the difference
between them.
A. 1. PCH: Organizational Data
2. PNP: For personnel Data
3. PAP: Application Data
Page 52 of 72
HR-ABAP
It runs RHCOPL00. All or any portion of the plan maybe copied and manipulated and
then copied back in to the active plan.
10. When you create an infotype it creates screens, on what basis it creates
the screen elements?
A. On the basis of the PS structure that we create while creating an infotype.
11. How can we configure the options for the Assgn Form. No. field on
Infotype 210. It is the alternate formula to assign tax field and we have
been unable to locate the table in the IMG to edit the options.
A: Options for the BSI Tax Formula cannot be configured.
Possible entries are available in BTXFORM, and they depend on the 'tax authority'
(BTXAUTH) and the 'tax type' (BTXTAXT). Use data dictionary to check existing
entries. This data comes from BSI. Tax calculations are done in the
BSI programs (via RFC from the USTAX function in the payroll schema).
12. How many types of screens are created while you create an infotype
A. 1. Single screen, 2. List Screen
Page 53 of 72
HR-ABAP
13. We are using the US HR/PAYROLL module. We are able to create the
entry to credit the accrued payroll account. But our check writing process
does not produce any accounting entries when we create a paycheck or run
our EFT process (RFFOUS_T). Should RFFOUS_C produce an accounting
entry to debit the payroll payable account and credit the cash account?
A: RFFOCUS_C does not produce any accounting entries. During the FI/CO interface
run, 559 wage types may be posted to your cash account
15. We are using the PAI user exit in MP000800 screen 2000 to modify the
BET01 field. After modifying the value, the value is not re displayed.
However the updated value is saved on commit. Why the value is not
displayed after modification?
A: Yes. It is true. You may have to apply OSS
16. I have a requirement in which I have to display the free text associated
with an entry in infotype 0028. Until now I've just gone nuts debugging the
code. Can you please let me know how to do it?
A. Can you be more specific here? I have never used 0028 but in investigating a
system with PCC loaded, none of the subtypes have free text associated with them.
Is it possible that you are speaking of something attached via object services? If so I
can give you code that will read those items (hint: look at table SRRELROLES and
SOOD). If it is not that then please tell me which subtype you are looking at and
what screen field the free text is in. I can give you the answer at that point.
17. I have copied report HRBEN0074 and now I want to change the
currently displayed amount coverage from bi-weekly to monthly. How can I
do that?
A. I assume you mean bi-weekly costs since coverage does have a biweekly or
monthly amount. A quick look at the program tells me that you would need to modify
ALV_ITAB around line 260 and change the field you wish to convert into the correct
amount. The field you are looking for is probably either ERCST or ACCST.
18. SAP doesn't allow two actions on the same day. There are occasions
where a person could be ending maternity leave and starting a career break
on the same day. Any suggestions on how to overcome this?
A. SAP cannot store two infotypes of time constraint 1 with the same subtype on the
same day, because the date delimitation is the same. One of the infotypes would be
overwritten. Because there are many occasions when an employee may experience
multiple personnel actions on the same day, SAP created "Additional Actions"
(infotype 0302) to capture these additional actions. This infotype cannot be
maintained directly, but it is located for viewing at the bottom of the Actions infotype
Page 54 of 72
HR-ABAP
(0000). To take advantage of this functionality, you need to set it up using the
following IMG path:
Personnel Management -> Personnel Administration -> Customizing Procedures ->
Actions ->Set up personnel actions
Activations "Additional Actions" should be activated for all personnel number ranges.
This will allow SAP to process multiple actions on the same day.
Tips:
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).
TABLES: PERNR,
PCL2.
*----------------------------------------------------------------------*
* INCLUDE ZHR_PCL2_CU_DATA - Payroll results. *
*----------------------------------------------------------------------*
* Data declarations for the IMPORT of database PCL2 for cluster RU. *
*----------------------------------------------------------------------*
Page 55 of 72
HR-ABAP
INCLUDE STRUCTURE PC201. "Technical Version
DATA: END OF RU-VERSION.
* Cumulated-result table
DATA: BEGIN OF CRT OCCURS 30.
INCLUDE STRUCTURE PC22Y. "Cumulated result table (USA)
DATA: END OF CRT.
GET PERNR.
CHECK SY-SUBRC = 0.
LOOP AT CRT.
Process crt data.
ENDLOOP.
ENDLOOP.
3. Any changes that are done to infotypes can be known by running the
programming RPUAUD00
Page 56 of 72
HR-ABAP
When you execute 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 configurations or customizing is to be done so that this log starts
generating for these infotypes and RPUADU00 can read it.
Personnel Management > Personnel Administration > Tools > Revision >
Set up change document
When you execute this node choose ’HR Documents - infotypes to be logged'
Assuming that one of your team users was testing in production After having a
problem with the automated correspondence The user created a business event,
booked people into the event, and 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
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.
Page 57 of 72
HR-ABAP
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.
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.
"List of HR
tables.doc"
Page 58 of 72
HR-ABAP
Vesting Percentages (Report RPLBEN06)
Changes in Benefits Elections (Report RPLBEN07)
Flexible Spending Account Contributions (Report RPLBEN08)
Changes in Eligibility (Report RPLBEN09)
Employee Demographics (Report RPLBEN11)
Changes in Default Values for General Benefits Info (Report RPLBEN13)
Costs/Contributions for Miscellaneous Plans (Report RPLBEN15)
Stock Purchase Plan Contributions (Report RPLBEN16)
Benefit Election Analysis (Report RPLBEN17)
Contribution Limit Check (Report RPLBEN18)
Enrollment Statistics (Report RPLBEN19)
Create Payment List Report (RPUBENPAYRQ)
Actual Hours report (RPUBEN47)
Time Management
RPTQTA10 Display Leave Quotas
RPTQTA00 Bulk Leave Quotas Update
Transfer of Remaining Leave from Infotype 0005 to
RPTLEACONV
Infotype 2006
Page 59 of 72
HR-ABAP
RSABAPIV Lists all ABAP commands
RCCLBISC Display contents of logical filename
RPUTRBK0 Updates infotype 0003 dates after data transfer
RPUEUSUP Activate Additional Actions infotype 0302
RPUDEL20 Deletes payroll results (be careful!)
RPDSYS00 Display System Documentation
RSBDCSUB Release batch-input sessions automatically
RSUSR006 List users last login
RSPARAM Display all instance parameters
RPABRIDD Deletes data in payroll infotypes
RPUPROTU Maintain/delete the log of report starts
RPINCL10 Use RPINCL10 to search through ABAP source code
RPCIFU03 Move TemSe Unix file (e.g. BACS transfer) to PC file
RPLTEMV0 File transfer between TemSe and disc
Function Modules
HR_READ_INFOTYPE
HR_PERSONAL_WORK_SCHEDULE
HR_WORK_SCHEDULE_TIMES
HR_PERSON_INIT_WORK_SCHEDULE
HR_PERSON_READ_WORK_SCHEDULE
CU_READ_RGDIR
REPORT ZENHANCE .
Page 60 of 72
HR-ABAP
Page 61 of 72
HR-ABAP
WRITE:/(95) sy-uline.
LOOP AT i_tab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
Name = i_tab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 i_tab-obj_name HOTSPOT ON,
21 sy-vline,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE i_tab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:’, sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
* Takes you to the SMOD TRANSACTION ON SINGLE CLICK
AT LINE-SELECTION.
Get Cursor field v_field.
CHECK v_field (5) EQ 'I_TAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD'.
Page 62 of 72
HR-ABAP
This is a sample selection screen from a program/report that runs from Personnel
Administration. Specifically, this means that the program is based on logical
database PNP.
It is possible to amend this basic selection screen to suit your needs, for all programs
that have 'PNP' as the logical database. If you have not worked with logical
databases before and do not understand this part, them it's fairly safe to say that
most PA programs and reports ARE based on PNP. Usually you can see this, as the
selection screen looks very similar to the one above.
Lets look at the example above: perhaps we would like the date selection to be just
for a specific 'key date' and we want to just make the personnel number, personnel
area, subarea and employee group to be selection fields like this:
Page 63 of 72
HR-ABAP
Remember, this can be done for your own programs, and SAP standard ones without
making a 'correction/repair'. It can be useful for amending programs like the payroll
calculation driver, remuneration statements, and many of the PA reports.
First, you have to know the program name. If you do not know it, go to the
selection screen you wish to change, and click to System - Status, and note the
program name shown in the box:
Page 64 of 72
HR-ABAP
Now for the configuration there are two steps to defining a ‘special’ selection screen
for a program/report:
1. Define a new report category (defining which fields and dates are used)
2. Assign the new category to the ABAP program
"Defining a new
report category.doc"
This example demonstrates how to place the Personnel Area and Cost Centre values
into the Organizational Key field. A full explanation and demonstration of a more
complex scenario is due for publication in the main knowledge library shortly.
Background
Purpose
"Configuration of
authorizations.doc"
Page 65 of 72
HR-ABAP
2.3.9 Views/Join/Projection
Views Introduction
When evaluating data, we distinguish between the logical and the physical view.
The physical view corresponds to the form in which the infotype data is stored in the
HR tables. This data is stored in infotype records with a validity period.
In the logical view, the validity periods of individual fields are determined for several
infotype records. For example, for an evaluation, the time period during which an
employee worked at a particular job may be important, irrespective of whether a
company code, personnel area or cost center change occurred during this time.
Data from several infotypes can also be provided for a specific partial period. When
calculating partial payroll periods, it is especially important that data on basic pay,
work schedule and cost distribution are provided for the relevant partial period.
Join
A join processes records from two or more infotypes. The data from these infotypes
is provided for a specific partial period.
Example We would like to know in which time period an employee worked at which
job and at which address he or she resided during this time.
If the address and work center data are provided for specific partial periods, the
following cases result:
Page 66 of 72
HR-ABAP
January - April Hamburg / programmer
The partial periods for infotypes Pmmmm and Pnnnn as well as for all other infotypes
of the join are defined in the fields BEGDA and ENDDA.
The data of each infotype in the join must be available during the entire validity
period of the infotype. The time periods of infotype records may not overlap;
therefore, the join may not contain infotypes with time constraint "three".
The time periods of records overlap if an infotype is read without any subtype
restrictions. For example, the Address infotype has the subtypes Permanent
residence, Temporary residence and Home address.
Time periods will ultimately overlap if all addresses are read. Therefore, you must
always select a subtype for a join, and this subtype may not have the time constraint
"three".
The program code for the above join for work center and address data is as follows:
REPORT RPABAP03.
TABLES: PERNR.
INFOTYPES: 0001, 0006.
GET PERNR.
PROVIDE * FROM P0001
* FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA
WHERE P0006-SUBTY eq '1'.
WRITE: / PERNR-PERNR, P0001-STELL,
P0006-STRAS, P0006-BEGDA, P0006-ENDDA.
ENDPROVIDE.
Sometimes no data is available for a particular infotype in the selected partial period.
Infotype validity periods may not overlap but gaps are permitted.
For example, gaps can occur when personal data is joined with address data:
Personal data
Page 67 of 72
HR-ABAP
January 1960 - May 1998 Miller
Address data:
Only personal data is available in the first partial period. Since the record does not
provide the required information, the join's function of providing data from all
associated infotypes has not been fulfilled.
The variables Pnnnn_VALID recognize that only incomplete data is available for a
particular partial period.
This variable is formed when the report is run for each Pnnnn infotype included in a
join.
If data exists in the partial period for the Pnnnn infotype, the variable Pnnnn_VALID
is filled with X.
REPORT RPDEMO03.
TABLES: PERNR.
INFOTYPES: 0002,
0006.
GET PERNR.
PROVIDE * FROM P0002
* FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA
WHERE P0006-SUBTY = '1'.
IF P0006_VALID EQ 'X'.
WRITE: / PERNR-PERNR,
P0002-BEGDA DD/MM/YYYY,
P0002-ENDDA DD/MM/YYYY,
Page 68 of 72
HR-ABAP
P0002-NACHN,
P0006-ORT01.
ENDIF.
ENDPROVIDE.
A list is generated only if address data is available. The first partial period, for which
only personal data is available, is suppressed.
Projection
All data of an infotype is stored on the database with its period of validity.
When you change one or more fields of an infotype record, the system creates a new
record with a new validity period. The date on which you changed the record is the
start date of this new record.
Therefore, the data fields that are not affected by the changes contain the same data
over several infotype records and validity periods.
From a logical perspective, these fields are valid in all infotype records until they are
changed.
When seen from this logical perspective, each field of an infotype has its own validity
period.
Page 69 of 72
HR-ABAP
The following organizational assignment data is available:
If you only require the time period during which an employee performs a specific job
and not his or her personnel area for an evaluation, the following applies:
The physical view has three infotype records, the logical view one.
To create meaningful evaluations and avoid redundancies, create logical views for
infotype records.
Select the infotype fields that are important for the evaluation and disregard the
others.
In the above example, the data in the other fields is invalid for the evaluation since it
is unknown which personnel area the employee belonged to from 1996 - 1998.
This view of the validity period of a group of infotype fields is known as projection.
The infotype data for a projection must be available throughout the entire validity
period. If the time periods of certain infotype records overlap, the data cannot be
clearly assigned to one period.
Therefore, you should not use projections for infotype records with time constraint
‘three’. The report for the above projection is:
REPORT RPABAP04.
TABLES: PERNR.
INFOTYPES: 0001.
GET PERNR.
PROVIDE STELL FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE: / PERNR-PERNR, P0001-STELL, P0001-BEGDA,
P0001-ENDDA.
ENDPROVIDE .
The logical validity for the activity period is included in the infotype BEGDA and
ENDDA fields.
Page 70 of 72
HR-ABAP
You can combine the two logical views of infotype data, the join and the projection.
We read the data from several infotypes and create new partial periods. We select
the infotype fields that are important for the evaluation and combine these partial
periods again.
Organizational assignment:
Personal data:
When the data from both infotypes is read concurrently, the result is:
Since we can disregard her marital status in the evaluation, we project on her first
and last names:
Page 71 of 72
HR-ABAP
REPORT RPDEMO04.
TABLES: PERNR.
INFOTYPES: 0001,
0002.
GET PERNR.
PROVIDE STELL FROM P0001
NACHN VORNA FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA
IF P0001_VALID = 'X'.
WRITE: / P0002-NACHN, P0002-VORNA,
P0001-BEGDA DD/MM/YYYY,
P0001-ENDDA DD/MM/YYYY,
P0001-STELL.
ENDIF.
ENDPROVIDE.
This report combines the associated validity periods and provides the data of
relevant infotype fields for a specific period.
Fields, which are not accessed, have their initial value in the projection.
Provision of data for a specific partial period is especially important for partial period
factoring in payroll.
If an employee's basic pay or the cost distribution changes during the payroll period,
you must calculate the salary proportionately for the resulting partial periods.
However, if the payroll administrator of the organizational unit changes, this has no
effect on payroll.
By linking a join and a projection, you can read the master data for a specific partial
period.
Page 72 of 72