ABAP Programming in HR

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 165

ABAP HR

ABAP Programming in HR

For Internal Circulation ONLY!


Rules For The Day

We are all equal in Give everyone an equal


a circle chance to speak

Listen
Respect each Deeply
one’s truth

Ask questions for understanding and


not for challenging

For Internal Circulation ONLY!


Rules for training

NO CELL PHONES! – Turn them


off, or to vibrate. Make every
effort to wait until a break to
return missed calls.

When doing exercises, stay with


the group… don’t move ahead of
everyone.

Email and internet are for break


time only.

For Internal Circulation ONLY!


Highlights
Presentations-15
Covers
PA/OM Infotypes creation and
enhancements,Masterdata,Authorisations.enhancements
Audit log,LDB,Macros,Clusters,Reporting,OM Structure
creation,Basic Pay update ,etc.
Real time scenarios-30
Support project Issues(24)
Development Objects(6)
Value added sessions- 10
Code review checklist
Implicit enhancements-PA30
Q&A elated to OM
SAP Notes
Table List in SAP HCM
ABAP Naming Standards.
Adding info types to actions and dynamic actions
Structural Authorizations
Interface Tolobox
Repetitive structures

For Internal Circulation ONLY!


Objectives

• To become familiar with the SAP HR Module.


• To become familiar with programming in the HR Module.

For Internal Circulation ONLY!


Agenda (1)
Day 1
Section 1 - HR Overview
Section 2 - HR Master Data
Exercise 1 - Hire an employee
Exercise 2 - Create family/related person data for an
employee

For Internal Circulation ONLY!


Agenda (2)
Day 2

Section 3 - Logical Databases


Exercise 3 - Create a program using the logical database
Section 4 – HR Report Category
Section 5 - Infotype Views
Section 6 - RMAC Macros
Exercise 4 - Create a program using macros
Exercise 5 – Create a program to read first and last
records of IT 0001 using macros.

For Internal Circulation ONLY!


Agenda (3)
Day 3
Section 7 – Creation & enhancement of PA infotype
Exercise 6 – Create a custom infotype and enhance a
standard infotype
Section 8 - Security/Authorization Checks
Section 9 - Repeat Structures
Exercise 7 - Add repeat structure functionality to logical
database program
Section 8 - Time Data Processing
Section 9 - User exits of PA

For Internal Circulation ONLY!


Agenda (4)
Day 4
Section 10 – Reading OM data
Section 11 - Import/Export of Cluster Tables
Section 12 - Payroll reporting
Section 13 – Interfaces
Section 14 – Dynamic actions and features

For Internal Circulation ONLY!


DAY - 1

HR Overview

For Internal Circulation ONLY!


Objectives
This section will cover:
– Basic SAP HR processes
– The company structure
– The personnel structure

For Internal Circulation ONLY!


Human Resource Process
• Recruitment
• Hiring
• Benefits Enrollment
• Employee Training
• Travel Expense Administration
• Time Reporting & Work Schedule Planning
• Payroll Administration
• Employee Development & Salary Administration
• Cost Planning & Reporting

For Internal Circulation ONLY!


Company Structure
The SAP company structure consists of:
– Client - can be valid for a company code at the smallest
level or for an entire corporate group. The client is a self-
contained legal and organizational unit in the system.
– Company Code - an accounting unit identified by its own
employer identification number (EIN). This unit maintains
its own balanced set of books for legal reporting.
– Personnel Area - Personnel areas allow the customer to
isolate by location such as items as administrative costs,
labor, recruiting, and training.
– Personnel subarea - a further division of the location
allowing the customer to group similar attributes.

For Internal Circulation ONLY!


Company XYZ

Client
C o m p an y X YZ

Company Code
US M e x ico

P h oe n ix S a n F ra n c is co Personnel Area

S h ip p in g P ro du c tion H e a d q u arte rs Personnel


Subarea

For Internal Circulation ONLY!


Personnel Areas
• Personnel areas are subunits of the company
code and are unique to the HR module.
• Personnel areas have a unique four-character
alphanumeric code.
• A personnel area can represent geographic
locations or large divisions within a company.
• A personnel area can be used in selection
criteria for reporting, to assign authorization
checks to a personnel area, and to generate
default values during data entry.

For Internal Circulation ONLY!


Personnel Subareas
Main functions of the personnel subarea are:
– Set Time Management groupings so that work schedules,
substitutions, etc. can be set up.
– Generate a default pay scale type and area for employee
basic pay.
– Define public holiday calendars. (Union employees may
have a different calendar than salary employees).
– Define wage types for different personnel subareas.

For Internal Circulation ONLY!


Personnel Structure
• There are two sections of the personnel
structure - Administrative and Organizational.
The structures may or may not be integrated
during configuration.
• The administrative personnel (PA) structure
contains the employee group, employee
subgroup, and payroll area.
• The organizational personnel (PD) structure
contains the organizational unit, position, and
job.

For Internal Circulation ONLY!


Administrative Personnel Structure
The administrative personnel structure is related to the
employee’s work schedule and how the employee is
compensated and consists of these parts:
– Employee group - categorizes employees in terms of
active, non-active, retired, contractors, etc.
– Employee subgroup - further defines the employee group
by using the following classifications: executives, salary,
hourly union, hourly non-union, trainees, etc. Employee
subgroups determine payroll calculation rules, earnings
and deduction groupings, and work schedules.
– Payroll area - defines the employee group/subgroup pay
frequency or when they receive paychecks.

For Internal Circulation ONLY!


Example Administrative Personnel
Structure

