Post on 04-Apr-2018
7/29/2019 Programming in HR - Day 3
1/38
Day - 3Programming in HR
7/29/2019 Programming in HR - Day 3
2/38
Agenda
Logical Database PNP
Structure of DB tables in PA
Infotype Structure Time Constraints
Data Retrieval
7/29/2019 Programming in HR - Day 3
3/38
Functions of LDB
7/29/2019 Programming in HR - Day 3
4/38
The logical database has three main functions.
Data retrieval:HR data is written on an employee by employee basisto the main memory, where it can be processed.
Screening:A selection screen enables you to select employees inaccordance with organizational criteria. For example,you can select all of the hourly-wage earners in aparticular personnel subarea.
Authorization check:The system checks that the user starting an evaluationis authorized to access the data.
Functions of LDB
7/29/2019 Programming in HR - Day 3
5/38
Structure of DB Tables in PA
7/29/2019 Programming in HR - Day 3
6/38
The Pnnnnstructure contains an infotype's key fields
and data fields.
The data fields in structure PSnnnn are grouped
together to ensure that definitions contain as few
redundancies as possible.
Structure Qnnnn contains special screen fields for the
respective infotype.
Structure PERNR contains the standard selections for
the logical database PNP.
Structure of DB Tables in PA (contd..)
7/29/2019 Programming in HR - Day 3
7/38
Database tables PAnnnn and PBnnnn are transparent,which means that:
Each infotype has its own database.
Each infotype has an individual length, so that you are
not required to keep additional space on the database. Information can be found more quickly (using an index
search).
Infotypes can be evaluated using any SQL tools.
Structure of DB Tables in PA (contd..)
7/29/2019 Programming in HR - Day 3
8/38
Infotype Structure
7/29/2019 Programming in HR - Day 3
9/38
In Reporting, structure Pnnnn is used as an
interface between the program and the
database.
It contains the data fields of structure PSnnnn,and data fields that occur in every infotype
(PSHD1).
Key PSKEY contains the fields of structure
PAKEY, and an additional field for infotype
number nnnn.
Infotype Structure
7/29/2019 Programming in HR - Day 3
10/38
Additional Structures for Screen fields
7/29/2019 Programming in HR - Day 3
11/38
If fields (such as header lines) are displayed forevery infotype, they are stored in structureRP50M.
Structure Qnnnn also exists for many infotypes. It
contains screen fields for data entry. Anemployee's form of address, for example, is storedin field P0002-ANRED with a numeric key. Thescreen, however, must enable the form of addressitself to be displayed and entered, not its numeric
key. For this reason, additional field Q0002-ANREX is used.
Additional Structures for Screen fields
7/29/2019 Programming in HR - Day 3
12/38
Data Retrieval
7/29/2019 Programming in HR - Day 3
13/38
Processing Master Data
7/29/2019 Programming in HR - Day 3
14/38
Filled infotype structures are stored in the mainmemory for the GET PERNR event keyword.
The infotype records are imported to internal tables
Pnnnn (for example, P0006 for infotype 0006). Thesetables are then processed in a PROVIDE-ENDPROVIDE loop.
The infotype records whose validity period overlapsthe period selected in the selection screen (PN-BEGDA and PN-ENDDA) by at least one day areplaced one after the other in the header of therespective infotype table Pnnnn.
Processing Master Data
7/29/2019 Programming in HR - Day 3
15/38
Data Looping
With this form of processing, you should note that the
data for the Personal Data (0002) and Address (0006)
infotypes is listed sequentially and is not linked.
7/29/2019 Programming in HR - Day 3
16/38
Time Constraints
7/29/2019 Programming in HR - Day 3
17/38
Time constraints enable you to determine how thevalidity periods of infotype data records interact:
Time constraint 1:Exactly one valid data record of the
infotype in question must exist for the entire time that theemployee belongs to the enterprise.
Time constraint2: No more than one valid data record ofthe infotype in question can exist at any one time.
Time constraint3: Any number of valid data records ofthe infotype in question can exist at any one time.
Time Constraints
7/29/2019 Programming in HR - Day 3
18/38
Period Based Data
Infotype data is period-based, in other words, it is only validfor specific periods. For this reason, each record has a start
date and an end date.
This example shows the jobs that an employee has
performed over the course of a year.
7/29/2019 Programming in HR - Day 3
19/38
Data Selection Period based
The PROVIDE command retrieves data for specific periods, that
is, on the basis of the data selection period.
The most recent or oldest infotype records can be retreived
using RP_PROVIDE_FROM_LAST and
RP_PROVIDE_FROM_FRST macros.
7/29/2019 Programming in HR - Day 3
20/38
7/29/2019 Programming in HR - Day 3
21/38
Data Selection
The data selection period determines the period in which data is
evaluated.
7/29/2019 Programming in HR - Day 3
22/38
Default Values-Selection Screen
7/29/2019 Programming in HR - Day 3
23/38
When the INITIALIZATIONevent occurs, you
can set default values for the selection screen.
The fields for the data selection are defined in
structure QPPNP. Possible values for fieldPNPTIMED are:
D = Today (key date)
M = Current month
Y = Current yearP = To current date
F = From today (from current date)
Default Values-Selection Screen
7/29/2019 Programming in HR - Day 3
24/38
Flow Control for Logical Database
7/29/2019 Programming in HR - Day 3
25/38
RECAP
7/29/2019 Programming in HR - Day 3
26/38
Join & Projection
Joining Infotypes
Field Projection
Time Dependant Table Entries
7/29/2019 Programming in HR - Day 3
27/38
Join
7/29/2019 Programming in HR - Day 3
28/38
Join
7/29/2019 Programming in HR - Day 3
29/38
Join & Time Constraint
Time constraint 1:Saved without gaps and without overlaps
Time constraint 2:Saved with gaps and without overlaps,no duplicate assignment
Time constraint 3:Gaps and overlaps are permitted
If more than one record is valid for an infotype at the sametime or in the same period (time constraint 3), the system
cannot identify which data is valid for the subinterval of the
join. The resulting restriction for the join means that the data
of the infotypes in question must remain unique at all times.
This means that joins are only possible for infotypes with
time constraint 1 or 2.
7/29/2019 Programming in HR - Day 3
30/38
7/29/2019 Programming in HR - Day 3
31/38
Using variable Pnnnn_VALID, the systemrecognizes that one partial interval onlycontains incomplete data.
When the report is run, this variable is createdfor each Pnnnn infotype included in a join.
If a partial interval for infotype Pnnnn containsdata, its Pnnnn_VALID variable is filled with X.
Join & Subtype
7/29/2019 Programming in HR - Day 3
32/38
Projection & Contraction
Selecting one or more infotype fields for processing is calledPROJECTION.
Using projection for specific fields enables you to specify that only the
contents of these fields and time-based changes to the contents, are
relevant to an evaluation.
7/29/2019 Programming in HR - Day 3
33/38
Projection is also an operation performed on the time axis.New validity periods are created when the contents of oneof the projection fields change. The values stored in fieldsthat are not included in the projection are in an undefinedcondition, which means they are no longer relevant to
output.
If the contents of a field included in the projection remainunchanged in several data records, the validity periods ofthese data records are combined.
The process of combining data records during projection iscalled contraction.
Projection & Contraction
7/29/2019 Programming in HR - Day 3
34/38
Projection
7/29/2019 Programming in HR - Day 3
35/38
Join &Projection
Data from several infotypes is read at the same time, and new
partial periods are created. Since fields are only selected from
infotypes if they are relevant to an evaluation, partial periods are
combined.
In this way, validity periods with related contents are combined, anddata is retrieved for an evaluation from relevant infotype fields and
7/29/2019 Programming in HR - Day 3
36/38
Join &Projection
7/29/2019 Programming in HR - Day 3
37/38
Time Dependent Table Entries
To accelerate data entry and save memory, infotype data is usually
coded to form a key (for example, infotype P0001, job key). When
infotypes are processed, the texts or attributes of keys are read fromcontrol tables during runtime.
Data is stored for specific validity periods in a series of control
tables.
If data from time-dependent control tables must be read for a key in
an infotype field, the record that is valid for the validity period of theinfot e must be determined on the basis of the table
7/29/2019 Programming in HR - Day 3
38/38
?Questions