Reading and Writing Infotypes
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Every screen of HR master data is backed by database tables, and it is tempting to read them with a plain SELECT and to
change them with an UPDATE. In HR that is the wrong habit: an employee’s data is protected by authorization checks, every
record has a validity period that must stay free of gaps and overlaps, records are locked while someone changes them, and
changes are logged. SAP therefore provides ready-made ways to read and write infotype records, and this page explains them
in plain words: the macros and function modules for reading, the object-oriented read classes that the newer framework
uses, the ways to write a record (the dialog, a mass update, function modules, and the business logic of the decoupled
infotype framework), and which of these has an official help page and which is documented only inside the SAP system. It is
written for SAP S/4HANA 2025 FPS02 on premise and Private Edition with SAP HCM for SAP S/4HANA (H4S4). The macros and
function modules come from the classic HR programming model that older SAP ERP HCM systems share, and SAP SuccessFactors
has its own, different interfaces that this page does not cover. The example reads the basic pay of Ana Torres and prepares
an additional payment for her.
Before you read
-
Infotypes: what an infotype, a subtype and a record are, and the table
PAnnnnbehind each infotype. -
Time Constraints and Validity Periods: why a new record delimits the old one.
-
HR Data Structures and Tables: where the data lives.
-
Personnel Actions: the procedure that creates several records in one go.
-
Classic Reports and Events and Function Modules and Function Groups: the ABAP that the listings use.
-
Locks and Enqueue: what locking a record means in ABAP.
Key terms
-
Infotype: one record type of the HR master data, such as Basic Pay (0008).
-
Personnel number: the number under which all records of one employee are stored.
-
Logical database: a program that reads data for a report and calls the report once per event, in HR mainly PNP and PNPCE.
-
Macro: a named block of ABAP statements that is expanded into the program, used a lot in HR.
-
Check class: an ABAP Objects class that holds the business logic and checks of one decoupled infotype.
-
Decoupled infotype framework: the way of building infotypes in which the business logic lives in classes and not in the screen program.
-
Container: an object that represents one infotype record (and its secondary data) when the framework writes to its buffer.
-
Lock: a mark that stops two users from changing the same employee’s data at the same moment.
-
Validity period: the dates from BEGDA to ENDDA during which a record applies.
The example used on this page
All HR pages use one fictitious business, Example Trading Co. Every key, number and amount is an invented example value
and not a value delivered by SAP. Dates are written DD.MM.YYYY, as an SAP screen shows them, and the high date is
31.12.9999. In ABAP code a date literal has the form '20260331', which stands for 2026-03-31.
-
Personnel number
00001234, Ana Torres, Sales Manager, hired 01.03.2024, employee subgroupAA, personnel subarea0001, payroll areaE1"Monthly EX01". -
Her Basic Pay (0008) record has the subtype Basic Contract, 4,000.00 EUR a month, valid from 01.03.2024 to 31.12.9999.
-
This page extends the example with one record that the shared example does not contain: an Additional Payments (0015) record for the wage type
M110Vacation Bonus, 500.00 EUR, valid on 30.06.2026, the last day of the June 2026 payroll period of payroll areaE1(June has 30 days). The amount is an invented example choice.
Why not just read and write the table
The table PA0008 holds the records of Basic Pay, as the page on infotypes shows. A program that reads it with plain
SQL gets the rows, but the statement does not by itself apply the HR authorization check, pick the record that is valid on a
date, or hide the records a user may not see. SAP’s macro for reading one person’s records for a period
documents that it returns only the records for which the user is authorized and that it reports when the HR authorization
check has held records back. Writing is more delicate still. Changing a record must respect the time constraint,
delimit the neighboring record, keep dependent data consistent, and be done while the employee is locked. Whenever the
programming model offers a read utility or a write function, use it, and keep plain SQL for data that no utility covers.
The ways to read and write at a glance
| Way | What it does | Where it is documented |
|---|---|---|
Dialog transaction PA30 |
An administrator creates, changes, copies and displays records on screen. |
SAP Help, Human Resources. |
Mass update, transaction |
Maintains the same infotype for many employees in one session, with Excel upload or direct entry, and a log. |
SAP Help, Human Resources. |
Logical database PNP or PNPCE with |
Fills the infotype tables for each employee that the selection screen chose. |
ABAP Keyword Documentation and SAP Help (the next page of this section covers it). |
Macro |
Reads all records of one infotype for one person in a period, anywhere in a program. |
SAP Help. |
Macro |
Takes the last record of a period out of an infotype table that is already filled. |
SAP Help. |
Macro |
Changes existing records of an infotype table. It cannot add or delete records. |
SAP Help. |
Function module |
Reads infotype records through a function call. |
In-system documentation (transaction SE37). |
Function module |
Inserts, changes, deletes and delimits records, with the employee locked around the call. |
In-system documentation (transaction SE37). |
Read classes and interfaces such as |
Read and write inside the business logic of decoupled infotypes. |
SAP Help, topics on developing an infotype in Personnel Administration. |
The functions with in-system documentation have no help page on help.sap.com that describes their parameters. Open them in the Function Builder (transaction SE37) of your own release and read the documentation there before you call them. The page does not list their parameters, because a parameter list taken from a book or from memory can be wrong for your release.
The diagram shows how to choose between the ways.
Reading infotypes
Through the logical database
In a report that uses the logical database PNP or PNPCE, you declare an infotype with the INFOTYPES statement and the
database fills the internal table for each employee at the event GET PERNR. The ABAP Keyword Documentation says that
INFOTYPES declares an internal table for an HR infotype, that without the addition MODE N it changes the behavior of the
logical databases PAP, PCH, PNP and PNPCE (and is the prerequisite for their working correctly), that it is forbidden in
classes, and that every infotype structure Pnnnn contains the components BEGDA and ENDDA. The documentation page
that this page cites is the one for release 7.51, which is older than the current release, so check the statement
against the documentation of your release. The next page of this section covers the logical databases and their macros in
full.
Anywhere in a program: RP-READ-INFOTYPE
SAP Help describes a programming utility that places all records of an infotype for one person and one period in an
internal table: the macro RP_READ_INFOTYPE. You define it with the keyword INFOTYPES, you can use it in all programs
and in function modules, and in the database PNP it is the exception, because there an infotype is normally read with
GET PERNR. The program must contain the include DBPNPMAC, the validity begin date must be before or the same as the
validity end date, and the infotype table must match the infotype number. The help page lists the inputs (personnel
number, infotype number, name of the internal table, begin and end date) and these outputs:
-
PNP-SW-FOUNDis 0 when no record matches. -
A second switch tells whether the HR authorization check held back at least one record.
-
The internal table holds all matching records the user is authorized to see; it can be empty.
SAP Help spells the second switch PNP-SW-AUTH-SKIPPED-RECORD in the parameter list and PNP-SW-AUT-SKIPPED-RECORD in its
example. The listing uses the spelling of the example; if the system reports an unknown name, check the other spelling
in your release.
The listing reads Ana’s Basic Pay records for March 2026.
Requires an SAP system; not run here.
REPORT zexp_read_basic_pay.
INFOTYPES: 0008.
INCLUDE dbpnpmac.
DATA: pernr TYPE p0008-pernr VALUE '00001234',
begda TYPE p0008-begda,
endda TYPE p0008-endda.
begda = '20260301'. " 2026-03-01
endda = '20260331'. " 2026-03-31
RP-READ-INFOTYPE pernr 0008 p0008 begda endda.
IF pnp-sw-aut-skipped-record = '1'.
WRITE: / 'Insufficient authorization'.
STOP.
ENDIF.
IF pnp-sw-found = '0'.
WRITE: / 'Infotype 0008 missing'.
STOP.
ENDIF.
LOOP AT p0008.
WRITE: / p0008-begda, p0008-endda.
ENDLOOP.
With the data of the example, one record would match, because Ana’s Basic Contract record starts on 01.03.2024 and ends
on 31.12.9999, so it covers the whole of March 2026. The record also holds the wage type rows of the infotype, and the
help page for Basic Pay says that up to 40 wage types can be stored for one employee; the field names of those rows are in
the Dictionary structure P0008 of your system.
Picking one record: RP_PROVIDE_FROM_LAST
Once a table is filled, whether by GET PERNR or by the macro above, RP_PROVIDE_FROM_LAST copies the last record of a
period (optionally of one subtype) into the header line of the table. SAP Help says it is helpful only for infotypes or
subtypes with time constraint 1 or 2, that the table must be sorted in ascending order, and that PNP-SW-FOUND is 0 when
no entry matches. For Ana’s Basic Pay, which has time constraint 1, the call RP_PROVIDE_FROM_LAST p0008 space begda endda
would leave the record valid at the end of the period in the header line, and the program would test PNP-SW-FOUND before
using it.
Through a function module: HR_READ_INFOTYPE
The help page for the read macro adds that you can also use the function module HR_READ_INFOTYPE and refers to the
documentation on function modules. The module has no page of its own on help.sap.com: its parameters and behavior are
described in the in-system documentation of the Function Builder (SE37). Its use is not unrestricted: in the topic on
reading infotypes inside the business logic of a new infotype, SAP Help says never to substitute the read method
READ_SINGLE with HR_READ_INFOTYPE (or with an external perform into the subroutine pool SAPFP50P). The module is
therefore a tool for reports and interfaces, not for the check classes described below.
Source: Reading Infotypes (SAP Help, Human Resources); the function module itself: in-system documentation (SE37).
Inside the business logic of a decoupled infotype: read methods
SAP Help states that for infotypes that are read very often, such as Organizational Assignment (0001) and Payroll Status
(0003), the standard system provides read methods named after the infotype, for example P0001 and P0003. It also shows
the general call, the method READ_SINGLE of the interface IF_HRPA_READ_INFOTYPE, which takes the key
fields (the tclas value, personnel number, infotype, subtype, object identification, lock indicator, begin and end date),
a read mode and an indicator that switches the authorization check off, and returns the record and an indicator that tells
whether data exists. The mode constant IF_HRPA_READ_INFOTYPE=>LAST_INTERSECTING_RECORD is the one the example uses.
The following outline reads Ana’s Basic Pay inside a check class. It is a fragment and not a program: the object reference
a_read_infotype, the variables and the constants come from the surrounding class.
Requires an SAP system; not run here.
CALL METHOD a_read_infotype->read_single
EXPORTING
tclas = tclas
pernr = pernr
infty = '0008'
subty = space
objps = space
sprps = if_hrpa_read_infotype=>unlocked
begda = low_date
endda = high_date
mode = if_hrpa_read_infotype=>last_intersecting_record
no_auth_check = true
IMPORTING
pnnnn = p0008
data_exists = data_exists.
The call has the shape of the example on the SAP Help page for reading infotypes, with the infotype changed to 0008. SAP
Help also says that this method lets an infotype read cost assignment and other secondary data, and refers to the interface
IF_HRPA_READ_INFOTYPE for details. Passing a switch that turns the authorization check off, as the example does, is a
decision for the infotype developer: a program that reads for a user normally wants the check on.
Writing infotypes
By hand: PA30 and the mass update
SAP Help describes creating an infotype record in the dialog: from SAP Easy Access you choose Human Resources, Personnel
Management, Administration, HR Master Data, Maintain, enter the personnel number, select the infotype, enter a subtype if
needed, choose Edit and Create, fill in the fields and save. For Ana’s vacation bonus, an administrator would pick
infotype 0015 and the wage type M110. The help page for Additional Payments says that the system requires a wage type
and an amount (or a number and unit, depending on the wage type), checks that combination, defaults the currency from the
employee’s company code, and proposes the last day of the current payroll period as the validity date, which the user may
change.
For many employees at once, SAP Help describes the mass update of personnel administration and time data with the
transaction HRFE_MASS_UPDATE: one session maintains an infotype for several employees, the data is entered directly
or uploaded as an Excel file, it can run as a job, and an application log records the result.
From a PNP report: RP_UPDATE changes, but never adds
The macro RP_UPDATE is the interface between a report and the infotype table when records change. SAP Help says you use
it only to change data records, that you cannot add or delete records with it, that every record you want to change must
also be in the table in its original form, and that keys must not change. You pass the table with the records before the
change and the table with the records after it. So the macro suits a correction such as a new value in an existing
record, but not the vacation bonus of the example, which is a new record.
From a program: lock, call HR_INFOTYPE_OPERATION, unlock
To insert, change, delete or delimit a record from a program, SAP provides the function module HR_INFOTYPE_OPERATION, and to
lock the employee while it runs the modules BAPI_EMPLOYEE_ENQUEUE and BAPI_EMPLOYEE_DEQUEUE. None of the three has
a help page on help.sap.com: the parameter lists, the names of the operations and the return structure are in-system
documentation, in transaction SE37, and they can differ between releases. The pattern, which does not depend on the
parameter details, is the same for every write:
-
Lock the personnel number so that nobody else changes the employee meanwhile.
-
Read the records you depend on, with the utilities above, for the period concerned.
-
Call the write function with the infotype, the personnel number, the validity dates, the record, and the operation (insert, here).
-
Evaluate the return structure and the exceptions; a failed check, a time constraint violation or a missing authorization comes back there and not as a dump.
-
Unlock the personnel number, also when the call failed.
The example below reads Ana’s Basic Pay for March 2026 with the macro and prepares the 0015 record that the page adds to the example. The values of the new record are:
| Item | Value for Ana |
|---|---|
Personnel number |
|
Infotype and wage type |
0015 Additional Payments, wage type |
Amount and currency |
500.00 EUR (invented example value) |
Validity |
30.06.2026 to 30.06.2026, the last day of the June 2026 period of payroll area |
Operation |
Insert of a new record (PA30, the mass update or the function module can do this; the macro |
Requires an SAP system; not run here. The outline contains comments where the in-system documentation of the lock and write modules must be followed; it is not a complete program.
REPORT zexp_add_vacation_bonus.
INFOTYPES: 0008.
INCLUDE dbpnpmac.
DATA: pernr TYPE p0008-pernr VALUE '00001234',
begda TYPE p0008-begda VALUE '20260601',
endda TYPE p0008-endda VALUE '20260630'.
* 1. Lock the personnel number: BAPI_EMPLOYEE_ENQUEUE,
* parameters as in the in-system documentation (SE37).
* 2. Read the basic pay that is valid in the payroll period.
RP-READ-INFOTYPE pernr 0008 p0008 begda endda.
IF pnp-sw-aut-skipped-record = '1' OR pnp-sw-found = '0'.
* Stop: no basic pay visible for the employee, nothing is written.
ENDIF.
* 3. Fill a record of structure P0015: personnel number 00001234,
* wage type M110, amount 500.00, currency EUR, valid 2026-06-30.
* Call HR_INFOTYPE_OPERATION for infotype 0015 with the
* operation "insert" (parameters: in-system documentation).
* 4. Evaluate the return structure and the exceptions.
* 5. Unlock with BAPI_EMPLOYEE_DEQUEUE, also after an error.
Source: the macro is described on Read the Infotype for One Person in a Period (SAP Help, Human Resources); the lock and write modules: in-system documentation (SE37).
After the insert, the March 2026 payslip of Ana is unchanged (gross 4,000.00 EUR), because the bonus is valid on 30.06.2026. A later page covers how payroll picks up additional payments and recurring payments.
Logging changes
SAP Help says that changes to infotype records can be logged as change documents for all infotypes used in Personnel
Administration, Time Management, Payroll and Applicant Management, that the logging is set up in Customizing for Personnel
Administration under Tools, Revision, Set Up Change Document, and that the report RPUAUD00 displays the documents. A write
that goes through the proper functions is therefore traceable: who changed which employee’s record, and when.
The decoupled infotype framework
SAP Help explains that there is an old and a new method for defining infotypes. In the old method the business logic and
the screens are closely tied together in the module pool. In the new method, the infotype-specific business logic
lives in ABAP Objects classes, a check class for each infotype that the framework addresses, and a conversion class
formats the data for the user interface. Such infotypes are called decoupled. The objects needed are the screen structure,
the conversion class, the assignment of the screen structure to the conversion class, the check class (named
CL_HRPA_INFOTYPE_nnnn for a standard infotype and ZCL_HRPA_INFOTYPE_9nnn for a customer infotype), and entries in views
that determine version identifiers, containers and the assignment of the check class.
What this means for reading and writing:
-
Which transaction. SAP Help says it is irrelevant for the transaction PA30 whether an infotype is decoupled, because both are supported. Newer applications, however, such as some ESS scenarios and the HR Administrative Services, are based on the decoupled framework and can process only decoupled infotypes, so a customer infotype that these should use must be decoupled. SAP Help adds that the transaction for creating infotypes (PM01) creates decoupled infotypes, and that you should always create a decoupled infotype when you create a new one.
-
The switch. A page of the integration documentation between SuccessFactors and the SAP business suite says that you set up the decoupled infotype framework in the Implementation Guide under Personnel Management, Personnel Administration, Customizing Procedures, Infotypes, Infotypes in Detached Infotype Framework, Use Decoupled and Not Decoupled IT Framework, and set the value of the switch CCURE PC_UI (in the table
T77S0) toX, which enables the framework also for PA30. The same page says that data maintenance through PA30 stays valid and that for some infotypes PA30 uses the decoupled framework, as the permissibility flag of the activity Assign Check Classes and Determine Permissibility shows. It warns that the BAdIs of PA30 and the BAdIs of the decoupled framework are different, so logic that a customer added for an infotype has to be copied to the BAdIs of the decoupled framework, also when master data replication is used. -
Writing from the business logic. SAP Help says the system does not write records into its buffer, it writes containers, which represent a record and are instances of
CL_HRPA_INFOTYPE_CONTAINER; a container can hold infotype records, secondary records for infotype views, cost assignment data and infotype texts. A check class that only reads can inherit from the superclassCL_HRPA_INFOTYPE_NNNN, but a class that writes to the buffer must inherit fromCL_HRPA_INFTY_NNNN; SAP Help warns that a check class derived from the first superclass that writes to the buffer is likely to cause short dumps. -
Direct and indirect access. The same pages describe two routes to the buffer. Direct access skips the business logic and checks of the other infotype. Indirect access runs them first, and so can fail, for example through endless recursion when it targets the infotype’s own logic, through failed input checks, or through failed retroactive accounting or authorization checks. The page advises the developer to evaluate the
IS_OKresult and to give a suitable message of the infotype’s own, and not to repeat the messages of the other infotype that are meant for dialog users. -
Messages. Messages of function modules called from business logic have to be mapped to exceptions or to the interface
IF_HRPA_MESSAGE_HANDLER, so that the system does not bypass them.
SAP Help presents these details as expert knowledge, beyond what is needed to create or migrate an infotype, so an ordinary report does not need them. They matter to developers of infotypes and to the people who debug an ESS or administrative service that rejects a record.
Source: Decoupling Infotypes (SAP Help, Human Resources), Making Basic SAP S/4HANA Settings (SAP Help, Employee Central integration), Using Containers to Write Data (SAP Help, Human Resources), Background Information on Writing Infotype Records (SAP Help, Human Resources), Reading Before Writing (SAP Help, Human Resources), Calling Function Modules (SAP Help, Human Resources)
What can go wrong
| Problem | Cause | What to do |
|---|---|---|
A read returns nothing although the employee has records |
The HR authorization check held records back, or the period lies outside every record. |
Test the two switches of the read macro and report which case applies. Do not treat an empty table as "no data". |
|
SAP Help says never to substitute |
Use the read methods and |
|
The macro only changes existing records. |
Use the dialog, the mass update or |
Two programs change the same employee |
The personnel number was not locked around the change. |
Lock before the read and unlock afterward, as in the pattern above; see the lock modules in the in-system documentation. |
A custom rule works in PA30 but not in an ESS application |
The BAdIs of PA30 and of the decoupled framework are different. |
Copy the logic to the BAdIs of the decoupled framework, or check which framework the infotype is processed in. |
Dump after writing from a check class |
A class derived from |
Derive the writing class from |
What older books show, and what has changed
The book SAP ERP HCM: Technical Principles and Programming, 1st edition (2013), covers this topic in its chapters on data
structures and on reading and processing HR data. It shows the read macros, including RP_READ_INFOTYPE, the macro
RP_UPDATE, the lock modules and the function module HR_INFOTYPE_OPERATION with listings, and it introduces the
decoupled infotype framework, the check classes and the PC_UI main switch. The concepts it teaches are the same in the
current documentation and on this page: read through utilities that respect authorizations, lock the employee, write through
a function that runs the checks, and keep business logic in classes for new infotypes.
What has changed is the product and the wording around it. The book describes SAP ERP HCM, not SAP HCM for SAP S/4HANA,
which SAP says needs a separate license and which, since SAP S/4HANA 2025, can no longer run in compatibility mode. The
book introduces the decoupled framework as a new concept, and SAP Help now recommends always creating decoupled
infotypes. The book also names a default implementation class that differs from the superclass names on today’s SAP Help pages, so take class
names from the documentation and the system of your release. The book’s own listings also differ from each other in the
name of the lock modules (one listing uses BAPI_EMPLOYEE_ENQUEUE and BAPI_EMPLOYEE_DEQUEUE, another uses names beginning
with HR_EMPLOYEE_), which is another reason to take the names and parameters from the in-system documentation. The
interfaces for decoupled business logic, the container and buffer classes and the mass update transaction HRFE_MASS_UPDATE
are described in current SAP Help, and SAP SuccessFactors is now a cloud alternative with different interfaces.
Summary
-
Read HR master data through the utilities of the programming model, such as the logical database, the macro
RP_READ_INFOTYPE,RP_PROVIDE_FROM_LAST, the function moduleHR_READ_INFOTYPEand, inside decoupled business logic, the read methods ofIF_HRPA_READ_INFOTYPE, because they apply the HR authorization check and the validity periods. -
The macro
RP_READ_INFOTYPEtells you through two switches whether a record was found and whether the authorization check held records back. -
RP_UPDATEonly changes existing records. Inserts and deletions go through the dialog, the mass update or the function moduleHR_INFOTYPE_OPERATION, around which the employee is locked and unlocked; those modules are documented in the system, not on help.sap.com. -
Decoupled infotypes keep their business logic in check classes and write through containers and a buffer; PA30 supports both kinds, and some ESS and administrative scenarios need decoupled ones. The switch CCURE PC_UI enables the framework for PA30.
-
For Ana Torres, reading Basic Pay for March 2026 returns her one Basic Contract record, and the added Vacation Bonus of 500.00 EUR is an invented record that extends the example.