Employee
A c tive E m p loye es
Group

H o u rly P rod u c tio n E xec u tive S ala ry Employee


Subgroup

B i W e e kly P a yroll W ee k ly P a yro ll M on th ly P a yroll Payroll


Area

For Internal Circulation ONLY!


Organizational Structure

 The Organizational Structure is represented by


objects and the relationships between them:

 Objects are elements of information which are used to


Objects build the organizational structure.
 Different types of objects are used in SHARP

 A Relationship defines how an object is related to


another object in the R/3 system. An object's
Relationship relationships distinguish it from other objects.
s
 Different types of relationships can be used dependent
on the object types that are related to each other

 When you create an object or relationships you must


Validity define its lifespan or validity period. This lets the
Dates
system know how long it will be in existence.

For Internal Circulation ONLY!


Defining Objects
 The Organizational structure is defined by:

 Different departments, divisions, and teams of the enterprise. They have to be


Organizational Unit connected with each other to form a hierarchical structure, which represents
the organizational structure.
 A position can be compared with the ‘seat’ that a person occupies within the
Position organization. When a person is hired in SAP, the employee is assigned to a
position.

 Jobs are defined in the job index and they are seen as a base for the SAP HR
Personnel Development module:
Job  Career paths;
 Competencies and Qualifications;

 This object will be used for reporting purposes, to group employees from
Functional Area different organizational units into logical functional areas groupings.
 Some examples of defined functional areas: Commercial, Finance, Legal …

For Internal Circulation ONLY!


An illustration of a OM Structure

O
OM - Example S

LBC Ltd. P

Finance Human Resources Operations Marketing

Manager (Rec) Manager (T & D) Sales

Michael Johnson Suzanne Thomson Zonal Mgr (North) Zonal Mgr (South)
O – Org Unit
S – Position
P – Person Catherine Jennifer

For Internal Circulation ONLY!


HR Master Data

For Internal Circulation ONLY!


Objectives
This section will cover:
– Infotype definitions
– Infotype maintenance
– Infotype history
– Other infotype functions

For Internal Circulation ONLY!


Infotypes (1)
• An infotype is a collection of logically-related information
about an employee that is stored on a transparent table.
• Infotypes are used to access HR master data which is
stored in regular transparent tables.
• Infotypes tables all have their own respective dynpro
screens for insertion, modification, and deletion. These
screens can be accessed through transaction PA30.
• Each infotype record has a begin date (BEGDA) and an
end date (ENDDA).

For Internal Circulation ONLY!


Infotypes (2)
• Each Infotype has a related database table where
infotype records are stored. e.g. infotype nnnn is related
to database table PAnnnn.
• All infotypes that are needed must be declared just like
tables or data elements.
• When an infotype is declared, an internal table Pnnnn is
created automatically with the same structure as the
database table PAnnnn.
TABLES: Pernr.
INFOTYPES: 0000, 0001, 0002.
DATA: date like sy-datum.

For Internal Circulation ONLY!


Infotypes (3)
Infotypes, internal tables, and database tables are often confused
terms in HR ABAP.
nnnn: Infotype. e.g. 0002
Pnnnn: Internal table. It is automatically created with the same
structure as the database table when the infotype is declared.
e.g.P0002
Pannnn: Database table. The data used to populate internal
tables is extracted from the database tables. Those database
tables can be accessed like any other database table using the
select command. However, the internal tables will not be
populated with this command. e.g. PA0002
Qnnnn: Structure. The structure for screen fields

For Internal Circulation ONLY!


HR Tables

• PA Tables • PB Tables
– For all employees master – Recruitment master data
data – Prefix with PBnnnn
– Prefix with PAnnnn – Transaction codes are PB30,
PB20, PB40 and PB10
– Transaction codes are
– Applicant number , BEGDA
PA30, PA20, PA40 and and ENDDA are the main key
PA10 fields
– Employee number , BEGDA
and ENDDA are the main
key fields

For Internal Circulation ONLY!


Contd…
• Payroll Tables
– Result Tables
• Stored in Cluster PCL2
• OM/PD/TEM Tables
• Stores Payroll results
– For all Objects type
basis on the sequence
number – Prefix with HRPnnnn
• Transaction code is – Transaction codes are
PC_PAYRESULT PP01,PP03,PPOCE
– Cumulative Result Table – Plan Version , Object
• Stored in Cluster PCL2 Type, OBJID, BEGDA and
ENDDA are the main key
• Stores cumulative fields
Payroll results.
• Transaction code is
PC_PAYRESULT

For Internal Circulation ONLY!


PA Table

For Internal Circulation ONLY!


PCL2 Table

For Internal Circulation ONLY!


HRP Table

For Internal Circulation ONLY!


Infotype Categories
• HR Master Data 0000 - 0999
• HR Planning Data 1000 - 1999
• HR Time Data 2000 - 2999
• Unused 3000 - 8999
• Customer Specific 9000 - 9999

For Internal Circulation ONLY!


Maintaining Infotypes (1)
There are three ways to maintain infotypes:
– Change or correct
– Create
– Copy

For Internal Circulation ONLY!


Maintaining Infotypes (2)
Change or correct infotypes:
– Use to correct errors or complete missing fields.
– Correct an existing record without creating a new one.
– Use only when you intend to overwrite an existing error.
– Changes do not maintain infotype history.

For Internal Circulation ONLY!


Maintaining Infotypes (3)
Create infotypes:
– Use to create a new record, empty input mask, and fill in
required fields.
– The old record remains in the system and is delimited (if
there is an old record).
– An infotype history is generated according to the
respective validity periods.
– The input mask is empty meaning no values are carried
forward from the old record.

