Professional Documents
Culture Documents
Programming in HR
Content
1) ABAP Programming v/s HR Programming. 2) Logical Database PNP. 3) Views Join and PROJECTION. 4) Specific Commands. 5) Authorization Check.
Content
6) 7) 8) 9) Time Data. Repetitive Structure and List Display. Exporting/Importing DB Tables in HR. HR ABAP Features.
1)
The INFOTYPE
An Info type is just another way to handle/store data. HR Data is huge and to enable easy data entry the concept of an Info type took birth.
The INFOTYPE
The existence of an Infotype implies that an internal table (system defined) and a database table of same structure exist!. Infotype 0001 (Org. Assignment). Infotype 0002 (Personal Data). Infotype 0003 (Payroll Status). HR Time Record: Infotype 2010. (Employee Remuneration Info.).
10
Data Retrieval
When you run your report, the logical database loads the personnel data for each employee into the main memory and makes it available for processing. The entire history of each info type is loaded into the main memory, that is all info type records from the lowest to highest system date.
11
Data Retrieval
Structure PERNR contains standard selections for HR Master data reporting. The data of the previous personnel number is deleted when you select another personnel number.
12
Authorization Checks
The logical database executes an authorization check for personnel data. It checks whether the master record of the user who starts the report contains the authorizations for the data that is to be read in the report. A distinction is made between a personnel and a data authorization.
13
Authorization Checks
The system first checks whether the user has an authorization for the employee in accordance with the criteria of organizational assignment. Employees for which the user has no authorization are not evaluated. The system then checks whether the user is authorized to process the info types of the specified report. A list would be meaningless if the data were not evaluated completely.
14
Screening Criteria
Two types: Person Selection. Data Selection.
15
Screening Criteria
Person Selection: Specifies those employees for whom the report is to be run. Selected by Personnel Number Range, Org Assignment, Status, etc. Selected Employees are processed in ascending order according to personnel number.
16
Screening Criteria
In the data selection field, you can define the period for which info type data is to be evaluated. Although the entire info type history is loaded into the main memory during data retrieval, the system processes only those info type records which either partly or completely are within the data selection period.
17
Report Class
Since the required selection criteria depend on the report, you must define the scope of the selection screen. You can do this by assigning the report to a report class.
18
Report Class
Assigning a report class can help in changing the LDB selection screen. In Program Attributes Screen we use EDIT-HR Report Class while using the PNP database.
19
Report Class
Report Class assignments are stored in tables T500B (Customer Class) and T599W(SAP Classes). If no report Class is assigned to a report, default report classes are used from T599C(Customer) and T599F(SAP Default Class).
20
Report Class
E.g.The time evaluation report RPTIME00 is assigned the report class __0001. The personnel number and Matchcode function key are the only permissible selection criteria in this report class.
21
Report Class
The report RPDEDTx0 (editing of payroll results;x is the country grouping) is assigned the report class X_M00002. The active selection criteria of this report are period defined/payroll area, personnel number and payroll area.
22
23
24
25
26
Example of an HR report
REPORT ZTEST_HR1. TABLES: PERNR. INFOTYPES: 0001. GET PERNR. PROVIDE * FROM P0001 BETWEEN PNPBEGDA AND WRITE: / P0001-PERNR, P0001-ENAME, P0001-BEGDA, P0001-ENDDA. ENDPROVIDE.
PNPENDDA.
27
JOIN
Personal Data: JAN 1960 MAY 1993 MAY 1993 DEC 1993 Address Data JAN 1993 DEC 1993 Result of Join JAN 1960 DEC 1992 JAN 1993 APR 1993 MAY 1993 DEC 1993 ABCD EFGH BOMBAY
JOIN
PROVIDE * FROM P0002 FROM P0006 FROM PNNNN BETWEEN PN/BEGDA & PN/ENDDA. ------------------------ENDPROVIDE.
31
JOIN
Each Infotype can be processed individually or several infotypes can be processed simultaneously. Join takes into account the validity period of the data.
32
JOIN
Personnel data is valid only for a particular time period. JOIN represents one or more validity periods during which that data of both the infotypes is valid.
33
JOIN
Any number of infotypes can be combined in a JOIN. Data to be JOINED must be UNIQUE for the validity period i.e. the time periods of the Infotype records should not overlap. To further obviate this problem the Infotype must be read using a sub-type.
34
JOIN
REPORT ZTEST_HR2. TABLES: PERNR. INFOTYPES: 0001, 0006. GET PERNR. PROVIDE * FROM P0001 * FROM P0006 BETWEEN PN/BEGDA AND PN/ENDDA WHERE P0006-SUBTY eq 1.
35
JOIN
WRITE: / PERNR-PERNR, P0001-STELL, P0006-STRAS, P0006-BE GDA,P0006ENDDA. ENDPROVIDE.
36
JOIN
Sometimes no data is available for a particular Info type in the selected partial period. Infotype validity periods may not overlap but gaps are permitted. For example, gaps can occur when personal data is joined with address data:
37
Variable Pnnnn_Valid
REPORT ZTEST_HR3. TABLES: PERNR. INFOTYPES: 0002,0006 GET PERNR. PROVIDE * FROM P0002 * FROM P0006 BETWEEN PN/BEGDA AND PN/ENDDA WHERE P0006-SUBTY = 1.
38
Variable Pnnnn_Valid
IF P0006_VALID EQ X. WRITE: / PERNR-PERNR, P0002-BEGDA DD/MM/YYYY, P0002-ENDDA DD/MM/YYYY, P0002-NACHN, P0006-ORT01. ENDIF. ENDPROVIDE.
39
PROJECTION
Selecting one or more infotype fields for processing is called Projection. The process of combining data records during projection is called contraction. Projection is only allowed for time constraints 1 and 2.
40
PROJECTION
REPORT ZTEST_HR. TABLES: PERNR. INFOTYPES: 0001, 0006. GET PERNR. PROVIDE STELL FROM P0001 BETWEEN PNPBEGDA AND PNPENDDA. ENDPROVIDE.
41
4) SPECIFIC COMMANDS
42
RMAC - MACROS
Like Subroutines and Function modules Macros can be used to modularize codes. They are in TRMAC Table. The first two letters are the application and the rest are freely assigned.
43
45
46
Changing Infotypes
RP-UPDATE macro update the database. RP-UPDATE OLD NEW. Parameters: Old Internal Table, New Internal Table. This macro calls the update routine of HR file.
47
Changing Infotypes
You cant make key changes, which means you cant create or delete data. In customer specific info types it may be useful to create utilities to change HR data directly in Database tables. To ensure the consistency of the table entries database changes should always made with batch reports which automatically execute online data checks.
48
Changing Infotypes
Three steps involved in changing Info types. Select the Info type to be changed. Make the required changes and store the records in an alternative table.
49
Changing Infotypes
REPORT ZTEST_HR. TABLES: PERNR. INFOTYPES: nnnn NAME OLD nnnn NAME NEW. GET PERNR. PROVIDE * FROM OLD.. NEW = OLD.
50
Changing Infotypes
APPEND NEW. ENDPROVIDE. RP-UPDATE OLD NEW.
51
52
5) Authorization Checks
55
Authorization Checks
Checks if a person starting the report has the required authorizations. LDB does this check automatically. HR makes a distinction between two types of authorization , one for person and another for data.
56
57
58
6) Time Data
60
Time Data
A characteristic of the PROVIDE is that the Validity period of IT records is restricted to the data selection period on the selection screen. Time data IT 2001 is determined on the basis of the validity period. The number of Absence days is calculated on the basis of absence period.
61
Time Data
Since the data depends on the validity period , time infotypes leads to incorrect data. PROVIDE statement is not used for time infotypes ( 2000- 2099).
62
Time Data
A principle of the LDB is that all of the IT records between the lowest to highest system dates are read when GET PERNR event occurs. Bad performance issues because of memory problem while reading large time data.
63
Time Data
To control this MODE N is assigned while declaring the time Infotypes.
RP_READ_ALL_TIME_ITY.
64
65
Repetitive Structure
On some infotype entry screens like leave data is entered in Tables. All of the fields in this table structure are named and defined in the Infotype structure on which they are based. Table datas are stored in a linear structure.
66
Repetitive Structure
In some Infotypes data entered in screen tables is stored as repeat fields groups on the database. Loop Processing within DO/ENDDO or WHILE/ENDWHILE can be used to transport such data block by block to work area, where it continues to be processed.
67
List Display
Function Module HR_DISPLAY_BASIC_LIST. Used to display single-level lists. Maximum no. of column is 20.
68
8) Export/Import DB Tables in HR
69
Export/Import Tables in HR
Database Tables in HR. Pannnn (personnel data), PCL1(HR Work Areas), PCL2(Acctg Results & Payroll), PCL3(Applicant, Tracking Record)PCL4(Documents).
70
Data Clusters
Data Clusters have a two character code. Each HR subarea has its own cluster and its own key.
71
72
73
Table Management
EXPORT IMPORT Commands are used A Unique KEY ID is required to read or write from/to table. The field PCLn-RELID stores the basic relation type i.e the cluster (RX for payroll accounting, TE for Travel Expenses etc).
74
Cluster Definition
Data definitions of a work area are stored
in separate programs.
Naming convention for these programs is RPCnxxy0 ( n = 1 or 2, xx = Cluster Name, y = 0 for international). The key structure is stored in xx-KEY field string. The first component of this field string is PERNR.
75
76
9) HR ABAP Features
77
HR ABAP Features
Accessing Reports using Dynamic Action. Table T588Z is a control table that triggers steps taken when an IT record is maintained. Selection reports for fast entry. Reports that are used for fast entry are contained in table T588R.
78
HR ABAP Features
Accessing subroutines for specific periods. Table T596F enables you to access various subroutines for specific periods in order to solve a task defined by a symbolic name.
79
HR ABAP Features
Accessing Feature from Reports. PERFORM RE549D USING par1 par2 par3 par4. Par1 Feature name. Par2 Error handling type. Par3 Return value. Par4 The type of error. Eg: RPCPBSRC.
80
THANK YOU