Académique Documents
Professionnel Documents
Culture Documents
R/3 System
Instructor
guide
Level 3
HR350 Programming in HR
Release 4.0
<03.08.98>
(C) SAP AG
ISG.HR
6-1
Contents:
Duration............................................................................................................................................. 4
Course materials and other materials (course guide).........................................................................4
Country-specific units......................................................................................................................... 4
Trainer profiles............................................................................................................5
Required system knowledge.............................................................................................................. 5
Recommended course attendance.................................................................................................... 5
Recommended online help................................................................................................................ 5
Notes on preparing this course.......................................................................................................... 5
Training system...........................................................................................................6
Required data.................................................................................................................................... 6
User ID and passwords for course participants..................................................................................6
System preparations.......................................................................................................................... 6
Example ABAPs................................................................................................................................. 6
Authorization profiles.......................................................................................................................... 6
Technical notes.................................................................................................................................. 8
(C) SAP AG
ISG.HR
6-2
Schedule....................................................................................................................36
Schedule:......................................................................................................................................... 36
Day five............................................................................................................................................ 36
Additional notes:.......................................................................................................36
Unit: HR ABAP features...........................................................................................39
Unit: appendix...........................................................................................................40
(C) SAP AG
ISG.HR
6-3
Course details
Duration
5 days
Course materials and other materials (course guide)
Course file
Country-specific units
None
(C) SAP AG
ISG.HR
6-4
Trainer profiles
Required system knowledge
The instructor requires detailed knowledge of master data, time data, payroll, and organizational
management. Report programming skills are essential and should be supported by practical programming
experience, if possible. Dialog programming skills are not required because they are not included in this
course.
Recommended course attendance
The instructor requires skills attained by attending HR050, HR400, and HR505. With regard to ABAP
report programming skills, the instructor is advised to attend BC400, BC405, and BC420.
Recommended online help
In the R/3 Library under Personnel Administration and Payroll Accounting, access the chapter on
Tools and read the sections on Programming in HR and RMAC Modules in the Standard HR System.
Notes on preparing this course
The information contained in the literature mentioned above must be read both before and during the preparations for
this course, because the contents of this course are based on the documentation contained in the R/3 Library.
(C) SAP AG
ISG.HR
6-5
Training system
Required data
During this course, it must be possible to select existing personnel numbers using demo reports and
participant reports. In particular, HR data must include absences (infotype 2001). Personnel number 1911,
Chris Howland, is used for demonstration purposes during the course, because it includes particular
infotype combinations and international payroll results in cluster RX.
User ID and passwords for course participants
Users HRADMIN00 30 already exist. The initial password is INITPASS.
System preparations
Example ABAPs
The following reports are included in the delivery system. The training systems contain local copies called
ZPDEMnnn and ZHDEMnnn. The instructor can use and change these copies during demonstrations.
RPDEM011
HR: PROVIDE Statement
RPDEM012
RPDEM013
RPDEM021
RPDEM022
RPDEM023
RPDEM031
RPDEM032
RPDEM041
RPDEM051
RPDEM061
RPDEM071
RPDEM091
RPC1ZZ00
RPSOLPRI
RHDEM081
RHDEM082
Authorization profiles
To enable you to demonstrate authorization checks, the system includes a user master record called
Darfnix (for German courses) and Mustnot (for English courses). The authorization profile is called
HR:DARFNIX or HR:MUSTNOT, and has the following values:
Prof.
(C) SAP AG
HR:DARFNIX
ISG.HR
6-6
Obj.
Name
P_BAS_REST
Field
Values
Authorization level
*
Infotype
0000-0003, 0007
Personnel area
1000-1400
Employee group
1
Employee subgroup
DA-DZ
Subtype
*
Organizational key
*
Obj.
HR: cluster
Name
HR350
Field
Values
Authorization level
S
Area ID for cluster in PCLx tables
RX, ZZ
Obj.
Name
P_TCD_ALL
Field
Values
Transaction code
*
Obj.
Name
S_SACHBEARB
Field
(C) SAP AG
Values
ISG.HR
6-7
Obj.
Name
S_TCD_ALL
Field
Values
Transaction code
*
Technical notes
After the last programming exercise, you can use report RPSOLPRI to print the participants solutions. The
report enables you to specify the number of printouts required.
(C) SAP AG
ISG.HR
6-8
(C) SAP AG
ISG.HR
6-9
Schedule
Schedule:
Day one
Approximate
times
10.0010.30
10.30-12.00
12.00-13.00
Lunch
13.00-13.30
13.30-14.00
14.00-14.20
Coffee break
14.20-14.40
14.40-15.10
15.10.15.40
15.40-16.00
Coffee break
16.30-17.00
ISG.HR
6-10
database, and enter PNP. The code can be taken from RPAUFG01.
ISG.HR
6-11
Screening criteria
Person selection
Data selection
Entries in the other period fields apply to all infotypes, while entries in the person
selection period fields only apply to infotype 0001. This enables you to determine,
for example, that evaluations skip employees without a valid infotype 0001 record in
a particular period, because data and person selection are linked by an UND
relationship.
Explain the possible entries for the payroll period, further selections, and
matchcodes.
Demonstration for the last three slides
20 minutes
Use a report to explain the possible entries in the following selection fields:
Personnel number
Employment status
Payroll area
Personnel area/subarea/cost center
Employee group/subgroup
At the same time, show where this data is stored, that is, in which infotype. Entries in these
fields affect the database selection, which means that sensible selection intervals can improve
report runtimes.
Use demo report RPDEM011 to explain the possible entries in the other period selection field
(= data selection period) and the radio buttons.
At the same time, use an alternative session to show the list of addresses for
personnel number 1911. Use the debugger to show the participants how the physical
start and end dates of a record in the header of internal table P0006 are replaced by
the contents of fields PN-BEGDA and PN-ENDDA, which contain the data selection
period set in the selection screen. The start and end dates are logically reset and then
written to the list to be created. This is a special feature of the
PROVIDE...ENDPROVIDE statement that must be made clear to the participants. If
you want to output infotype records with actual date specifications, use LOOP
processing for internal infotype table Pnnnn.
Default values on selection screen
Use a report to explain the example included in the slide, and show its effects.
Sorting
Show sorting in accordance with organizational criteria using demo report
RPDEM013.
Flow control for logical database
Show: IMG Personnel Management Human Resources
Information System Reporting Set flow control for the logical PNP
database
(C) SAP AG
ISG.HR
6-12
(C) SAP AG
ISG.HR
6-13
ISG.HR
6-14
this person. The first record in the generated list has no address data and is,
therefore, meaningless. For this reason, reactivate the IF query and restart the report.
(C) SAP AG
ISG.HR
6-15
Schedule
Schedule:
Day two
Approximate
times
09.00-09.30
Review
09.30-10.00
10.00-10.20
Coffee break
10.20-11.00
11.20-12.00
Specific commands
12.00-13.00
Lunch
13.00-14.00
Exercise: macros
14.00-14.20
Coffee break
14.20-15.00
Authorization check
15.00-15.40
Time data
15.40-16.00
Coffee break
16.00-17.00
Additional notes:
30 minutes
Review material covered on previous day
ISG.HR
6-16
infotype 0002, projection is required for the name because a change of marital status,
for example, is irrelevant.
Show the list display for infotypes 0001 and 0002 of personnel number 1911, and
show the code of report RPDEM023 in an alternative session. Start the report this
way, and show the result. In a second alternative session, activate the comment lines
in the code, and deactivate the lines with the projection fields. Start the program, and
compare the result with the previous result.
Reading time-dependent table entries
Show table T513S, and delimit the text entry for the job key of personnel number
1911. Then supplement report RPDEM023 with a routine for reading this table:
FORM RE513S.
SELECT * FROM T513S
WHERE SPRSL = SY-LANGU
AND STELL = P0001-STELL
AND ENDDA GE P0001-BEGDA
AND BEGDA LE P0001-BEGDA.
ENDSELECT.
ENDFORM.
(C) SAP AG
ISG.HR
6-17
RMAC - macros
Show RMAC module documentation in the R/3 Library. Choose the documentation
on RP-SEL-EIN-AUS-INIT from the macros for processing the INITIALIZATION
event, and show and start training report RPAUFG07 as an application example.
Choose documentation on RP-STICHTAG from the macros for processing the
TOP-OF-PAGE event, and show and start training report RPAUFG08 as an
application example.
Point out that the macros in table RMAC are available to all programs, and that
macros are never exploded in debugging mode. The customer should not create his
or her own macros, but should develop function modules instead.
Processing a specific infotype record
Show demo report RPDEM012, and point out the differences in the code. Call up an
alternative session, and show the bank data of personnel number 1911. Start RPDEM012
using various data selection periods for this personnel number.
Importing specific infotype records
Include macro RP_SET_DATA_INTERVAL in report RPDEM012, then start the report in
debugging mode and show table P0009 at the GET event.
Reading the personnel area/subarea table
Show the contents of the table, and point out the documentation on this macro in the
R/3 Library.
Changing infotypes (1)
Changing infotypes (2)
It is essential to point out that extreme caution must be exercised when records in the
database are updated directly.
Show demo report RPDEM032, and explain the code. If personnel numbers have
'DE' in the P0001-NATIO field, the report changes the entry to 'D'. Start the report
for suitable personnel numbers, call up infotype 0002 for this personnel number in
order to change it, and demonstrate that an error message is now displayed in dialog.
Now provide the field with a correct value.
(C) SAP AG
ISG.HR
6-18
Authorization check
Briefly illustrate how the authorization concept consists of objects, authorizations
and profiles, and show the menu paths in authorization maintenance.
Authorization for persons
Show and explain the HR: master data authorization object with its fields and technical
name, and show some existing authorizations with various specifications. Then show the
authorizations assigned to the DARFNIX user, and point out that this user does not have
authorization for infotype 0006 or employee subgroup X0. Log on with this user (Walldorf:
password INIT) and start report RPDEM013, then show the message on skipped personnel
numbers at the end of the list.
Authorization for data
Having logged on with the DARFNIX user, start demo report RPDEM011. An error message
is displayed because this user is not authorized for infotype 0006.
(C) SAP AG
ISG.HR
6-19
Create authorization HR:350 for the HR: Reporting object with the values
RPDEM011 in the ABAP report name field and * in the degree of simplification
field, then enter the authorization in the HR: DARFNIX profile. Log on as the
DARFNIX user, and restart report RPDEM011.
Authorization check for SQL commands
Explain demo report RPDEM041, and demonstrate how to include the statement
structure for AUTHORITY-CHECK in the code.
ISG.HR
6-20
(C) SAP AG
ISG.HR
6-21
Schedule
Schedule:
Day three
Approximate
times
09.00-09.30
Review
09.30-11.00
11.00-11.20
Coffee break
11.20-12.00
12.00-13.00
Lunch
13.00-13.20
13.20-14.20
Exporting/importing DB tables up to
slide importing data
14.20-14.40
Coffee break
14.40-15.40
15.40-16.00
Coffee break
16.00-17.00
Exporting/importing DB tables up to
slide cluster authorization
Additional notes:
30 minutes
Review material covered on previous day
(C) SAP AG
ISG.HR
6-22
ISG.HR
6-23
ISG.HR
6-24
(C) SAP AG
ISG.HR
6-25
Database tables in HR
The PAnnnn tables are transparent, that is, the underlying database system is aware
of the table structures so that database tools can also be used to perform evaluations.
The data in PCLn database tables is stored in clusters, and cannot be evaluated using
database tools.
Database tables PCLn
Database tables PCL1
Emphasize the fact that infotype texts are stored in cluster TX in PCL1, not in the respective
infotype database tables. Show the participants how texts can be created in infotype
maintenance, and that table T582A can be used to suppress text maintenance per infotype.
Table structure/PCLn
The RELID and SRTFD fields must be filled in the application program. The CLIENT and
SRTF2 fields are managed by the system. Show structure PCL1 in the dictionary to illustrate
this.
Cluster definition
Show include report RPC2RX00 with both its includes, and the PC200 and PC207 structures.
Point out that there is only one RX key for international and country-specific payroll results.
Then show include RPC1ZZ00, and explain the data definitions. Do not discuss the two
macros at this point.
Exporting data
Explain the code.
Importing data
(C) SAP AG
ISG.HR
6-26
"Absence texts
"Plant sections
"Organizational Assignment
"Absences
MOVE:
99
TO ZZ-KEY-GROUP,
SY-DATUM
TO ZZ-KEY-DATE,
1
TO ZZ-KEY-SEQNO.
EXPORT ABSTAB TO DATABASE PCL1(ZZ) ID ZZ-KEY.
IF SY-SUBRC = 0.
WRITE: Table successfully exported.
ENDIF.
Execute the changed report, then copy it using the name ZPABSIMP to create the import
version. Remove database PNP from the attributes, because it is no longer required. The code
is then modified as follows, in which respect the INFOTYPES statement and GET block can
be deleted:
REPORT ZPABSIMP.
TABLES: PERNR, PCL1,
T554T,
T001P.
DATA: BEGIN OF ABSTAB OCCURS 20,
BUKRS LIKE P0001-BUKRS,
WERKS LIKE P0001-WERKS,
BTRTL LIKE T001P-BTRTL,
AWART LIKE P2001-AWART,
ABWTG LIKE P2001-ABWTG,
END OF ABSTAB.
"Absence texts
"Plant sections
INCLUDE RPC1ZZ00.
MOVE:
99
TO ZZ-KEY-GROUP,
SY-DATUM
TO ZZ-KEY-DATE,
1
TO ZZ-KEY-SEQNO.
IMPORT ABSTAB FROM DATABASE PCL1(ZZ) ID ZZ-KEY.
IF SY-SUBRC = 0.
WRITE: Table successfully imported.
ENDIF.
(C) SAP AG
ISG.HR
6-27
END-OF-SELECTION.
SORT ABSTAB.
LOOP AT ABSTAB.
....
ENDLOOP.
Cluster authorization
Show and explain the P_PCLX authorization object and its fields.
(C) SAP AG
ISG.HR
6-28
Schedule
Schedule:
Day four
Approximate
times
09.00-09.30
Review
09.30-10.00
10.00-10.20
Coffee break
10.20-12.00
Exporting/importing DB tables:
remainder of unit
12.00-13.00
Lunch
13.00-14.20
14.20-14.40
Coffee break
14.40-15.50
15.50-16.10
Coffee break
16.10-17.00
Additional notes:
30 minutes
Review material covered on previous day
(C) SAP AG
For-period
In-period
Indicator
Explanation
01.98
01.98
01.98
01.98
(A) P
ISG.HR
6-29
01.98
02.98
01.98
01.98
(A) (P) O
01.98
01.98
02.98
03.98
(A) P
A
01.98
01.98
(A) (P) O
01.98
01.98
01.98
02.98
03.98
04.98
(A) (P) O
(A) P
A
(C) SAP AG
ISG.HR
6-30
Data model
The object-oriented data model is explained using Organizational Management as an
example. The semi-circular arrow above the organizational unit means that
relationships can exist between various organizational units. The same applies to the
position.
Relationships between organizational units
Explain the principle of relationships as follows:
O1
Top down
Bottom up
B
is line supervisor
of
A
reports to
O2
Call up detail maintenance in Organizational Management, and show the active
relationships of organizational unit 100: A 002, A 011, and B 002.
Relationships between jobs and positions
Explain the difference between jobs (= description of an activity) and positions
(= number of employees who perform this activity).
Relationships between organizational unit and position
Using organizational unit 100 as an example, show the assigned positions related
with B 003.
Relationships between person and position
Use simple maintenance in Organizational Management to show the reporting
structure of organizational unit 100. Then access infotype 0001 of a position holder,
and show how data cannot be entered in the job and position fields.
(C) SAP AG
ISG.HR
6-31
Infotypes
Show organizational unit 100 in detail maintenance. Show infotype 1000 first, and
then the description in infotype 1002. Show infotype maintenance in the IMG
(Personnel Management Organizational Management Basic Settings
Maintain infotypes).
Relationships between basic object types
Call up the IMG, choose Personnel Management Organizational Management
Basic Settings Maintain relationships, and show the allowed relationships.
Enhance the graphic with relationship number 002. Relationships are special
subtypes of infotype 1001, and each relationship has two relationship types
characterized by A (bottom up) and B (top down).
Object/infotype status
Explain and show the term "status" using the detail maintenance screen for the
organizational unit 100 object. The status can be changed by choosing Edit Status
change.
Additional data on relationships (1)
Use detail maintenance to call up position 50000028 and show the relationships,
then use the next record function to scroll to relationship A031. The header contains
the pushbutton additional data; confirm this data to discover the specification of
required language skills.
Additional data on relationships (2)
Call up the IMG, choose Personnel Management Organizational Management
Basic Settings Maintain relationships, access relationship 031, select the
relationship, and use the navigation functions to branch to the additional relationship
data. You now discover that the substructure for additional data is called PAD31.
In the ABAP Dictionary, show table HRP1001. The last field, ADATANR, contains a
32-character key that refers to the record in DB table HRPAD31. Additional data is
read from logical database PCH to the ADATA field in structure P1001.
Table infotypes
Use detail maintenance to display the description of organizational unit 100. It is
stored in DB table HRT1002.
In the ABAP Dictionary, show table HRP1002. The last field, TABNR, contains a
32-character reference to the records in DB table HRT1002. At this point, you should
provide the participants with additional information by showing table T777D
Infotypes - Dialog/Database Assignment, which applies to all HR infotypes.
Logical structures and database tables in PD
Give a brief explanation, then access and show RHPLOGI0.
Sequential evaluations
To show the existing organizational units sequentially, choose Organizational management
Reporting Organizational unit Existing.
Structural evaluations
Evaluation paths
Maintain evaluation paths
Call up the IMG, choose Personnel Management Organizational Management Basic
Settings Maintain evaluation paths, and create evaluation path YO-O-S-P "organizational
units, positions and holders". Explain customer namespaces first.
(C) SAP AG
ISG.HR
6-32
Create a report:
REPORT ZHSTRU01.
TABLES: OBJEC, GDSTR.
INFOTYPES: 0002, 1003.
GET OBJEC.
WRITE: / OBJEC-OTYPE, OBJEC-OBJID, OBJEC-STEXT.
IF OBJEC-OTYPE = P.
LOOP AT P0002 WHERE BEGDA LE PC-ENDDA
AND
ENDDA GE PC-BEGDA.
WRITE: P0002-GBDAT.
ENDLOOP:
ENDIF.
Start the report for organizational unit 100. The resulting list is not particularly well
formatted. Explain that the depth of the structure is stored in the STRUC-LEVEL
field. Then add the following lines to the report directly after the GET statement:
DO STRUC-LEVEL TIMES.
WRITE: ..
ENDDO.
Execute the report in debugging mode, and show that the internal infotype tables, as
for database PNP, are only filled with the infotypes for the respective object. When
the next object is imported, the tables are initial once again.
(C) SAP AG
ISG.HR
6-33
(C) SAP AG
ISG.HR
6-34
Schedule
Schedule:
Day five
Approximate
times
09.00-09.30
Review
09.30-10.45
10.45-11.15
Coffee break
11.15-12.30
Additional notes:
(C) SAP AG
ISG.HR
6-35
30 minutes
Review material covered on previous day
Structure parameters
Explain structure parameters, and start the report created earlier with display depth 2.
The position holders are then hidden.
Status overlay facilitates simulated activation.
Explain recursion checks as follows:
1. Recursion can occur for a relationship from O3 to O1.
O1
O2
O3
2. Recursion can occur for the following evaluation path:
O B002 O
O A002 O
Set structure conditions
Start RHSTRU00 with evaluation path O_O_S_C and set the following structure
condition:
S C *secretary A007, activate branch filter.
Point out that the GDSET structure must be specified in a report for TABLES if
structure conditions are saved as a variant.
Fill fields on selection screen
Enhance report ZHSTRU01 as follows:
INITIALIZATION.
PCHPLVAR = 01.
PCHOTYPE = O.
PCHWEGID = O-S-P.
PCHOBJID-LOW = 00000100.
APPEND PCHOBJID.
Start the report.
Structural evaluations without structure parameters
Enter screen 900 in the report attributes, and start the report.
Available internal information
The OBJEC-OBJID field for internal PD objects is filled with the same value as
(C) SAP AG
ISG.HR
6-36
OBJEC-REALO. OBJID is empty for external objects, which means you need to
access the REALO field. For example:
(K = cost center)
If an evaluation is performed for more than one root object, the change of
roots can be recognized. For example:
ON CHANGE OF GDSTR:
WRITE: / new roots.
ENDON.
To make the contents of the STRUC structure clearer, output the following fields
with a WRITE command in report ZHSTRU01: VRSIGN, VRELAT, VBEGDA,
VENDDA, LEVEL. The structure contains data on the relationship record.
Evaluation of additional data on relationships
Explain the code using the slides on additional data on relationships 1 and 2.
Evaluation of table infotypes
Show and execute demo program RHDEM081.
Evaluation of infotype index
Show and execute demo program RHDEM082. The techniques described here are
only used to improve performance when sequential evaluations are performed.
Read infotypes with function module
Explain the code.
(C) SAP AG
ISG.HR
6-37
(C) SAP AG
ISG.HR
6-38
Unit: appendix
50 minutes
(C) SAP AG
ISG.HR
6-39
Note
Before doing this exercise , use program ZSENQOFF to deactivate lock logic.
(C) SAP AG
ISG.HR
6-40