For Internal Circulation ONLY!


Maintaining Infotypes (4)
Copy Infotypes:
– Use to create a new record, complete mask from previous
record, customize fields, and specify a new begin date.
– The copy function also allows you to create new records
that also maintain infotype history.
– The begin date is available for input and the input edit
mask is populated with the values from the previous
record.

For Internal Circulation ONLY!


Other Infotype Functions
• Delete - allows you to delete and entire infotype record.
• List - displays all infotype records in a chronological
order.
• Previous record/next record - allows you to scroll
between records of an infotype.
• Overview - also displays infotypes in a chronological
view.
• Save - you must save an infotype record which you
copy, create, or change.

For Internal Circulation ONLY!


Infotype Examples
• Events/Actions (Infotype 0000)
• Organizational Assignment (Infotype 0001)
• Personal Data (Infotype 0002)
• Addresses (Infotype 0006)
• Basic Pay (Infotype 0008)
• Family/related person (Infotype 0021)

For Internal Circulation ONLY!


Maintain Infotype History
• When you create a new infotype, the old data is not lost but is
stored as history for reporting purposes.
• The infotype historical records reflect the employee’s lifecycle with
the company.
• When creating an infotype that is continuously valid (no gaps or
overlapping records), the old record’s end date will be delimited. For
example, if there is one organizational assignment record for an
employee dated 06/01/1992 to 12/31/9999 and a new record is
created on 09/15/1999, then the old record’s end date will be
modified by the system from 12/31/9999 to 09/14/1999. There
would be a message returned saying ‘Warning: Record valid from
06/01/1992 to 12/31/9999 is delimited.’

For Internal Circulation ONLY!


Personnel Events or Actions
• Personnel events group infotypes to form a specific
personnel procedure. (e.g. - hiring, termination, transfer).
• Transaction PA40 is used to get to the personnel events
screen.
• Every time the SAVE button is hit, a new infotype screen
is presented until all infotypes have been entered. When
the last infotype is saved, control returns to the
Personnel Events Screen.
• Events can be configured to fit a company’s business
procedures.

For Internal Circulation ONLY!


Exercises for the day
Exercise 1 - Hire an employee

Exercise 1

Exercise 2 - Create family/related person data


for an employee

Exercise2

For Internal Circulation ONLY!


DAY-2

Logical Database

For Internal Circulation ONLY!


Objectives
This section will cover:
– Logical database within HR
– The logical database PNP
– The infotypes statement
– The GET PERNR statement
– The PROVIDE statement
– Current/period-related data
– Data screening

For Internal Circulation ONLY!


Logical database
• Logical database is:

Logical databases are special ABAP programs that


retrieve data and make it available to application
programs. The most common use of logical
databases is to read data from database tables by
linking them to executable ABAP programs.

For Internal Circulation ONLY!


Logical Database
The three main functions of a logical database are:
– Data retrieval - HR data is written on an employee
basis to the main memory where it can be
accessed for processing.
– Screening - a selection screen provides selection
criteria for employees.
– Authorization check - the ABAP program
communicates with the logical database driver
program. This program conducts security
authorization object checks to determine if the user
has the necessary authority to access the data.

For Internal Circulation ONLY!


Data Screening (1)
Person selection
– Employees can be selected according to personnel
number range, organizational placement (company code,
personnel area, personnel subarea, etc), HR administrator,
employee status (active, retired, etc.), or by selection
period.
– The person selection period differs from the data selection
period. The employee must have an active organizational
assignment record (IT0001) during this period to be
considered for processing. Employees not active during
this period are bypassed during logical database
processing.

For Internal Circulation ONLY!


Data Screening (2)
Data selection
– The data selection period delimits the time period for which
data is evaluated.
– The PROVIDE loop retrieves the infotype records whose
validity period overlaps with at least one day of the data
selection period.

For Internal Circulation ONLY!


Logical Database – Data Retrieval
In Human Resources (HR), the following logical databases can be used as a data
source:
PNP
PAP
PCH
PNPCE

Logical Database PCH


This logical database generally enables to report on all HR infotypes and can
be used to report on Personnel Planning data.
Logical Database PAP
Logical database PAP enables to access data from Recruitment.
Logical Database PNP
Use logical database PNP to report on HR master data. It is possible to use
logical database PCH to access this data, but PNP meets such reporting
requirements more quickly because it is best suited to the task of selecting
persons.
LDB PNPCE is used for concurrent employment. Employee holding multiple
assignments in the organization is called concurrent employment.

For Internal Circulation ONLY!


Logical Database PNP
• The only table contained in the PNP Logical database is
PERNR.
• The structure PERNR must be declared in the tables
statement, e.g. TABLES: PERNR.
• Define the logical database by entering the logical
database in the attributes screen of the program.
• The logical database gives you a ‘free’ selection screen.
• Use transaction SE36 to display the structure and details
of a logical database.

For Internal Circulation ONLY!


Report Structure

An HR report which uses the logical database has the following basic structure:

 REPORT RPABAP01.
TABLES: PERNR.
INFOTYPES: 0001.
  GET PERNR.
    PROVIDE * FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA.
    WRITE:  / P0001-PERNR,
              P0001-STELL,
              P0001-BEGDA,
              P0001-ENDDA.
    ENDPROVIDE.
This report evaluates the Organizational Assignment infotype records in the
specified data selection period.

For Internal Circulation ONLY!


The Infotypes Statement (1)
INFOTYPES 0001,
0002,
0007.

