Abap HR Programing PDF
Abap HR Programing PDF
ABAP HR
Programming in HR
HR-ABAP
RAJA RAVI CHANDRA
Linkin Pereira
SAP
ABAP HR
Prerequisites
Knowledge of
ABAP Programming
Logical Database
Module pool programming
SAP Scripts
SAP
ABAP HR
SAP
ABAP HR
Modules in SAP-HR
Personnel Management (PA)
Time Management (PT)
Recruitment (PB)
Organizational Management (OM)
Personnel Development (PD)
Training & Event Management (TM)
SAP
ABAP HR
Infotype
Definition
Units of information.
SAP
ABAP HR
Uses of Infotype
Personal
Data
INFOTYPES
Addresses
Name
DOB
Nationality
Marital Status
Street
City
Pin code
State
SAP
ABAP HR
Uses of Infotype
SAP
ABAP HR
Infotype Numbers
Unique identification
SAP
ABAP HR
Naming Conventions
Naming conventions for Infotypes
SAP
ABAP HR
Structure Pnnnn
Structure Pnnnn contains infotype key fields and all of the data
fields from structure PSnnnn .
SAP
ABAP HR
SAP
ABAP HR
Infotype-specific Includes
The main program only contains INCLUDE statements. If
you create the main program using transaction PM01
Dialogs in HR, the system also creates the following four
includes:
Name of include
MPnnnn10
MPnnnn20
MPnnnn30
MPnnnn40
subroutines
SAP
ABAP HR
Infotype-specific Includes
The system also inserts INCLUDE statements in the main
program for the following includes:
Name of include Use
FP50PPSB
MPPDAT00
MPPERS00
MPPIRC00
MPPREF00
SAP
ABAP HR
Infotype Screens
Each infotype has at least three screens:
An initial screen
A single screen
A list screen
SAP
ABAP HR
Initial Screens
SAP
ABAP HR
SAP
ABAP HR
Single Screens
SAP
ABAP HR
SAP
ABAP HR
List Screen
Unables to list all records in infotye
Screen 3000 is used for list screen
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
Infotype Characteristics
The following tables must be maintained for each infotype:
Name of table
Task
T582A
T582S
T777A
T77ID
SAP
ABAP HR
Creating PA infotypes
Transaction code
PM01.
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
Enhancement of PA Infotype
1. Start the Personnel Administration infotype
copier (PM01)
2. Enter the infotype number.
3. Choose Enhance infotype.
SAP
ABAP HR
In the Infotype no. field, enter the four-digit number of the infotype you
want to create. When you specify the infotype number, please remember
to enter any leading zeros.
Choose Activate.
Result
You have included additional fields in the standard single field for an
infotype
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
Enhanced Field
SAP
ABAP HR
CI_P0000
SAP
ABAP HR
HR Macros
RP_PROVIDE_FROM_LAST
RP_PROVIDE_FROM_FIRST
RP_SET_DATA_INTERVAL
RP_READ_INFOTYPE
SAP
ABAP HR
Macros Modules
M acro M odules
TABLES: PERNR.
INFOTYPES: 0001,
0002,
0006,
....
GET PERNR.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
WRITE...
* * * Include program DBPNPMAC.
DEFINE RP_PROVIDE_FROM_LAST.
PNP-SW-FOUND = '0'.
. . .
END-OF-DEFINITION.
SAP
ABAP HR
Data selection
T a ble
Pnnnn
January
January
Decem ber
Decem ber
G ET P E RN R.
R P_ PR O VI DE _F RO M _L AS T <P n nn n> S PA C E PN-B EG D A PN -E ND D A.
I F PN P -S W- FO U ND = 1 .
W R IT E. ..
E ND IF .
SAP
ABAP HR
Data selection
M ay
December
PAnnnn
START-OF-SELECTION.
RP_SET_DATA_INTERVAL '<
Pnnnn>' PN-BEGDA PN-ENDDA.
GET PERNR.
Table
Pnnnn
SAP
ABAP HR
Function HR_READ_INFOTYPE
Reading Infotypes Without Logical DB (1)
PAnnnn
INFOTYPES: <nnnn>.
...
CALL FUNCTION
'HR_READ_INFOTYPE'...
SAP
ABAP HR
Function HR_READ_INFOTYPE
Reading Infotypes Without Logical DB (2)
INFOTYPES: 0002.
DATA: return LIKE SY-SUBRC.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
. . .
PERNR
= <person>
INFTY
= '0002'
BEGDA
= <begdat>
ENDDA
= <enddat>
IMPORTING
SUBRC
TABLES
INFTY_TAB
EXCEPTIONS
INFTY_NOT_FOUND
OTHERS
= return
= P0002
= 1
= 2.
SAP
ABAP HR
HR Macro Summary
SAP
ABAP HR
SAP
ABAP HR
1. Data retrieval
2. Screening
3. Authorization check
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
TABLES: PERNR.
INFOTYPES:0001,
0002,
0006,
....
" Actions
"Personal Data
" Addresses
GET PERNR.
PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
SAP
ABAP HR
GET PERNR.
PROVIDE * FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
PROVIDE * FROM P0006
BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
END-OF-SELECTION.
Infotype
loop
Infotype
loop
Employee
loop
SAP
ABAP HR
Joins in PROVIDE
Join / Creating Intervals
Personal
Data (0002)
Organizational
Assignment (0001)
Join
SAP
ABAP HR
Joins in PROVIDE
Join / Coding
TABLES: PERNR.
INFOTYPES:0001,
0002,
0006,
....
GET PERNR.
PROVIDE * FROM P0001
* FROM P0002
BETWEEN PN-BEGDA AND PN- ENDDA.
WRITE...
ENDPROVIDE.
SAP
ABAP HR
TABLES: PERNR.
INFOTYPES:0001,
0002,
"Organizational Assignment
"Personal Data
....
GET PERNR.
PROVIDE
STELL
ENAME FROM P0001
GBDAT FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
SAP
ABAP HR
2.
Confirmation Letter
3.
Promotion Letter
4.
Transfer Letter
5.
6.
Retirement Letter
SAP
ABAP HR
APPOINTMENT LETTER
The management is pleased to appoint you as the [POSITION] in [GRADE] with effect from [DATE].
You will report to [POSITION].
Your salary & other benefits are stated in the attached compensation package sheet.
You will be on probation for a period of six months. On satisfactory completion of probation you will
be confirmed in service.
You shall be governed by the Services rules of the Company, a copy of which is enclosed. A
summary of Benefits & Leave Rules as applicable to you is also enclosed.
Please confirm your acceptance by signing the duplicate copy of this letter & intimate the date of
joining.
This offer is valid for two months from the date of receipt of this letter.
Faithfully
[Signatory] / SECRETARY
[Designation]
SAP
ABAP HR
Component
Type
Data
Type
Len
Short Text
De
c
LDATE
ZLDATE
DATS
Letter Date
LTYPE
ZLTYPE1
CHAR
50
Letter Type
SIGN1
ZSIGN1
CHAR
40
Signatory
DESGN
ZDESGN
CHAR
40
Designation
MASSN
ZMASSN
CHAR
Action Type
EFFDT
BEGDA
DATS
Start Date
SUPER
ZSUPER
CHAR
40
SBUNM
ZSBUNM
CHAR
40
SBU Name
APDAT
ZAPDAT
DATS
Appointment Date
RLDAT
ZRLDAT
DATS
Relieving Date
LETTERID
TDOBNAME
CHAR
70
Name
SAP
ABAP HR
ZHR_LTYPE
Table ZHR_LTYPE created for help drop down of field
LTYPE of structure PS9011.
Table: ZHR_LTYPE
Fields
Field Type
Data
Type
Len
Dec
Short Text
INFTY
INFTY
CHAR
Infotype
SUBTY
SUBTY_591A
CHAR
Subtype
LTYPE
ZLTYPE1
CHAR
50
Letter Type
ACTION
MASSN
CHAR
Action Type
FRMNM
ZFRMNM
CHAR
30
Form Name
SAP
ABAP HR
SAP
ABAP HR
*
*
&cldate&
*
*
&itab-ename&
&itab-zdesgn&
&itab-orgtx&
&itab-name1&
*
*
&itab-first_line&
*
B The Management is pleased to appoint you as the &itab-zdesgn& in grade
&itab-pktxt& with effect from &itab-effdt&. You will report to .....
*
B Your salary & other benefits are stated in the attached compensation
package sheet.
*
SAP
ABAP HR
Faithfully
*
*
&pp9011-sign1&
*
P2 CC:,,Chief Personnel Officer
P2 ,,Chief Manager, Management Systems and Information
P2 ,,
SAP
ABAP HR
Clusters
Definition
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.
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
SAP
ABAP
HR
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
SAP
ABAP HR
Structure: PAY99_RESULT
EVP
Structure PC261
RT
CRT
Type PC202
Type HRPAY99_RT
Type HRPAY99_CRT
NAT
BT
Dummy
for national
part
SAP
ABAP HR
EXERCISE (1)
1. Whenever an employee is hired, it is mandatory to
provide certain documents, which will form a checklist
on joining the organization.
The joining checklist are as follows:
a. Relieving letter from last employer
b. Salary Slip of last employer
c. Graduation certificate
d. Copy of latest qualification certificate, specify
e. Income Tax certificate of last employer
f. Others specify (3 lines)
Create a customer defined infotype where above
details are maintained.
SAP
ABAP HR
EXERCISE (2)
2. Eligibility for LTA allowance is one basic for a financial
year. If last year it is not claimed, it can be claimed in
the current year.
LTA is one time payment and maintained in IT
0015, i.e. Additional payments & deductions.
SAP
ABAP HR
EXERCISE (3)
3. Generate a report to list employee with the latest
action in the given date range.
Display following fields:
a. Employee Number
b. Employee Name
c. Action Type
d. Action Text
e. Action Start Date
Tips: Make use of HR macros
SAP
ABAP HR
EXERCISE (4)
4. Generate a report to list an employment history in a
given date range.
Display following fields:
a. Employee Number
b. Employee Name
c. Action Start Date
d. Action Type
e. Action Text
Tips: Make use of provide endprovide loop
SAP
ABAP HR
EXERCISE (5)
5. Generate a Salary register which will list following
fields in matrix format.
Emp.No.
Basic
HRA
Conv
Spl.Pay
00001
00002
00100