ABAP HR Training abap.sdn-sap.com
Transcript of ABAP HR Training abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 1/70
Siemens Information Systems Ltd.
Programming in HRGlobal network
of innovation
HR-ABAP
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 2/70
Siemens Information Systems Ltd.
PrerequisitesGlobal network
of innovation
ABAP Programming
Logical Database
Module pool programming SAP Scripts
Knowledge of
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 3/70
Siemens Information Systems Ltd.
Training will cover Global network
of innovation
Brief description of modules in SAP-HR
Concept of Info types
Info type Structures
Creation of info type Enhancement of info type
HR Macros
Use of Provide statement
Cluster reading for Payroll results
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 4/70
Siemens Information Systems Ltd.
Modules in SAP-HRGlobal network
of innovation
Personnel Management (PA)
Time Management (PT)
Recruitment (PB)
Organizational Management (OM) Personnel Development (PD)
Training & Event Management (TM)
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 5/70
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 6/70
Siemens Information Systems Ltd.
Uses of InfotypeGlobal network
of innovation
• To group related data fields
Personal
Data
Name
DOB
NationalityMarital Status
AddressesStreet
City
Pin code
State
INFOTYPES
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 7/70
Siemens Information Systems Ltd.
Uses of InfotypeGlobal network
of innovation
• Maintaining Employee Information by Date
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 8/70
Siemens Information Systems Ltd.
Infotype NumbersGlobal network
of innovation
• Four digit number nnnn
• Unique identification
• 9000 to 9999 reserved for customer infotypes
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 9/70
Siemens Information Systems Ltd.
Naming ConventionsGlobal network
of innovation
• 0000 to 0999 – HR Master data / Applicant data
• 1000 to 1999 – Organizational Management
• 2000 to 2999 – Time data
• 4000 to 4999 – Applicant data
• 9000 to 9999 – Customer defined
Naming conventions for Infotypes
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 10/70
Siemens Information Systems Ltd.
Definition of Infotype within the Data
DictionaryGlobal network
of innovation
Each infotype nnnn requires at least two structures andone table:
• Structure PSnnnn
Structure PSnnnn contains all of the infotype data fields.
• Structure PnnnnStructure Pnnnn contains infotype key fields and all of the data
fields from structure PSnnnn .
• Transparent table PAnnnn and/or transparent table
PBnnnn
Transparent table PAnnnn is required if you want to use an infotypewithin Personnel Administration.
If you want to use an infotype within Recruitment, transparent table
PBnnnn is required.
In accordance with the distribution of infotype name ranges, objects
P9nnn , PS9nnn , PA9nnn and PB9nnn are assigned to thecustomer name range.
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 11/70
Siemens Information Systems Ltd.
Infotype Module PoolGlobal network
of innovation
• A module pool should be used with each infotype. This
module pool is the main program for the maintenance
interface for the info type.
• The name of the program is MPnnnn00. Where P
stands for Human Resources (personnel) and nnnn is
the four-digit info type number.
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 12/70
Siemens Information Systems Ltd.
Infotype-specific IncludesGlobal network
of innovation
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:
subroutines MPnnnn40
PAI modules for the screens MPnnnn30
PBO modules for the screens MPnnnn20
The PROGRAM statement and
the declaration of common data objects
MPnnnn10
The include containsName of include
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 13/70
Siemens Information Systems Ltd.
Info type-specific IncludesGlobal network
of innovation
The system also inserts INCLUDE statements in the main
program for the following includes:
Definition of two data objects that contain the
number of reference personnel numbers in structure
P0031 or P0121
MPPREF00
Definition of infotype return codes MPPIRC00
Standard infotype modules MPPERS00
Declaration of common data objects MPPDAT00
Declaration of common data objects
This data area is used as a buffer for importedinfotype records and maintenance information. The
variables specified in this area are used as export or
import parameters when the infotype dialog module
is accessed.
FP50PPSB
UseName of include
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 14/70
Siemens Information Systems Ltd.
Infotype ScreensGlobal network
of innovation
Each infotype has at least three screens:
• An initial screen
• A single screen• A list screen
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 15/70
Siemens Information Systems Ltd.
Initial ScreensGlobal network
of innovation
• Initial screen is used as technical interface
• Screen 1000 is used for all info types
• Processed in background and not displayed
• Performs general initialization procedures
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 16/70
Siemens Information Systems Ltd.
Initial Screens - PreviewGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 17/70
Siemens Information Systems Ltd.
Single ScreensGlobal network
of innovation
• Its an interface between the system and the user.
• It enables to create, display or maintain data records.
• Screen 2000 is used for single screen.
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 18/70
Siemens Information Systems Ltd.
Single Screen - PreviewGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 19/70
Siemens Information Systems Ltd.
List ScreenGlobal network
of innovation
• Unable to list all records in info type
• Screen 3000 is used for list screen
For more ABAP Materials visit abap.sdn-sap.com
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 20/70
Siemens Information Systems Ltd.
List Screen - PreviewGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Si I f i S L d
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 21/70
Siemens Information Systems Ltd.
Infotype Screen ControlGlobal network
of innovation
• Through customization some field are made hidden.
• Attributes are specified during runtime.
• The appearance of the screens changes depending on
the function chosen by the user.
For more ABAP Materials visit abap.sdn-sap.com
Si I f ti S t Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 22/70
Siemens Information Systems Ltd.
Infotype Time ConstraintGlobal network
of innovation
A time constraint indicates whether more than one infotyperecord may be available at one time. The following time
constraint indicators are permissible:
1 No overlapping and no gaps.
2 No overlapping but time gaps are permitted.
3 Overlapping and and time gaps are permitted.
For more ABAP Materials visit abap.sdn-sap.com
Si I f ti S t Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 23/70
Siemens Information Systems Ltd.
Other Possible Time ConstraintGlobal network
of innovation
A Only one record may exist, valid from 01/01/1800 to 12/31/9999.
Splitting and deletion is not permissible.
B Only one record may exist, valid from 01/01/1800 to 12/31/9999.
Splitting is not permissible, but may be deleted.
T The time constraint varies depending on the subtype.
Z Refers to time management infotypes.
For more ABAP Materials visit abap.sdn-sap.com
Si I f ti S t Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 24/70
Siemens Information Systems Ltd.
Infotype CharacteristicsGlobal network
of innovation
The following tables must be maintained for each infotype:
Name of table Task
T582A Basic infotype characteristics
(database tables, single screen, list screen, time constraint, dialogmodule, and so on)
T582S Infotype short texts
T777A Technical Characteristics of Infotype (database table, dialog module, andso on)
T77ID Name of data field structure (PSnnnn)
For more ABAP Materials visit abap.sdn-sap.com
Si I f ti S t Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 25/70
Siemens Information Systems Ltd.
Creating PA infotypesGlobal network
of innovation
Transaction code
‘PM01’.
For more ABAP Materials visit abap.sdn-sap.com
Si I f ti S t Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 26/70
Siemens Information Systems Ltd.
Creating PA infotypes – PM01Global network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information S stems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 27/70
Siemens Information Systems Ltd.
Creating PA infotypes – Maintain StructureGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 28/70
Siemens Information Systems Ltd.
Creating PA infotypes – Infotype TableGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 29/70
Siemens Information Systems Ltd.
Creating PA infotypes – Infotype Table
(Primary Key)Global network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 30/70
Siemens Information Systems Ltd.
Creating PA infotypes – PreviewGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 31/70
Siemens Information Systems Ltd.
Enhancement of PA InfotypeGlobal network
of innovation
1. Start the Personnel Administration info type
copier (PM01)
2. Enter the info type number.
3. Choose Enhance info type.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 32/70
Siemens Information Systems Ltd.
Enhancing a Single ScreenGlobal network
of innovation
• Start transaction PM01
• You access the Create Info type screen:
• Choose Enhance Info types.
• In the Info type no. field, enter the four-digit number of the info type you
want to create. When you specify the info type number, please remember
to enter any leading zeros.• In the Sub-Objects group box, flag CI Include.
• Choose Create. The Dictionary: Initial Screen is displayed.
• Create the Cl include.
• Choose Activate.
• Return to the Create Info type screen.
• Choose Create All .
Result
You have included additional fields in the standard single field for an
info typeFor more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 33/70
Siemens Information Systems Ltd.
Enhancing a Single Screen – PM01Global network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 34/70
Siemens Information Systems Ltd.
Enhancing a Single Screen – Maintain
StructureGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 35/70
Siemens Information Systems Ltd.
Enhancing a Single Screen – Screen PreviewGlobal network
of innovation
Enhanced
Field
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 36/70
Siemens Information Systems Ltd.
Enhancing PA Infotype – CI INCLUDEGlobal network
of innovation
Only those PA Tables can be Enhanced, having structure CI Include
CI_P0000
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 37/70
Siemens Information Systems Ltd.
HR MacrosGlobal network
of innovation
RP_PROVIDE_FROM_LAST
RP_PROVIDE_FROM_FIRST
RP_SET_DATA_INTERVAL
RP_READ_INFOTYPE
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 38/70
Siemens Information Systems Ltd.
Macros ModulesGlobal network
of innovation
Macro Modules
TABLES: PERNR. INFOTYPES: 0001, " Organizational Assignment
0002, "Personal Data
0006, " Addresses ....
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.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 39/70
Siemens Information Systems Ltd.
Info type Record ProcessingGlobal network
of innovation
Processing a Specific Infotype Record
Data selection January December
Table Pnnnn
January December
GET PERNR. RP_PROVIDE_FROM_LAST <Pnnnn> SPACE PN-BEGDA PN-ENDDA. IF PNP-SW-FOUND = 1.
RITE... ENDIF.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 40/70
Siemens Information Systems Ltd.
Infotype Record ImportingGlobal network
of innovation
Importing Specific Infotype Records
Data selection May December
Table
Pnnnn
PAnnnn
START-OF-SELECTION. RP_SET_DATA_INTERVAL '< Pnnnn >' PN-BEGDA PN-ENDDA.
GET PERNR.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 41/70
Siemens Information Systems Ltd.
Function HR_READ_INFOTYPEGlobal network
of innovation
Reading Infotypes Without Logical DB (1)
PAnnnn PAnnnn
INFOTYPES: <nnnn>. ... CALL FUNCTION 'HR_READ_INFOTYPE' ...
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 42/70
Siemens Information Systems Ltd.
Function HR_READ_INFOTYPEGlobal network
of innovation
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 = return
TABLES INFTY_TAB = P0002
EXCEPTIONS INFTY_NOT_FOUND = 1 OTHERS = 2.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 43/70
Siemens Information Systems Ltd.
Function
RP_FILL_WAGE_TYPE_TABLE_EXTGlobal network
of innovation
INFOTYPES: 0008. DATA: return LIKE SY-SUBRC. CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'
EXPORTING .
. .
PERNR = <person> INFTY = '0008' BEGDA = <begdat> ENDDA = <enddat> TCLAS = ‘A’
TABLES PP0001 =P0001PP0007 =P0007PP0008 =P0008PPBWLA =PBWLA PP0230 =P0230PP0014 =P0014 OPPP0015 =P0015 OPPP0052 =P0052 OP
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 44/70
Siemens Information Systems Ltd.
Function HR_INFOTYPE_OPERATIONGlobal network
of innovation
INFOTYPES: 0008. DATA: return LIKE SY-SUBRC. CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING .
. .
Infty = '0015'number = <pernr> BEGDA = <BEGDA> ENDDA = <ENDDA> record = p0015operation = 'INS'nocommit = 'X'importing
return = <flg>.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 45/70
S e e s o at o Syste s td
HR Macro – SummaryGlobal network
of innovation
• Many HR reports use macros. Their program codes
are stored in a table or defined locally using the
DEFINE keyword.
• The PR_PROVIDE_FROM_LAST macro writes thelast valid record in the data selection period to the
header line of the internal info type table.
• You can use the function module
HR_READ_INFOTYPE to read the personnel data inreports which do not use an HR logical database.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 46/70
y
Use of PROVIDE StatemnentGlobal network
of innovation
PROVIDE – ENDPROVIDE is a loop to process
Pnnnn tables, within the validity period.
Two or more info types can be processed in a single
PROVIDE – ENDPROVIDE loop.
Combines JOIN and PROJECTION.
Reads time-dependent table entries.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 47/70
y
Logical database PNPGlobal network
of innovation
1. Data retrieval 2. Screening
3. Authorization check
Functions of Logical Database PNP
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 48/70
y
Logical database PNP - ScreeningGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 49/70
y
Functions of Logical database PNPGlobal network
of innovation
Data Retrieval
1. Create data structures for infotypes
2. Fill the data structures with the infotype records
" Organizational Assignment "
"Personal Data "
" Planned Working Time"
INFOTYPES: 0001, 0002,
0007.
GET PERNR.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 50/70
y
Processing Master Data using PROVIDEGlobal network
of innovation
Processing Master Data
TABLES: PERNR. INFOTYPES: 0001, " Actions
0002, "Personal Data 0006, " Addresses
....
GET PERNR. PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA. WRITE...
ENDPROVIDE.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 51/70
y
Processing Master Data using PROVIDEGlobal network
of innovation
Loop Nesting
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
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 52/70
Joins in PROVIDEGlobal network
of innovation
Join
Organizational
Assignment (0001)
Personal
Data (0002)
Join / Creating Intervals
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 53/70
Joins in PROVIDEGlobal network
of innovation
Join / Coding
TABLES: PERNR. INFOTYPES: 0001, " Organizational Assignment
0002, "Personal Data
0006, " Addresses
....
GET PERNR.
PROVIDE * FROM P0001 * FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 54/70
Joins and Projection in PROVIDEGlobal network
of innovation
Join and Projection / Coding
TABLES: PERNR. INFOTYPES: 0001, " Organizational Assignment
0002, "Personal Data
....
GET PERNR. PROVIDE STELL
ENAME FROM P0001 GBDAT FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA. WRITE...
ENDPROVIDE.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 55/70
ClustersGlobal network
of innovation
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.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 56/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 57/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 58/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 59/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 60/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 61/70
Display of Cluster data – Payroll ResultGlobal network
of innovation
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 62/70
Reading Cluster DirectoryGlobal network
of innovation
Reading the Cluster Directory
*Table containing directory of payroll results DATA: BEGIN OF RGDIR OCCURS 100.
INCLUDE STRUCTURE PC261. DATA: END OF RGDIR.
DATA: COUNTRY LIKE T001P-MOLGA. ... CALL FUNCTION'CU_READ_RGDIR'
EXPORTINGPERSNR = PERNR-PERNR
IMPORTING MOLGA = country
TABLESIN_RGDIR = RGDIR
EXCEPTIONS NO_RECORD_FOUND = 1OTHERS = 2.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 63/70
Determining Last Payroll ResultGlobal network
of innovation
Determining Current Payroll Result (1)
DATA: number LIKE PC261-SEQNR. . . . GET PERNR.
. . . CALL FUNCTION 'CU_READ_RGDIR'
. . .
CALL FUNCTION 'CD_READ_LAST'
EXPORTINGBEGIN_DATE = PN-BEGDA END_DATE = PN-ENDDA
IMPORTINGOUT_SEQNR = number
TABLESRGDIR = RGDIR EXCEPTIONS
NO_RECORD_FOUND = 1OTHERS = 2.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 64/70
Determining Last Payroll ResultGlobal network
of innovation
Determining Current Payroll Result (2)
DATA: result TYPE PAY99_RESULT. DATA: rt header TYPE LINE OF HRPAY99_RT. . . .
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTINGCLUSTERID ='RX'
EMPLOYEENUMBER = p0001- pernr SEQUENCENUMBER =number
* READ_ONLY_BUFFER = ' '* READ_ONLY_INTERNATIONAL = ' '* CHECK_READ_AUTHORITY = 'X'
. . .CHANGING
PAYROLL_RESULT =result EXCEPTIONS . .
LOOP AT result-INTER-RT INTO rt_header.
WRITE: / rt_header-LGART, ... ENDLOOP.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 65/70
Structure for Payroll ResultGlobal network
of innovation
Structure for Payroll Results
DATA: result TYPE PAY99_RESULT . DATA: rt header TYPE LINE OFHRPAY99_RT . . . .
* Access to payroll result data WRITE: result -INTER-VERSC-FPPER,
. . .LOOP AT result -INTER-RT INTO rt header . WRITE: / rt header -LGART, . . .
ENDLOOP.
Structure : PAY99_RESULT
EVP Structure PC261
INTER Structure PAY99_INTERNATIONAL NAT Dummyfor national part
VERSC Type PC202
RT Type HRPAY99_RT
BT CRT Type HRPAY99_CRT
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 66/70
EXERCISE (1)Global network
of innovation
1. Whenever an employee is hired, it is mandatory toprovide certain documents, which will form a checklist
on joining the organization.
The joining checklist are as follows:
b. Relieving letter from last employer c. Salary Slip of last employer
d. Graduation certificate
e. Copy of latest qualification certificate, specify
f. Income Tax certificate of last employer
g. Others specify – (3 lines)
Create a customer defined info type where above
details are maintained.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 67/70
EXERCISE (2)Global network
of innovation
1. Eligibility for LTA allowance is one basic for a financialyear. If last year it is not claimed, it can be claimed in
the current year.
• Provide and additional field to maintain year for
LTA claim. (Infotype Enhancement to IT 0015)
• If LTA claim is not of current year, then LTA
reduces to 80% of the current basic. Built a
validation for the same.
LTA is one time payment and maintained in IT
0015, i.e. Additional payments & deductions.
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 68/70
EXERCISE (3)Global network
of innovation
1. Generate a report to list employee with the latestaction in the given date range.
Display following fields:
b. Employee Number
c. Employee Named. Action Type
e. Action Text
f. Action Start Date
Tips: Make use of HR macros
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 69/70
EXERCISE (4)Global network
of innovation
1. Generate a report to list an employment history in agiven date range.
Display following fields:
b. Employee Number
c. Employee Named. Action Start Date
e. Action Type
f. Action Text
Tips: Make use of provide – endprovide loop
For more ABAP Materials visit abap.sdn-sap.com
Siemens Information Systems Ltd.
7/30/2019 ABAP HR Training abap.sdn-sap.com
http://slidepdf.com/reader/full/abap-hr-training-abapsdn-sapcom 70/70
EXERCISE (5)Global network
of innovation
1. Generate a Salary register which will list followingfields in matrix format.
Read data from Payroll Cluster and display it in the
above format.
Emp.No. Basic HRA Conv Spl.Pay
00001
00002
00100
Tips: Refer to SAP standard programs in T.Code
PC00_M99_CLGA09 and PC_M99_CLGV09