additions: NAME x,
OCCURS 999,
MODE N,
VALID FROM begin TO end.

For Internal Circulation ONLY!


The Infotypes Statement (2)
• The infotypes statement will create an internal table structure
for every infotype defined.
• The addition NAME allows the developer to rename the
internal table strucutre.
• The addition OCCURS allows the developer to set the number
of internal table entries when memory is reserved to reduce
the amount of memory set aside if memory storage is an issue.
• The addition MODE N will prohibit the loading of the internal
table structure when the data is retrieved from the logical
database. The INFOTYPES statement would now behave the
same as an internal table declaration.
• The addition VALID FROM begin TO end will further allow the
developer to screen the data retrieved from the database.

For Internal Circulation ONLY!


GET PERNR Statement
• GET PERNR is a loop which is terminated with the END-OF-
SELECTION event. One employee’s data will be processed at
a time within each iteration of this loop.
• GET PERNR retrieves the selected personnel numbers by
looping through personnel numbers and by simultaneously
populating all the internal tables, Pnnnn, declared in the
program with all records that exist for a personnel number.

GET PERNR.

process infotype data for employee

END-OF-SELECTION.

For Internal Circulation ONLY!


The PROVIDE Statement
• Used only in HR programming.
• Used to process information contained in the Pnnnn
tables.
• Makes data available for the time span specified in the
data selection period.
• Allows the developer to work with the internal tables by
screening the data based on the data selection period
provided on the selection screen.
• More than one PROVIDE command can be used within
a GET PERNR loop.

For Internal Circulation ONLY!


The PROVIDE Statement Syntax
TABLES: PERNR.
INFOTYPES: 0000,
0001.

START-OF-SELECTION.

GET PERNR.
PROVIDE * FROM P0001
BETWEEN PN/BEGDA
The data selection period
AND PN/ENDDA. from the selection screen
is used here.
ENDPROVIDE.
END-OF-SELECTION.

For Internal Circulation ONLY!


The Provide statement

In the PROVIDE loop, the data of an infotype record is


available for processing in the Pnnnn structure.

For Internal Circulation ONLY!


Current/Period-Related Data
Organizational Assignments

Senior Accountant 02/19/1999 - 12/31/9999

Accountant 08/16/1994 - 02/18/1999

Junior Accountant 03/01/1992 - 08/15/1994

• The current record for the employee is as a Senior Accountant.


• If we wanted to know the employee’s classification during the month of
March 1998 we would have to look at that period only and find that the
employee was classified as an accountant.
• It is important to determine if the current or period-related information is
to be retrieved.
For Internal Circulation ONLY!
Current Data
• Current employee records can be retrieved using the
TRMAC macro RP-PROVIDE-FROM-LAST.
• Only the most recent data record which is valid in the
data selection period will be retrieved.

SYNTAX:
RP-PROVIDE-FROM-LAST Pnnnn SPACE PN/BEGDA
PN/ENDDA.
Pnnn is the infotype, SPACE is the subtype (1, 2, 3, etc.
or SPACE if no subtype exists), PN/BEGDA is the
beginning date and PN/ENDDA is the ending

For Internal Circulation ONLY!


Reading Infotypes w/o the Logical
Database using SELECT
• Infotype records can also be read without the use of the
logical database by using SELECT statements.
• Declare the infotype using a tables statement.

TABLES: PA0002.
DATA: V_NACHN LIKE PA0002-NACHN.

SELECT NACHN UP TO ONE ROWS FROM PA0002


ITNO V_NACHN WHERE PERNR = ‘1’.
WRITE:/ V_NACHN.
ENDSELECT.

For Internal Circulation ONLY!


HR Report Category

For Internal Circulation ONLY!


HR Report Category is:

In SAP HR/Payroll report categories allow you to


customize screen elements of the PNP selection screen.

Step by step creation of HR report category:

HR Report
Category

For Internal Circulation ONLY!


Infotype Views

For Internal Circulation ONLY!


Objectives:

This section will cover:


– Time constraints
– Joining infotypes
– Infotype projection

For Internal Circulation ONLY!


Time Constraints
Time restrictions are referred to as time constraints
– Time constraint 1 - the record is continuously valid.
There are no gaps or overlapping records.
– Time constraint 2 - the record is continuously valid.
There are gaps but there are no overlapping records.
– Time constraint 3 - the record can have gaps and can
overlap. DO NOT USE in join processing.
– Time constraint T - refers to a control table where time
constraints for subtypes are defined.

For Internal Circulation ONLY!


Joining Infotypes
• Because personnel data changes frequently over the
duration of an employee’s career a developer must be
able to capture and accurately report effective data given
a specific period in time.
• Using JOIN multiple valid records can be determined
with in the validity periods specified.

For Internal Circulation ONLY!


Example:
REPORT zabaphr.
TABLES: pernr.
INFOTYPES: 0001 , 0002.

GET pernr.
PROVIDE * FROM p0001
* FROM p0002 BETWEEN pn-begda AND pn-endda.
WRITE: / p0002-pernr , p0002-vorna, p0002-nachn.
ENDPROVIDE.

END-OF-SELECTION.

For Internal Circulation ONLY!


Infotype Projection
• The selection of one or more fields during
processing is referred to as PROJECTION.

For Internal Circulation ONLY!


PROJECTION Code Example
• The ‘*’ in the PROVIDE statement has been replaced
with the field that we would like to project upon.

• PROJECTION can be used in combination with a JOIN


operation.

For Internal Circulation ONLY!


Example:
TABLES: pernr.
INFOTYPES: 0001.

