Vous êtes sur la page 1sur 40

0

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

Goals and objectives..................................................................................................9


Course structure and procedure...............................................................................9
Schedule....................................................................................................................10
Schedule:......................................................................................................................................... 10
Day one............................................................................................................................................ 10

Unit: logical database PNP......................................................................................10


Unit: views - JOIN and PROJECTION.....................................................................14
Schedule....................................................................................................................16
Schedule:......................................................................................................................................... 16
Day two............................................................................................................................................ 16

Unit: specific commands.........................................................................................18


Unit: authorization check.........................................................................................19
Unit: time data...........................................................................................................20
Schedule....................................................................................................................22
Schedule:......................................................................................................................................... 22
Day three......................................................................................................................................... 22

Unit: repetitive structures and list display.............................................................22


Unit: exporting/importing DB tables.......................................................................26
Schedule....................................................................................................................29
Schedule:......................................................................................................................................... 29
Day four........................................................................................................................................... 29

Unit: logical database PCH......................................................................................32

(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

HR: RP_PROVIDE_FROM_LAST Macro

RPDEM013

HR: Effect of Sort Fields on Selection Screen

RPDEM021

HR: JOIN of Infotypes

RPDEM022

HR: Projection on Infotype Fields

RPDEM023

HR: Combination of JOIN and PROJECTION

RPDEM031

HR: Read Infotypes Without Logical DB

RPDEM032

HR: Direct Modification of HR Data in DB

RPDEM041

HR: Authority Check for SELECT

RPDEM051

HR: Read Time Data With RP-READ-ALL-TIME-ITY

RPDEM061

HR: Repeat Structures

RPDEM071

HR: Read Cluster RX Using CD Manager

RPDEM091

HR: Call Feature ABKRS

RPC1ZZ00

HR: Cluster Definition ZZ / PCL1

RPSOLPRI

HR: Print Solution Reports

RHDEM081

HR: Read Table Infotypes

RHDEM082

HR: Selection via Infotype Index

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.

HR: master data

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.

HR: transaction code

Name

P_TCD_ALL
Field

Values

Transaction code
*

Obj.

ABAP: program flow checks

Name

S_SACHBEARB
Field

(C) SAP AG

Values

ISG.HR

6-7

User activity for ABAP program


BTCSUBMIT, SUBMIT
Authorization group for ABAP program
' '

Obj.

Check transaction code for transaction start

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

Goals and objectives


This course is intended for people who want to program their own HR evaluations, or adapt existing
standard evaluations. It is not an introduction to programming, as it only deals with the special features of
programming within HR (PA and PD). Once the course has been completed, a programmer with previous
ABAP skills should be able to create reports for the HR application component.

Course structure and procedure


The course is divided into 9 units. Units 1 - 7 are based on R/3 documentation on programming in HR and
deal with the special features of logical database PNP (personnel administration). Unit 8 deals with the
special features of logical database PCH (personnel development). Unit 9 contains information on special
topics that is not essential, but is certainly useful.

(C) SAP AG

ISG.HR

6-9

Schedule
Schedule:
Day one
Approximate
times

Contents: units and topics

Activities: instructor and participants

10.0010.30

Introduction of course and


participants

10.30-12.00

Logical database PNP

12.00-13.00

Lunch

13.00-13.30

Logical database PNP

Presentation and demonstration

13.30-14.00

Exercise: creating a list of employees

Participants program a report

14.00-14.20

Coffee break

14.20-14.40

Appendix: creating customer-specific


report categories

Presentation and demonstration

14.40-15.10

Exercise: creating customer-specific


report categories

Participants use the IMG to create their own


report category, and assign it to their report

15.10.15.40

Views: JOIN and projection up to


join/subtypes slide

Presentation and demonstration

15.40-16.00

Coffee break

16.30-17.00

Exercise: Join for infotypes

Presentation and demonstration

Participants program a report

Unit: logical database PNP


150 minutes

Presenting the unit in context


This unit teaches the participants about the basic special features of logical database PNP within HR.
The participants learn about the data structures and functions of logical
database PNP. They process the period-specific HR data in the report using a
PROVIDE...ENDPROVIDE, and can use screening criteria for data and person
selection.

Logical database PNP: objectives


Present the contents of the unit, and show the participants how and where to access the
Programming in HR documentation in the R/3 Library. Next, show the participants the HR
RPAUFGnn training reports in a list, and recommend that they study them in their own time.
Then create a report as a local object, declare attributes, particularly the fields for the logical
(C) SAP AG

ISG.HR

6-10

database, and enter PNP. The code can be taken from RPAUFG01.

Functions of logical database PNP


It must be emphasized that the system always imports the entire history of an
infotype (that is, all of the records between the lowest and highest system date) into
the main memory.
Logical structures and database tables in PA
Infotype data structures
Explain the data structures, and show them in the dictionary.
Additional structures for screen fields
Many infotypes have Qnnnn structures for batch input processing. This enables the
form of address to be entered as a word in infotype 0002, for example. In the
database, however, only a one-character code is stored in the ANRED field.
Show the infotype screen in dialog while using a second session to show dictionary
structure PS0002.
Data retrieval
Use a slide to note that the INFOTYPES statement has the same effect as an internal
table created as follows:
BEGIN OF Pnnnn OCCURS 10.
INCLUDE STRUCTURE Pnnnn.
END OF Pnnnn.
Processing master data
As a demonstration, start the program that was just created in debugging mode, and
show the participants internal table P0002, which is filled by database program
SAPDBPNP with the records from the DB each time the personnel numbers change.
Then start demo program RPDEM011 with the debugger but without entering data in
the data selection period, and show the contents of system fields PN-BEGDA and
PN-ENDDA (1800 and 9999). Neither field has any effect on the selection from the
DB, but their contents do have an effect when the records imported in the internal
infotype tables are processed.
Loop nesting
Data on specific periods (1)
Data on specific periods (2)
Whenever HR data is processed using a validity start and end date, you can choose
to process all valid records or just the first or last valid record for an evaluation
period of, for example, one calendar year. A record is considered valid if it overlaps
by at least one day with the evaluation period, or lies completely within the
evaluation period. The PROVIDE...ENDPROVIDE statement provides data on
specific periods that is dependent on the chosen data selection period. You can
demonstrate this using report RPDEM011, which outputs address data. You should
also use an alternative session to show infotype 0001 for a personnel number in list
display using more than one record of this infotype.
A macro is used to output the last record in a data selection period. These special
features of HR are discussed in detail in the unit on specific commands, so you
should not demonstrate the macros at this point.
(C) SAP AG

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

Exercise for logical database PNP


Topic: creating a list of employees
30 minutes
The participants create a report that produces a list of employees. Infotype 0002 is
processed using a PROVIDE...ENDPROVIDE. Outputting the name using the
NAME structure shows the participants that it is to their advantage to use the LIKE
statement for data definitions, because the field then adopts the characteristics of the
field to which reference is made.
At this point, you should show the slides from the appendix about creating customerspecific report categories, and carry out its exercise.
See the appendix for an explanation.

(C) SAP AG

ISG.HR

6-13

Unit: views - JOIN and PROJECTION


160 minutes

Presenting the unit in context


This unit is about logical database operations JOIN and PROJECTION, and reading table entries for
specific periods. These topics are important because the question of how HR data for specific periods is
processed must always be answered when programs are created. For this reason, the instructor must ensure
that all participants have understood the logical database operations. This unit includes an exercise on
JOIN, PROJECTION, and reading table entries.
The participants can process two or more infotypes in a PROVIDE ENDPROVIDE loop. When an infotype is processed, they can use projection for
changes in one or more fields, link both views with each other, and read text
entries for specific periods from tables.

Join creating intervals


You can enhance the slide with handwritten notes based on the following HR
situation:
Ms Miller was born on February 3, 1960. For this reason, the time axis of infotype
0002 has been extended to the left, because this infotype only has the date of birth as
the start date of the first physical record. She starts working at the enterprise on
January 1, 1994 and is assigned to personnel area 1. On October 1 1994, she gets
married and so changes her name to Ms Meier. On January 1 1995, she is reassigned
to personnel area 2. As of April 1 1995, she must be addressed as Doctor Meier.
Therefore, the database contains three physical records of infotype 0002, and two of
infotype 0001. Using these physical records, the JOIN creates five logical records
that appear in a list with the respective start and end date, name, and personnel area.
Join / code
Explain the syntax.
Join and time constraint
Explain the three types of time constraint, and then show how to determine an
infotype's time constraint.
Join / subtypes
Supplement the slide with the time axes of both infotypes, and draw the
P0006_VALID variable using your value for both logical partial periods. Enhance
the code with the IF query.

Demonstration for the last slide


10 minutes
Call up demo report RPDEM021, deactivate the IF query, and start the report for
personnel number 1911. In an alternative session, show infotypes 0002 and 0006 for
(C) SAP AG

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.

Exercise for views - JOIN and PROJECTION


Topic: JOIN for infotypes
30 minutes
The participants create a report in which the personal data and addresses infotypes
are output using a join. Data output must be dependent on the contents of the
P0006_VALID variable.

(C) SAP AG

ISG.HR

6-15

Schedule
Schedule:
Day two
Approximate
times

Contents: units and topics

Activities: instructor and participants

09.00-09.30

Review

Presentation, ask participants questions

09.30-10.00

Views: JOIN and projection as of the


projection and contraction slide

Presentation and demonstration

10.00-10.20

Coffee break

10.20-11.00

Exercise: projection for infotype


fields

Participants program a report

11.20-12.00

Specific commands

Presentation and demonstration

12.00-13.00

Lunch

13.00-14.00

Exercise: macros

14.00-14.20

Coffee break

14.20-15.00

Authorization check

Presentation and demonstration

15.00-15.40

Time data

Presentation and demonstration

15.40-16.00

Coffee break

16.00-17.00

Exercise: cumulated absences

Participants program a report

Participants program a report

Additional notes:
30 minutes
Review material covered on previous day

Projection and contraction


In the following example, an employee who works as an instructor changes company
code several times at the beginning of the year. If a simple activity evaluation is
performed, the change of organizational unit is not relevant, so interest can be
'projected' to the job field. The result is a single logical record.
Projection / code
Call up demo report RPDEM022 and start it using both variants of the PROVIDE
statement for personnel number 1911, which has several infotype 0001 records. In an
alternative session, show the infotype list display.
Join and projection
Use the following example to explain the link between join and projection. You want
to create a job evaluation, so information is required from infotypes 0001 and 0002.
In the case of infotype 0001, projection is required for the job field because changes
in other fields, such as a change of personnel area, are of no interest. In the case of
(C) SAP AG

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.

Exercise for views - JOIN and PROJECTION


Topic: projection for infotype fields
40 minutes
The participants create a report in which the organizational assignment and personal
data infotypes are joined. Within the infotypes, projection is required for the job, last
name, and first name fields. The job text valid on the start date of the record must be
read for the job key from table T513S.

(C) SAP AG

ISG.HR

6-17

Unit: specific commands


100 minutes

Presenting the unit in context


The code learned by the participants thus far is now supplemented by HR-specific macros and function
modules.
The participants can use HR-specific macros and function modules in their
programs.

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

Reading infotypes without logical DB (1)


Reading infotypes without logical DB (2)
Application example: SD reports in which the HR data of field sales employees must
be read.
Show and execute demo report RPDEM031.

Exercise for specific commands


Topic: macros
60 minutes
The participants create a program that lists all of the recurring benefits and
deductions for employees. Macros RP_PROVIDE_FROM_LAST and RP-READT001P should be used.

Unit: authorization check


40 minutes

Presenting the unit in context


The participants learn how to deactivate the authorization check for particular reports, and how to perform
the authorization check themselves within a report using SQL select commands.
The participants can explain the difference between authorization for persons
and authorization for data, deactivate the authorization check for selected
reports, and use the AUTHORITY-CHECK for SQL commands.

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

Deactivating the authorization check

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.

Unit: time data


100 minutes

Presenting the unit in context


The participants learn the difference between processing time data, and processing the master data
previously imported.
The participants can explain how the contents of time data infotypes depend on
the validity period. They import time data using macro RP-READ-ALL-TIMEITY, and process it using an internal table.

Time data and validity period


Use the example in the R/3 documentation entitled Programming in HR, time data
to underline the information contained in the slide, and explain why there is little
point in using views such as join and projection for time data.
Importing time data
Point out that time infotype 2011 is not available in internal tables.
Loop nesting
Use demo report RPDEM051 in debugging mode to show that internal table P2001 has not
been filled when the GET PERNR event occurs. Then show the list display of absences for
personnel number 1911. At the same time, use the debugging mode to demonstrate that
absences are only imported if they are in the chosen data selection period. Caution: if the data
selection period only covers one month, the demo program and model solution for the
programming exercise cannot re-evaluate time records for more than one month. The work
schedule would have to be imported, among other things. For this reason, you must ensure
that the data selection period is big enough for the demonstration. As an example,
demonstrate standard evaluation report RPTABS00.
Importing time data in an internal table

Explain an example of code, particularly the difference between COLLECT and


APPEND.
(C) SAP AG

ISG.HR

6-20

Processing time data using an internal table


Show table processing using training report RPAUFG39 in debugging mode.

Exercise for time data


Topic: cumulated absences
60 minutes
The participants create a program to cumulate the employees' absences and output
the totals per company code, personnel area, personnel subarea, and overall. To
import time data, use the RP-READ-ALL-TIME-ITY macro. To process time data,
use an internal table.

(C) SAP AG

ISG.HR

6-21

Schedule
Schedule:
Day three
Approximate
times

Contents: unit and topics

Activities: instructor and participants

09.00-09.30

Review

Presentation, ask participants questions

09.30-11.00

Repetitive structures and list display

Presentation and demonstration

11.00-11.20

Coffee break

11.20-12.00

Exercise: directly valuated payments


of an employee

12.00-13.00

Lunch

13.00-13.20

Exercise: directly valuated payments


of an employee

Participants program a report

13.20-14.20

Exporting/importing DB tables up to
slide importing data

Presentation and demonstration

14.20-14.40

Coffee break

14.40-15.40

Exercise: exporting and importing


data objects

15.40-16.00

Coffee break

16.00-17.00

Exporting/importing DB tables up to
slide cluster authorization

Participants program a report

Participants program a report

Presentation and demonstration

Additional notes:
30 minutes
Review material covered on previous day

Unit: repetitive structures and list display


130 minutes

Presenting the unit in context


This unit is about processing infotypes with repetitive structures, and outputting data using table control,
which is useful for forwarding report lists to PC products such as WORD and EXCEL.

(C) SAP AG

ISG.HR

6-22

The participants can evaluate infotypes with repetitive structures in loop


processing (DO...ENDDO) and output the data using the
HR_DISPLAY_BASIC_LIST function module in table control.

Repetitive structures/leave entitlement


Show infotype 0005, and show structure P0005 in the dictionary at the same time.
Repetitive structures
Explain how to import blocks of data in the internal work area. The curved arrow in
the display represents the distance.
Repetitive structures/evaluation (1)
Make sure the participants know that they should always use the LIKE statement for data
definitions whenever possible because changing the SAP field then causes the internal report
field to be adjusted automatically. A structure such as this one can be shorter than the
repetitive structure in the database, that is, fields can be omitted at the end, but not in the
middle.

Repetitive structures/evaluation (2)


Explain an example of code, and supplement it with an IF query:
IF VACATION-UAR IS INITIAL.
EXIT.
ELSE.
WRITE:...
ENDIF.
Show demo program RPDEM061. At the same time, show the basic pay of a
personnel number for which the wage types are not valuated indirectly. Execute the
program, and then show alternative code using WHILE...ENDWHILE.
If the participants notice at this point that the demo program does not perform an
indirect valuation, show report RPLPAY00, which performs an indirect valuation
using function module RP_FILL_WAGE_TYPE_TABLE_EXT.
Function module HR_DISPLAY_BASIC_LIST (1)
Show the table control display using program RPLMIT00 (employee directory).
Advise the participants to look at the code for this program and for report
RPLKFZ00 (vehicle list), which is somewhat simpler.
Then use the system to explain the function module interface (the parameters listed
on the slide).
Function module HR_DISPLAY_BASIC_LIST (2)
Change demo program RPDEM023 so that the list of jobs is now output using the
function module. First, create the data table:
DATA: BEGIN OF DATA_TAB OCCURS 10,
PERNR LIKE P0001-PERNR,
NACHN LIKE P0002-NACHN,
VORNA LIKE P0002-VORNA,
STELL LIKE P0001-STELL,
STLTX LIKE T513S-STLTX,
(C) SAP AG

ISG.HR

6-23

BEGDA LIKE P0001-BEGDA,


ENDDA LIKE P0001-ENDDA,
END OF DATA_TAB.
Then add the FIELDNAMES and ERROR_TABLE tables.
Then fill the DATA_TAB table at the GET event.
Function module HR_DISPLAY_BASIC_LIST (3)
The FIELDNAMES table contains a table line for each field in the table control list.
If the data table field to be output is a field from a structure included in the
dictionary, you then copy the name of the structure to the TABLE field, and the
name of the field to the FIELD field. If the field is a key field, you copy string X to
the TYPE field. This ensures that the field header is supplied with data from the
dictionary, and that the F1 help function is available.
The FIELDNAMES table is filled during the demonstration as follows:
FIELDNAMES-TABLE = 'PERNR'.
FIELDNAMES-FIELD = 'PERNR'.
FIELDNAMES-TYPE = 'X'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TABLE = 'P0002'.
FIELDNAMES-FIELD = 'NACHN'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TABLE = 'P0002'.
FIELDNAMES-FIELD = 'VORNA'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TABLE = 'P0001'.
FIELDNAMES-FIELD = 'STELL'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TABLE = 'T513S'.
FIELDNAMES-FIELD = 'STLTX'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TITLE = 'Beginn'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
FIELDNAMES-TITLE = 'Ende'.
APPEND FIELDNAMES.
CLEAR FIELDNAMES.
Function module HR_DISPLAY_BASIC_LIST (4)
Access table 100 message classes 70 and 72, and show the entries. Then explain how
the ERROR_TABLE must be filled.
If SY-SUBRC has a value other than 0 after table T513S has been read, an error
message (error number 019) is read from message class 72 to the ERROR_TAB
table:
PERFORM ERROR_HANDLING USING PERNR-PERNR '72' 'I' '019'
(C) SAP AG

ISG.HR

6-24

P0001-STELL SPACE SPACE SPACE.


The required ERROR_HANDLING routine corresponds to the routine in model
solution RPSOL060, to which you are now referred.
Finally, include the function module in the report at the END-OF-SELECTION
event (statement structure), and set the parameters as required.
CALL FUNCTION 'HR_DISPLAY_BASIC_LIST'
EXPORTING
BASIC_LIST_TITLE = 'job evaluation'
FILE_NAME
= SY-REPID
HEAD_LINE1
= 'employees and their jobs'
TABLES
DATA_TAB
= DATA_TABLE
FIELDNAME_TAB
= FIELDNAMES
ERROR_TAB
= ERROR_TABLE
DOWNLOAD_PROBLEM
=1
NO_DATA_TABLE_ENTRIES = 2
TABLE_MISMATCH
=3
PRINT_PROBLEMS
=4
OTHERS
= 5.

Exercise for repetitive structures and list display


70 minutes
The participants create a report that adds up the directly valuated wage types from
the basic pay infotype, and uses the HR_DISPLAY_BASIC_LIST function module
to output a list with the PERNR, name, total of directly valuated payments, and
currency indicator.

(C) SAP AG

ISG.HR

6-25

Unit: exporting/importing DB tables


420 minutes

Presenting the unit in context


This unit tells the participants how payroll results are compiled, where data structures are defined, and how
data is stored in the database. This enables them to adjust the standard evaluation programs to meet specific
customer requirements. Furthermore, customers can use clusters as a simple method of storing their own
data in the appropriate database tables. The participants must be made aware of this fact when this unit is
first presented.
The participants can use the CU_READ_RGDIR and
CD_EVALUATION_PERIODS function modules to import and process the
results of international payroll accounting in cluster RX.

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.

Database tables PCL1


Explain what is stored in clusters.
DB table administration/PCLn
Emphasize the fact that both commands can be used to store any data objects in the cluster
databases without having to take storage techniques into account.

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

Explain the code.


Demonstration for the last two slides.
20 minutes
Copy RPSOL050 to ZPABSEXP. Once it has been output in cluster ZZ (Zn is intended for
customer-specific clusters), internal table ABSTAB of this report should be stored in PCL1.
Include program RPC1ZZ00, which the participants should use in both of the following
exercises, is only used here for the key structure. The NAMES structure is not used. The
report must then be modified by the lines of code in bold type:
REPORT ZPABSEXP.
TABLES: PERNR, PCL1,
T554T,
T001P.
INFOTYPES: 0001,
2001 MODE N.
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.
INCLUDE RPC1ZZ00.
GET PERNR.
....
END-OF-SELECTION.
SORT ABSTAB.
LOOP AT ABSTAB.
....
ENDLOOP.

"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.

Exercise for exporting/importing DB tables


Topic: exporting and importing data objects
60 minutes
The participants create two reports. They use the first to fill the NAMES structure
from RPC1ZZ00, and then export it as cluster ZZ. The second report is used to
import the structure.

Importing/exporting using macros


Use include RPC1ZZ00 to show and explain the macros RP-EXP-C1-ZZ and RP-IMP-C1ZZ. Then show RX-EXP-C2-RX in include RPCXRXX0.

Importing/exporting using the buffer


Call up the R/3 documentation entitled Programming in HR, access the unit on
importing and exporting files in HR, and show the section on PCLn buffers with
their examples to explain why payroll results are stored temporarily in the buffer.
Exporting using the buffer
Point out that the macro accesses routines from RPPPXM00, which means that the include
must be at the end of the report. Explain that the update task is used to update the payroll
results, which ensures that restarts can be performed.

Importing using the buffer


Note: The RP-IMP-xy-SUBRC return code is used for exporting and importing.

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

Contents: unit and topics

Activities: instructor and participants

09.00-09.30

Review

Presentation, ask participants questions

09.30-10.00

Exercise: exporting and importing


data objects using the buffer

Participants program a report

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

Exercise: output payroll results

14.20-14.40

Coffee break

14.40-15.50

Unit: logical database PCH up to the


slide structural evaluations code

15.50-16.10

Coffee break

16.10-17.00

Exercise: create a list of staff position


holders

Presentation and demonstration

Participants program a report


Presentation and demonstration

Participants program a report

Additional notes:

30 minutes
Review material covered on previous day

Exercise on exporting/importing DB tables


Topic: exporting and importing data objects using the buffer
30 minutes
The participants modify their solutions to the previous exercise so that data is
exported and imported using macros.
Payroll results
Use report RPCLSTRX to show the payroll results of personnel number 1911, for which the
payroll ran using RPCALCX9. Point out the five-digit number of the payroll results.
Then explain tax indicators A, P, and O using the following example:

(C) SAP AG

For-period

In-period

Indicator

Explanation

01.98

01.98

Payroll for period 01

01.98

01.98

(A) P

Payroll for per. 02 with


retro. accounting to period 01

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

Payroll for per. 03 with


retro. accounting to period 01

Payroll for per. 03 with


retro. accounting to period 01

Data flow in payroll accounting


Run the payroll for a personnel number, and show table RT in the log. At the same
time, use standard evaluation program RPCLSTxy (xy = cluster ID) to import the
results and show table RT.

Cluster definition/payroll results (1)


Cluster definition/payroll results (2)
Show the code for report RPC2RX00, and explode include RPC2RX01. Show
structure PC207, which contains the fields from tables RT/CRT of the payroll cluster.
Reading the cluster directory
Use report RPCLSTCU to show and explain the contents of cluster CU and the
structure of table RGDIR.
Explain the interface of function module CU_READ_RGDIR.
Processing the cluster directory
Explain the interface of function module CD_EVALUATION_PERIODS, and point
out that the period modifier must be transferred from table T549A. Show table
T549A and explain the significance of this field.
Explain the interface of the CD_READ_PREVIOUS and
CD_READ_PREVIOUS_ORIGINAL function modules.
Utilities/delete clusters
Call up transaction PU00 for a personnel number for which the payroll has already
run, and an error message is displayed. Show the participants the payroll status
infotype, and explain what to do if a personnel number needs to be deleted from a
test system.
Then access and show reports RPUPnD00, RPUPnD10, and RPUDEL20.

Exercise for exporting/importing DB tables


Topic: output payroll results
80 minutes
The participants write a report to output the results of an international payroll run.
They use the function modules, and output the wage types and amounts from table
RT.

(C) SAP AG

ISG.HR

6-30

Unit: logical database PCH


195 minutes

Presenting the unit in context


Now that the participants have learned about the special features of logical database PNP and clustered data
structures for payroll results, this unit provides them with report programming skills using logical database
PCH. Most of the participants know more about the infotypes used in Personnel Administration than about
the basic concepts of object-oriented data models, so the unit starts with an introduction to Organizational
Management.
The participants can create reports for sequential and structural evaluations,
and evaluate additional relationship data.

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

No. Obj. type A/B Relationship Priority Type Obj. Skip


1
O
B 002
*
O
2
O
B 003
*
S
3
S
A 008
*
P
The priority field is important for Training and Event Management, for example, but is not
relevant to this evaluation path and is therefore set to *.
To make the significance of the SKIP field clear, create an evaluation for organizational unit
100 using RHSTRU00, and use this evaluation path with the skip flag set/not set for the first
line.
Report RHWEGID0, which is mentioned in the documentation, is accessed using the input
help function.

Sequental evaluations - code


Create a report:
REPORT ZHSEQU01.
TABLES: OBJEC.
INFOTYPES: 1003.
GET OBJEC.
WRITE: / OBJEC-OTYPE, OBJEC-OBJID, OBJEC-STEXT.
LOOP AT P1003 WHERE BEGDA LE PC-ENDDA
AND
ENDDA GE PC-BEGDA.
WRITE: / P1003-ABTEL.
ENDLOOP.
Start the report, and explain the selection screen. Do not explain the structural conditions.
Structural evaluations code

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

Exercise for logical database PCH


Topic: create a list of staff position holders
50 minutes
The participants create a report that lists the staff positions along the organizational
structure, together with their holders.

(C) SAP AG

ISG.HR

6-34

Schedule
Schedule:
Day five
Approximate
times

Contents: unit and topics

Activities: instructor and participants

09.00-09.30

Review

Presentation, ask participants questions

09.30-10.45

Remainder of unit: logical database


PCH

Presentation and demonstration

10.45-11.15

Coffee break

11.15-12.30

Unit: HR ABAP features

Presentation and demonstration

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

Unit: HR ABAP features


75 minutes

Presenting the unit in context


This unit contains information on a number of topics that have yet to be discussed.
The participants can describe how subroutines are accessed from dynamic
actions, and explain how subroutines are accessed for specific periods. They
know how to make the system aware of their own selection reports for fast
entry, and how features can be accessed from their own reports.

Accessing reports using dynamic actions


Show table T588Z, and explain the fields using the example on the slide.
Selection reports for fast entry
Use a report to perform the fast entry of HR data with personnel number screening,
then show table T588R. Point out that the table responsible for transferring data to
the transaction must be called PERNRTAB.
Accessing subroutines for specific periods
Explode the entries in table T596F for symbolic name DSTEUER1. These entries
are read by the German payroll driver, RPCALCD0, depending on the year in which
the period occurs for which the payroll must run. The module pool and module fields
contain the name of the subroutine and the routine used to calculate employment tax.
Accessing features from reports
Use transaction PE03 to show structure PME04 and the decision fields of feature
ABKRS, then provide a brief explanation of the decision tree. Show and execute
report RPDEM101 as an example.

(C) SAP AG

ISG.HR

6-38

Unit: appendix
50 minutes

Presenting the topic in context


The slides included in the appendix can also be discussed. As of release 4.0, report categories are discussed
in HR307. However, not all of the participants in this course will have attended HR307, so it is a good idea
to discuss this topic, preferably after the first unit. An exercise has been included. The slides on the cluster
directory manager and function module RP-EVALUATION_PERIODS, on the other hand, are merely
intended to increase the participants' understanding of the programs that use these functions. The cluster
directory manager is described in detail in the R/3 documentation.
The participants can maintain report categories to create their own selection
screens, which they can then assign to their programs.

SAP - report categories


This slide is used to explain the structure of the eight-character key for SAP report categories.
Individual report categories contain meaningful groups of selection fields. Customers can use
these report categories for their own reports, or they can create their own.

IMG: create report categories


First, the instructor shows the participants the documentation on the corresponding
IMG step (see the model solution to the last exercise for the path), then the instructor
creates numeric report category 00000350. Suggestion: data selection period =
person selection period, sorting and matchcode allowed, interval specified in the data
selection period, no entry for person selection period and payroll area, etc. Explain
this view's navigation options to the participants, and enter meaningful data as
selection criteria, for example, personnel number, personnel area, personnel subarea,
employee group, employee subgroup, and supervisor area.
IMG: assign report categories
Assign report category 00000350 to report RPDEM011, and start the report.

Create exercise for customer-specific report categories


30 minutes
The participants create their own report categories, and assign them to their reports.

(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

Vous aimerez peut-être aussi