SAP HR ABAP - Logical Database and PNP EN
SAP HR ABAP - Logical Database and PNP EN
HR ABAP
Abstract
This guide explores the integration of HR processes with SAP ABAP, focusing on customizing and
automating HR functions within the SAP environment. It covers key ABAP concepts and techniques
tailored to HR modules, providing practical examples for enhancing data management and
reporting. The document is designed for professionals looking to optimize HR operations using
SAP’s tools.
Mert Bozkurt
[email protected]
Table of contents
Logical Database and PNP Structure ..................................................................................................................... 3
Advantages of a Logical Database ................................................................................................................................... 3
How to Create a Logical Database ....................................................................................................................... 5
Opcode and Table Logic ..................................................................................................................................................... 5
Compose Screen ................................................................................................................................................................... 6
Selection Screen Parameters ............................................................................................................................................ 7-8
Parameter Texts .................................................................................................................................................................... 9
Source Text & Loop Index ......................................................................................................................................... 10-11
Use of Logical Database in the Program ................................................................................................................ 12-14
PNP in PNPCE .......................................................................................................................................................................................... 15
Use of PNP and PNPCE Structure in the Program ................................................................................................. 16-17
Editing Selection Parameters (Creating a Report Class) ........................................................................................ 18-22
1
LOGICAL DATABASE
AND
PNP STRUCTURE
Logical database (LDB) is a process of retrieving a specific set of data in the SAP system.
It is a data access structure used to provide an easy way to process and manage.
Predefined data access logic for specific business processes and application areas, and
relationships. Allows users and developers to access data without writing complex database
queries
accesses. This simplifies and standardizes data access operations.
2
• Simplifies Data Access:
Logical databases predefine relationships and connections between different data tables
Definitions. In this way, developers and users can understand the structure and
relationships of the database
They can access data without the need to understand it.
Logical databases are blocks of code that are commonly used to access specific
datasets.
Contains. These codes can be reused by many programs and reports. Thus, the same
There is no need to rewrite the data access logic each time.
• Performance Optimization:
Effectively manages data queries using SAP's optimized data access techniques.
Logical databases provide performance improvements when working with large data
sets.
• Ease of Maintenance:
Logical databases are databases that allow users to access only the data for which they
are authorized.
It includes security and authorization mechanisms. This increases data security and
allows users to
It ensures that it only has access to the information that is allowed.
It provides standard data access methods for specific business processes. This is
especially the case with the large
It provides consistency and reliability in data access in organizations. All users and
Applications achieve consistent results by using the same data access methods.
Human Resources (HR): Logical databases such as PNP and PNPCE are used to
retrieve and report personnel information.
3
In the first place, it shows how to create a Logical database with Z, and then in the most general
use, We will be examining the PNP and PNPCE structures;
1. First, we need a table structure that contains our parameters on the selection
screens. In this document, we have created a sample Z table from our frequently
used fields in HR.
4
2. We go to the SLDB or SE36 transaction code, enter the Z definition and say Create,
then enter the short definition and create our database.
3. We have created the Z table in the name of the root node and the Database tb. We
get into their space. Both fields have to be the same. Then we create our logical
database.
5
Our logical database is ready. Now we need to edit the parameters on the selection
screens and fill in the logic sections for access to the data.
4. From the selections button, we go to our selection screen layout. We define the
fields we want to use as parameters here. In this example, we only defined four of
our fields because we wanted to process them.
6
SELECT-OPTIONS : s_pernr FOR zhr_t_ldb-pernr,
s_begda FOR zhr_t_ldb-begda,
s_endda FOR zhr_t_ldb-endda,
s_orgeh FOR zhr_t_ldb-orgeh
7
5. On the selection screen of the program, we add text from the Selection texts in order
to see the parameter names properly.
8
6. For data access, we edit the database logic from the Source text button.
In order;
INCLUDE dbztest_ldbnxxx . " all system routines
We pass the include and write the codes of our data that will be clustered in the FORM
Put_<table name> routine in the INCLUDE dbztest_ldbn001 here.
9
SELECT * FROM zhr_t_ldb INTO zhr_t_ldb WHERE pernr IN s_pernr
AND begda IN s_begda
AND endda IN s_endda
AND orgeh IN s_orgeh.
PUT zhr_t_ldb.
ENDSELECT.
After these processes, our Logical Database is ready to be used in the program. In the
programs we will use, we will now only be rotating within the data in this table.
10
Now let's look at the use of a logical database in a sample program.
7. When creating a new program in SE38, if we search for Z* in our Logical Database
field after entering the Executable Program type, we can easily see the database
(ZTEST_LDB) we have created. We choose and create our program.
11
8. We define NODES and GET in the relevant fields.
NODES : zhr_t_ldb.
START-OF-SELECTION.
GET zhr_t_ldb.
We will see that the program comes in the same way that we arranged the selection
screen in the first place.
12
If we continue to execute the program, we will also see that it only works for the data
that is in the table.
Se16 control;
13
PNP AND PNPCE STRUCTURE
These structures are actually two standardized structures of logical databases, the logic
of which we have shown above. This logical database, which was created based on our
SAP HR standard table called PERNR instead of the Z table we created, makes HR-
specific data clustering by associating PA0000 and PA0001 tables, which are 0000 and
0001 information type tables in the center.
14
How to Use PNP and PNPCE?
On the program creation screen, it is enough to type PNP or PNPCE in the Logical
Database field.
PNP
When we type PNP in the Logical Database field and run the program, the standard
screen comes like this.
15
PNPCE
When we type PNPCE in the Logical Database field and run the program, the standard
screen appears like this.
16
Let's see the process of changing the PNP and PNPCE selection screens in these
standard structures.
1. In the code directory of our program, click Git->Properties from the top menu.
17
2. Click on the HR repor category button.
18
4. In the Report class, enter the name with Z and its description. Remove the checkbox
check "For logical database PNPCE" because we have determined this screen as
PNP. (If you are creating a program for the PNPCE database, this option should
remain ticked.)
19
5. If we want to see the Date parameters in the selection screen standard, we select
this Data Selection Period as an option different from the "No Entry" parameter.
6. From the "Valid selection criteria" tab, we add the selection screen parameters with
the New Entries button and save and return.
20
7. When we save all the screens and go back to the Properties screen, we paste the
screen name with Z that we created in the Report class assignment to the Report
Class. We say OK and go back to our program.
8. When we run the program, we see that we have opened the selection screen
parameters that we have set up on the PNP screen.
21