GET pernr.
PROVIDE pernr stell begda endda FROM p0001
BETWEEN pn-begda AND pn-endda.
WRITE: / p0001-pernr,
p0001-stell,
p0001-begda,
p0001-endda.
ENDPROVIDE.
END-OF-SELECTION.

For Internal Circulation ONLY!


RMAC Macros

For Internal Circulation ONLY!


Objectives
This section will cover:
– Table TRMAC
– Other commonly used macros
– Function modules

For Internal Circulation ONLY!


Table TRMAC
• Like subroutines and function modules, RMAC macros
are another means of writing modular programs; RMAC
macros are used frequently in HR programming.
• Program code for these modules is stored in table
TRMAC. The key contains the macro name and
sequence number.
• Naming conventions require that a macro name’s first
two letters represent the application; the rest of the name
can be freely defined. HR macros are commonly found
under the two letters ‘RP’.

For Internal Circulation ONLY!


Reading Infotypes w/o the Logical Database
using macros
• Infotype records can be read without the use of the
logical database by using the macro RP-READ-
INFOTYPE.
• The infotype must still be defined in the INFOTYPES
statement to declare the internal table.
• The program must contain the include member
DBPNPCOM. All the programs that use the logical
database PNP automatically contain this include which
contains macro definitions.
• Security authorizations are not lost when you use RMAC
macros.
For Internal Circulation ONLY!
Other Commonly Used Macros
• RP-INIT-BUFFER - used to initialize buffers before retrieving
payroll information.
• RP-PROVIDE-FROM-FRST - used to read the earliest record
from a given set of infotypes into their respective headers for
a given employee and time range.
• RP-PROVIDE-FROM-LAST - used to read the newest record
from a given set of infotypes into their respective headers for
a given employee and time range.

Please note: RP-PROVIDE-FROM-LAST and RP-PROVIDE-


FROM-FRST can be used after within a logical database
program OR after using the macro RP-READ-INFOTYPE.

For Internal Circulation ONLY!


Exercises for the day
Exercise 3 -Create a program using the logical
database
Exercise3

Exercise 4 - Create a program to read IT0002 data


using RP-READ-INFOTYPE macro

Exercise4

Exercise 5 – Create a program to read first and last


records of IT 0001 using macros.

Exercise 5

For Internal Circulation ONLY!


DAY-3

For Internal Circulation ONLY!


Agenda
• Time Data Processing
Exercise 6 – Retrieve time data using LDB PNP
• Repeat Structures
Exercise 7 – Add repeat structure functionality to logical
database program
• Security/Authorization Checks
• Creation & enhancement of PA infotype
Exercise 8 – Create a custom infotype and enhance a
standard infotype
• User exits of PA

For Internal Circulation ONLY!


Time Data Processing

For Internal Circulation ONLY!


Objectives
This section will cover:
– Importing time data

For Internal Circulation ONLY!


Importing Time Data
• A principle of the logical database is that all of the
infotype records between the lowest and highest system
date are read, irrespective of the data selection period,
when the GET PERNR event occurs.

• If there is a large number of time records, this gives rise


to problems with the main memory and bad performance
times.

• In particular, if positive recording has been


implemented, the quantity of infotype records soon
overloads the main memory.

For Internal Circulation ONLY!


Importing Time Data

• To control the amount of time required to read time infotypes,


MODE N is assigned to the infotypes in the declaration. This
ensures that infotype tables are not filled when GET PERNR
occurs.
• The time infotype tables are subsequently filled using the
RP_READ_ALL_TIME_ITY macro, however, only in the specified
period

For Internal Circulation ONLY!


Repetitive Structures

For Internal Circulation ONLY!


Objectives
This section will cover:
– Repetitive structure description
– Evaluating repetitive structures

For Internal Circulation ONLY!


Infotypes with Repetitive Structures

For Internal Circulation ONLY!


Repetitive Structures
• On some infotype entry screens, data is entered in tables.
• All of the fields in this table structure are named and defined in the
infotype structure on which they are based.
• In the Dictionary, repetitive structures can be recognized by the
number at the end of the field name (Pnnnn-XYZnn).
• For example, in the infotype 0008, the field name LGA01 holds the
first wage type entered. The fields name LGA02 holds the second
wage type entered. This continues up to LGA20. You can
recognize repeat field groups by the sequential number at the end of
the field.

For Internal Circulation ONLY!


Repetitive Structures

For Internal Circulation ONLY!


Data in Repetitive Structures

For Internal Circulation ONLY!


Repetitive Structure Evaluation

For Internal Circulation ONLY!


Evaluating Repetitive Structures

For Internal Circulation ONLY!


Repetitive Structure Evaluation

• The DO loop divides the repetitive structure into


segments, and then retrieves it on a block-by-
block basis into the defined work area.
• FROM <field name> is used to flag the starting
point of the increment fields.
• NEXT <field name> specifies the increment to
the next group of repeat fields.

For Internal Circulation ONLY!


Security/Authorizations

For Internal Circulation ONLY!


Objectives
This section will cover:
– Authorization check purpose and syntax

For Internal Circulation ONLY!


Authorization Check
• The authorization check determines whether the
user starting an application has the
authorizations required for the data to be
evaluated.

• The logical database runs this check


automatically.

• HR makes a distinction between two types of


authorization, one for persons and another for
data.

For Internal Circulation ONLY!


Authorization for Persons
• When an authorization check is performed for
persons, the system determines whether the user
has the authorizations required for the
organizational features of the employees when the
GET PERNR event occurs.
• Employees for whom the user has no
authorization are skipped and then listed in a
control list at the end of the evaluation.
• As for data entry, the authorization check is based
on the HR: Master Data object in the Human
Resources class.

For Internal Circulation ONLY!


Authorization for Data
• When an authorization check is performed
for data, the system determines whether the
user has the authorizations required for all
of the infotypes used in the evaluation.

• If the user has no authorization for a


particular infotype, the evaluation is
canceled and an error message is displayed

For Internal Circulation ONLY!


Authority Check for SQL Commands

For Internal Circulation ONLY!


Authority Check for SQL Commands
• Authorization checks are not supported by the
SELECT statement and must be executed at the
program level.
• In this case, you must use the function module
HR_CHECK_AUTHORITY_INFTY to check
whether the user has the required authorization
for data and persons.
• If the infotype does not have any subtypes, you
can use the value SPACE with the parameter
SUBTY.

For Internal Circulation ONLY!


Custom Infotype Creation

For Internal Circulation ONLY!


Customer Infotypes - PA
The naming convention for custom infotypes is ‘9nnnn’.

• Call the transaction PM01 for Personnel Administration.


• Enter a four-digit infotype number 9nnn. Select Create Infotype tab.
• Create your new infotype. The system creates the following objects
automatically:
- Database table PA9nnn
- Structure P9nnn
- Module pool: MP9nnn00
- 3 screens (1000, 2000, 3000) for the module pool
- Interface status
- Dialog module (RP_9nnn)
• When new infotypes are created, the following table entries are
maintained automatically:
- T777D Check Table for Infotypes
- TDCD Dialog Modules

For Internal Circulation ONLY!


Subtypes for Custom Infotypes
Go to transaction SM30 to maintain view V_T591A.

Enter the Custom infotype number 9nnnn and click Enter.


Now add the subtypes and texts to be maintained and
Save.
Now in transaction PM01, go to infotype technical
attributes.
Enter the field name from structure PSnnnn that has to
taken as subtype.
Enter the subtype table name T519A and subtype text
table T591S in the corresponding fields and Save.

For Internal Circulation ONLY!


Creating Infotypes - Summary

For Internal Circulation ONLY!


Creating Infotypes - Summary
• To summarize, there are three steps to creating customer infotypes:
– Defining infotype-specific fields in structures PS9nnn and
HRI9nnn in the Dictionary.
– Creating core infotype objects using transactions PM01 and
PPCI
(infotype copy programs for Personnel Administration and
Personnel Planning).
– Making customer-specific adjustments and controls

Infotype Creation

For Internal Circulation ONLY!


Enhancing Infotype

For Internal Circulation ONLY!


Enhancing Infotype - Overview

For Internal Circulation ONLY!


Enhancing Infotype - Overview
• The enhancement concept for infotypes used in Personnel
Administration, Recruitment, and Planning enables you to
include any fields that you require in an infotype.
• If you include additional fields in an infotype, they are
processed the same way as fields in the SAP standard
program during reporting, when infotype logs are created,
when dynamic actions are performed, and so on.
• The following infotypes are excluded from the enhancement
concept:
• Infotype 0000 Actions
• Infotype 0302 Additional Actions
• Infotypes used in Time Management (2nnn)
• Infotype 1000 Object
• Infotype 1001 Relationships

For Internal Circulation ONLY!


Infotype Enhancement - Administration

For Internal Circulation ONLY!


Infotype Enhancement
• Start the infotype copy program for Personnel Administration (transaction
code PM01). This takes you to the Create Infotype screen. Choose
Enhance IT. In the Infotype no. field, enter the four-digit number of the
infotype you want to enhance. When you enter the infotype number,
remember to include the leading zeros.

• In the Sub objects box, select CI include and choose Create. This takes
you to the following screen: Dictionary: Initial Screen.

• Create the CI include and choose Activate. If you want to include fields
that are completely new, you must also create data elements. Go back to
the Enhance Infotypes screen.

• Choose Create all.

• Result: you have included additional fields in the standard single screen of
an infotype.

For Internal Circulation ONLY!


DAY-4

For Internal Circulation ONLY!


Agenda (4)
Day 4
Section 10 – Reading OM data
Section 11 - Import/Export of Cluster Tables
Section 12 - Payroll reporting
Section 13 – Interfaces
Section 14 – Dynamic actions and features

For Internal Circulation ONLY!


Reading OM data

For Internal Circulation ONLY!


Data Model

reports to/
is line
supervisor Cost Center Allocation
of

Organizational
belongs to Cost center
Cost Center
incorporates
Allocation

is belongs to
described
by
describes incorporates

is is
Job described described Position Work center
by by occupies

Holder
describes
describes

Task Person/user

 SAP AG 1999

For Internal Circulation ONLY!


ObjectTypes

OrganizationalManagem entisb ase dono bjects


andrelationships. InHu manR esources,the rearefiveb asicobject
typ es,eachwithitsow nob jecttypek ey

Objectty
p es Objecttypekeys

 Organizationalunits O
 Jobs C
 Positions S
 CostCenters K
 Persons P

SAPAG1999

An organizational plan can be made with many object types, although the five basic object types are the building blocks.
Organizational units O
Jobs C
Positions S
Cost centers K
Persons P
Persons hold positions that are defined by jobs and assigned to organizational units and cost centers.

For Internal Circulation ONLY!


Relationship Between Organizational Units

An organizational unit "reports to" another organizational unit


Example: Finance "reports to" Administration
An organizational unit "is the line supervisor of" other
organizational units
Example: Executive Board "is the line supervisor of" Administration,
Production, and Sales

Executive Board Relationship


A/B 002

Administration Production Sales

Finance Controlling Human resources

 SAP AG 1999

For Internal Circulation ONLY!


Relationship Between Jobs and Positions

The job "describes" the position.


The position "is described by" the job.

Relationship
Administrative assistant
A/B 007
for marketing department

Administrative assistant
for executive board
Job:
Administrative
assistant
Administrative assistant
for research department

 SAP AG 1999

For Internal Circulation ONLY!


Relationship Between Person and Position

The position is assigned to a person


Example: Ms Mishra is the "owner" of the position
HR Manager

Holder

Relationship
Position A/B 008 Person

The relationship between position and person creates


integration in master data

 SAP AG 1999

For Internal Circulation ONLY!


Other Object Types

Object Type Name

O Organizational unit
C Job
S Position
P Person
K Cost Center
T Task
A Work Center
Q Qualification
BU Budget

Qualifications: Object Type Q


Personnel Development--Assigned to Persons,
Jobs and Positions

Budgets: Object Type BU


Compensation Management--Assigned to
Organizational Units
 SAP AG 1999

1. Other object types such as Qualifications or Budgets can be used in


Organizational Management to further define the organizational plan.
2. Some object types are not applicable in Organizational Management though they
are defined in the same tables as the Organizational Management objects.
3. For example: Object types D, E, F & G are similar in nature to Organizational
Management object types, but are only applicable to Training and Events
Management.

For Internal Circulation ONLY!


Infotypes

Object characteristics are maintained in the form of infotypes.

 Object (1000)  Organization unit, position,


job
 Relationship (1001)  Belongs to, reports to

 Verbal description (1002)  General text


 Working time (1011)  Planned working hours
 Cost planning (1015)  Cost elements
 Address (1028)  Main address, second address

 SAP AG 1999

For Internal Circulation ONLY!


Relationships Between Basic Object Types

 Organizational unit O
C Job
 Job C
 Position S S S
 Tasks T Position S Position
Position
 Work centers A
O Org.unit

S O Org.unit
Position
S Position
C Job

S Position T T
Task Task

S S
Position Position

 SAP AG 1999

For Internal Circulation ONLY!


Sequential Evaluations

S e q u e n t ia l e v a lu a t io n s
Executive Board

Human resources

Financial accounting

Accounts receivable

Payroll

Validation

Accounts payable

Social insurance

 SAP AG 1999 . . . . . .

An evaluation path describes a chain of relation ships that exist


between objects in hierarchical structure
Sequential : In sequential reporting you can list the objects to be
evaluated using their ID’s .A sequential report is then run for all specified
objects .for example ,you may display a list of all existing jobs.

For Internal Circulation ONLY!


Structural Evaluations

 When structural evaluations are performed, reports


must take evaluation paths into account
Executive Board

Human Financial accounting


resources

Payroll Social Accounts Accounts Validation


benefits payable receivable

 SAP AG 1999

Structural : In structural reporting, the system interprets the selected objects


as root object. Based on this root object and relationships, the system constructs
a hierarchical structure
For Internal Circulation ONLY!
Sequential Evaluations-Coding

TABLES: OBJEC.
INFOTYPES: 0002, "Personal Data
1003, "Addresses
....

GET OBJEC.
LOOP AT Pnnnn
WHERE BEGDA LE PC-ENDDA
AND ENDDA GE PC-BEGDA.
WRITE...
ENDLOOP.

 SAP AG 1999

For Internal Circulation ONLY!


Structural Evaluations-Coding

TABLES: OBJEC, GDSTR.


INFOTYPES: 0002, "Personal Data
1003, "Addresses
....

GET OBJEC.
LOOP AT Pnnnn
WHERE BEGDA LE PC-ENDDA
AND ENDDA GE PC-BEGDA.
WRITE...
ENDLOOP.

 SAP AG 1999

For Internal Circulation ONLY!


Available Internal Information

TABLES: OBJEC, GDSTR.


INFOTYPES: nnnn. Pnnnn Internal infotype table

. . .

GET OBJEC. OBJEC Object information


LOOP AT Pnnnn . . .

GDSTR Root of structure


ENDLOOP.

STRUC Structure information

 SAP AG 1999

For Internal Circulation ONLY!


Reading Infotypes With Function Modules

INFOTYPES: 1001. "Relationships


DATA: ihrobject LIKE HROBJECT OCCURS 10.
. . .
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
. . .
INFTY = '1001'
BEGDA = <begdat>
ENDDA = <enddat>
TABLES
INNNN = P1001
OBJECTS = ihrobject
EXCEPTIONS
ALL_INFTY_WITH_SUBTY = 1
NOTHING_FOUND = 2
NO_OBJECTS = 3
WRONG_CONDITION = 4
OTHERS = 5.

 SAP AG 1999

For Internal Circulation ONLY!


Payroll

For Internal Circulation ONLY!


Payroll

Pay statement

Payroll

Payment

Posting to FI/CO Social insurance Health insurance


Subsequent activities
 SAP AG 1999

For Internal Circulation ONLY!


Calculating the Gross Amount

Gratuities
Basic pay

Night work bonuses Sickness

Gross pay

Overtime
Bonuses

Vacation pay Commission


 SAP AG 1999

For Internal Circulation ONLY!


Payroll Areas

A payroll area is an organizational unit for payroll

Weekly Semi-Monthly

7 14 21 28 15 30

Payroll run every Friday, Payroll run on 15th day and


weekly the last day of the month

 SAP AG 1999

For Internal Circulation ONLY!


Payroll Control Record

Master data maintenance

Release payroll

Start payroll

Check results

No

Error-free? Corrections

Yes
Exit payroll

 SAP AG 1999

For Internal Circulation ONLY!


Payroll Program: Selection Screen

Payroll driver
Start payroll RPCALC*0

Payroll Driver

?
Selections from Matchcodes

Payroll period

Payroll area U1
Current period
Other period

Selection

Personnel number
Payroll area U1

 SAP AG 1999

For Internal Circulation ONLY!


Input and Output Database Tables

Input DB tables Output DB tables

R*
PAnnnn payroll
- infotype data driver PCL2
Payroll result

PCL1
- variable data

- data from PA0003


prev. months PCL2
- cumulated
values

 SAP AG 1999

For Internal Circulation ONLY!


For Internal Circulation ONLY!
Common and frequently used tables for payroll results in the United States
include:
WPBP Work Center (Place) / Basic Pay
RT Result Tables (2 displays: Expanded and Condensed)
CRT Cumulative Results Table
BT Bank Transfer and Payment Information
C0 Cost Distribution
C1 Cost Assignment from Different Infotypes
V0 Variable Assignments
ALP Alternate Payments
ARRS Deductions in Arrears
DDNTK Deductions Not Taken
ACCR Accruals
BENTAB Benefits (FSA YTD balances)
TAX Employee Tax Details
TAXR Residence and Unemployment Tax Details
TAXPR Tax pro-ration Table
TCRT Tax Cumulative Results Table
BAL Balance Table used for Tax Retrocalculation
XDFRT Difference Table used for Tax Retrocalculation
ADR Address of Employee

For Internal Circulation ONLY!


Printing Payroll Results

Cluster display: technical view

Cluster xy
PCL2
creates
RPCLSTxy

 SAP AG 1999

For Internal Circulation ONLY!


For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
• KeyEdit

For Internal Circulation ONLY!


For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
Table Structure / PCLn

Field name KEY Length Text


CLIENT X 3 Client
RELID X 2 Relation ID
SRTFD X 40 Work area key
SRTF2 X 10 Sort field for duplicate key

Example of international payroll results:


RELID SRTFD
RX 00001911 00001
RX 00001911 00002
RX 00001911 00003
...

 SAP AG 1999

For Internal Circulation ONLY!


For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
For Internal Circulation ONLY!
Determining Current Payroll Result (1)

DATA: number LIKE PC261-SEQNR.


. . .
GET PERNR.
. . .
CALL FUNCTION 'CU_READ_RGDIR'
. . .

CALL FUNCTION 'CD_READ_LAST'


EXPORTING
BEGIN_DATE = PN-BEGDA
END_DATE = PN-ENDDA
IMPORTING
OUT_SEQNR = number
TABLES
RGDIR = RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.

 SAP AG 1999

For Internal Circulation ONLY!


For Internal Circulation ONLY!
HR ABAP Features

For Internal Circulation ONLY!


Objectives
This section will cover:
– Dynamic events
– Features

For Internal Circulation ONLY!


Dynamic Events Processing (1)
• The ‘Dynamic Events’ table T588Z is a control table
which triggers certain actions when an infotype record is
maintained. Maintaining an infotype record, executing a
routine, or sending an email are all available actions.
• The ‘OP’ field is the operation code. It can contain one
of the following values:
– ‘02’ - change
– ‘04’ - create
– ‘08’ - delete

For Internal Circulation ONLY!


Dynamic Events Processing (2)
• Action indicator ‘I’ contains any of the following values:
– ‘P’ - check criteria (validate)
– ‘I’ - maintain infotype record (presents an infotype screen
for input
– ‘W’ - define values when creating a new record
– ‘V’ - refer to another action or step
– ‘F’ - call a subroutine
– ‘M’ - send an email

For Internal Circulation ONLY!


Calling features (1)
• Features are objects which take on various specifications
and control a vast number of operations. For example,
the feature ABKRS provides a default value for the
payroll area for an employee based on the information
found in the employee’s organizational assignment
(IT0001).
• Features are defined using transaction PE03.

For Internal Circulation ONLY!


Calling features (2)
TABLES: PME04

*Fill decision fields of feature with values.


PME04-MOLGA = ‘10’.
PME04-WERKS = V_WERKS
PME04-BTRTL = V_BTRTL
PME04-PERSK = V_PERSK
PME04-PERSG = V_PERSG

*Call feature
PERFORM RE549D USING ‘ABKRS’ ‘2’ V_ABKRS V_ERROR.

For Internal Circulation ONLY!


Calling Features (3)
• The parameters are populated as follows:
– parameter 1 (‘ABKRS’) - the name of the feature
– parameter 2 (‘2’) - Type of error handling
• ‘ ‘ - no output error
• ‘1’ - WRITE statement for errors
• ‘2’ - I message for errors
• ‘3’ - S message for errors
• ‘4’ - E message for errors
– parameter 3 (‘V_ABKRS’) - contains the return value
– parameter 4 (‘V_ERROR’) - contains the type of errors

For Internal Circulation ONLY!


Function Module :
call function HR_FEATURE_BACKFIELD
exporting
feature = feature
struc_content = struc_content
kind_of_error = kind_of_error
importing
back = back
changing
status = status
exceptions
dummy =1
error_operation =2
no_backvalue =3
feature_not_generated =4
invalid_sign_in_funid =5
field_in_report_tab_in_pe03 = 6
others = 7.

For Internal Circulation ONLY!

You might also like