Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / HR ABAP / HR Reporting – Logical Databases, Macros & FMs

HR Reporting – Logical Databases, Macros & FMs

HR ABAP · HR ·

Open the interactive lesson →
  1. Three ways to read HR data
  2. Logical databases in HR: PNP, PNPCE, PCH, PAP
  3. A PNP report: TABLES pernr, INFOTYPES, GET PERNR
  4. The selection screen and HR report categories
  5. Macros RP_PROVIDE_FROM_LAST / FRST and PNP-SW-FOUND
  6. PROVIDE … ENDPROVIDE
  7. Repetitive structures with DO … VARYING
  8. PNPCE (GET PERAS) and PCH (GET OBJEC)
  9. Function modules: HR_READ_INFOTYPE, HR_READ_SUBTYPE, RH_READ_INFTY, RH_STRUC_GET
  10. Reading without an LDB: direct SELECT on PAnnnn
  11. Complete sample report: PNP + IT0001/0002 + ALV
  12. Interview questions

How an ABAP developer reads HR data. HR data is different from most SAP data: almost every record is time-dependent (BEGDA / ENDDA), it is protected by strict HR authorizations, and it is spread over many infotype tables. That is why classic HR reports use logical databases (LDBs), the event GET PERNR, special macros and PROVIDE … ENDPROVIDE instead of plain SELECTs. Payroll and time results live in clusters and are read with IMPORT or function modules (see page 05 Payroll & Time Data). Infotype basics (Pnnnn, PAnnnn, time constraints) are on page 02 Infotypes & Personnel Administration.

Part 1 – Three ways to read HR data

Three ways to read HR master data: logical database, function modules, direct SELECT – pros, cons and when to use

Way

Typical statements

Use it for

Logical database (PNP / PNPCE / PCH / PAP)

GET pernr, RP_PROVIDE_FROM_LAST, PROVIDE

Classic executable HR reports with the standard HR selection screen

Function modules

HR_READ_INFOTYPE, RH_READ_INFTY, RH_STRUC_GET

One employee or one OM object inside classes, BAdIs, user exits, RFC / OData services

Direct SELECT / CDS

SELECT … FROM pa0001 WHERE begda <= … AND endda >= …

Mass reads and interfaces where performance matters – you add the authorization check yourself

Rule of thumb: an HR report with a selection screen → LDB; a single employee in other code → FM; large volumes or joins → SELECT plus an explicit authorization check (Part 10).

Part 2 – Logical databases in HR: PNP, PNPCE, PCH, PAP

A logical database is a special ABAP program (maintained in SE36) that reads related tables in a fixed hierarchy, offers a ready-made selection screen, checks authorizations and hands the data to your report one node at a time through GET events. You attach it in the program attributes of an executable program (type 1). You write no SELECT for the master data – the LDB does it.

LDB

Used for

Main node / event

Notes

PNP

HR master data: Personnel Administration, Time Management, Payroll

TABLES pernr → GET pernr

The classic HR LDB; best suited to selecting persons

PNPCE

Same as PNP, plus concurrent employment (one person, several assignments)

NODES peras → GET peras

SAP recommends PNPCE for new reports, even without concurrent employment

PCH

Personnel Planning: Organizational Management, Personnel Development, Training and Event Management

TABLES objec → GET objec

Can technically read all HR infotypes, but use it only for personnel planning data (objects O, S, C …)

PAP

Recruitment (applicants)

applicant node

Applicant infotypes are stored in tables PBnnnn

  • PNP vs PCH for employees: PCH can reach employee data through evaluation paths, but PNP is faster and simpler because it is built for selecting persons.
  • The same four LDBs are the data sources of HR InfoSets for SAP Query (SQ01 / SQ02) and the Ad Hoc Query – the reporting tools for key users.
  • LDBs are classic ABAP only. They are not available in ABAP Cloud, and modern ABAP documentation treats them as obsolete for new non-HR development – but HR reports still use them everywhere, so you must know them.

Part 3 – A PNP report: TABLES pernr, INFOTYPES, GET PERNR

Runtime flow of a PNP report: selection screen, START-OF-SELECTION, person selection with authorization check, GET PERNR loop, END-OF-SELECTION

3.1 The building blocks

Statement

What it does

Program attributes → Logical database = PNP

Gives the report the PNP selection screen and the GET events

TABLES pernr.

Declares the LDB node PERNR (structure with PERNR-PERNR = personnel number). NODES pernr. works the same way

INFOTYPES: 0000, 0001, 0002.

Creates an internal table with header line P0000, P0001, P0002 (structure Pnnnn) for each infotype; the LDB fills them at GET PERNR

START-OF-SELECTION.

Runs once before the first person

GET pernr.

Runs once per selected person; the infotype tables now hold all records of that person (every period)

REJECT.

Inside GET PERNR: stop processing this person and continue with the next one

END-OF-SELECTION.

Runs once after the last person – output (ALV)

  • Infotype numbers are always four digits: INFOTYPES: 0000, 0001, 0006.
  • Useful additions: INFOTYPES 0008 MODE N. – the LDB does not read this infotype (saves time); you read it yourself only when needed, e.g. with the TRMAC macro RP-READ-INFOTYPE or HR_READ_INFOTYPE.
  • Because the tables contain the person's whole history, you must pick the records of the reporting period yourself – with the macros (Part 5) or PROVIDE (Part 6).

3.2 Minimal example

REPORT zhr_minimal.                   " attributes: logical database PNP

TABLES pernr.
INFOTYPES: 0001, 0002.

START-OF-SELECTION.

GET pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.  " latest IT0001 in the period
IF pnp-sw-found = '1'.
WRITE: / pernr-pernr, p0001-ename, p0001-orgeh.
ENDIF.

Part 4 – The selection screen and HR report categories

4.1 Standard PNP selection fields

The LDB generates the selection screen. Its fields are select-options with fixed names that you can use in your code (for example to fill a default in INITIALIZATION).

Field

Meaning

PNPPERNR

Personnel number

PNPSTAT2

Employment status (0 withdrawn, 1 inactive, 2 retiree, 3 active)

PNPBUKRS

Company code

PNPWERKS / PNPBTRTL

Personnel area / personnel subarea

PNPPERSG / PNPPERSK

Employee group / employee subgroup

PNPABKRS

Payroll area

PNPKOSTL

Cost center

PNPORGEH / PNPPLANS

Organizational unit / position

PN-BEGDA / PN-ENDDA

Data selection period – used by the macros and PROVIDE

PN-BEGPS / PN-ENDPS

Person selection period – which persons are selected

PN-PABRJ / PN-PABRP

Payroll year / payroll period (payroll-type report categories)

The period block (Today, Current month, Current year, Other period …) fills PN-BEGDA / PN-ENDDA. Further fields are hidden behind the Further selections button; Search helps and Sort order are also provided by the LDB.

4.2 HR report category

The HR report category decides which fields and period types the PNP selection screen shows. You choose it in the program attributes (button HR report category, visible when the LDB is PNP or PNPCE). Example: a payroll report uses a category that shows payroll area and payroll period instead of a free date range.

  • SAP delivers many report categories; you can also create your own in Customizing (IMG → Personnel Management → Human Resources Information System → Reporting → Adjusting the Standard Selection Screen).
  • PNP and PNPCE have separate report categories.
  • Your own fields: add normal PARAMETERS / SELECT-OPTIONS (or a SELECTION-SCREEN BEGIN OF BLOCK) – they appear below the LDB fields.

Part 5 – Macros RP_PROVIDE_FROM_LAST / FRST and PNP-SW-FOUND

Timeline of IT0001 and IT0002 records: which record RP_PROVIDE_FROM_FRST, RP_PROVIDE_FROM_LAST and PROVIDE return

A macro is a named piece of ABAP code that the compiler copies in where you use it. HR macros are stored centrally in table TRMAC ('Macros in ABAP/4 programs', view it in SE16 / SE11), so programs can use them without any INCLUDE. The two you need every day:

Macro

Puts into the header line …

rp_provide_from_last pnnnn subty begda endda.

the last (latest) record of table Pnnnn that is valid at least one day between begda and endda

rp_provide_from_frst pnnnn subty begda endda.

the first (earliest) such record

  • subty = subtype, or space if the infotype has no subtypes or you want any subtype.
  • After the call PNP-SW-FOUND tells you the result: '1' = a record was found, '0' = no record valid in the period. Always check it before you use the header line.
  • The record is copied as it is – BEGDA / ENDDA are not cut to the period (PROVIDE does cut them).
  • Two spellings exist: TRMAC holds the hyphen form (RP-PROVIDE-FROM-LAST); PNP / PNPCE reports usually use the underscore form (RP_PROVIDE_FROM_LAST) that the logical database provides. Both work the same.
GET pernr.
" without subtype
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found = '1'.
" record exists – process p0001-orgeh, p0001-plans ...
ELSE.
" no IT0001 in the period – skip or report an error
REJECT.
ENDIF.

" with subtype: IT0006 Addresses, subtype 1 = permanent residence
rp_provide_from_last p0006 '1' pn-begda pn-endda.

" first record in the period, e.g. the organizational assignment at entry
rp_provide_from_frst p0001 space pn-begda pn-endda.

Key-date reading: pass the same date twice, e.g. rp_provide_from_last p0001 space sy-datum sy-datum. – gives the record valid today.

Part 6 – PROVIDE … ENDPROVIDE

PROVIDE is a loop made for time-dependent tables. It walks through a period and, for every sub-interval in which the data of all listed tables stays the same, fills the work areas and runs the loop body once. Use it when you need the history within a period (e.g. every org unit an employee had this year); use the macros when you need just one record.

Short form (classic HR syntax, works with the Pnnnn header lines)

GET pernr.
PROVIDE * FROM p0001
* FROM p0002
BETWEEN pn-begda AND pn-endda.
" p0001 / p0002 hold the records valid together in this interval;
" p0001-begda / p0001-endda are cut to the interval
WRITE: / p0001-begda, p0001-endda, p0001-orgeh, p0002-nachn.
ENDPROVIDE.

Long form (modern syntax, explicit work areas)

DATA: lt_p0001  TYPE STANDARD TABLE OF p0001 WITH EMPTY KEY,
lt_p0002  TYPE STANDARD TABLE OF p0002 WITH EMPTY KEY,
ls_p0001  TYPE p0001,
ls_p0002  TYPE p0002,
lv_valid1 TYPE abap_bool,
lv_valid2 TYPE abap_bool.

GET pernr.
lt_p0001 = p0001[].                " body of the LDB table, no header line
lt_p0002 = p0002[].

PROVIDE FIELDS orgeh plans FROM lt_p0001 INTO ls_p0001
VALID lv_valid1 BOUNDS begda AND endda
FIELDS nachn vorna FROM lt_p0002 INTO ls_p0002
VALID lv_valid2 BOUNDS begda AND endda
BETWEEN pn-begda AND pn-endda.
" lv_valid1 / lv_valid2 = abap_true if that table has a record in this interval
IF lv_valid1 = abap_true AND lv_valid2 = abap_true.
WRITE: / ls_p0001-begda, ls_p0001-endda, ls_p0001-orgeh, ls_p0002-nachn.
ENDIF.
ENDPROVIDE.
  • The records of one table must not overlap (the long form raises an exception if they do), so PROVIDE suits time constraint 1 and 2 infotypes, not time constraint 3.
  • Add INCLUDING GAPS to the long form to get a pass also for intervals where a table has no record.
  • The short form is obsolete in modern ABAP but is everywhere in HR code; know both.

Part 7 – Repetitive structures with DO … VARYING

Repetitive structures such as LGA01 … LGA40 / BET01 … BET40 in IT0008 and DAR01 … DAR12 / DAT01 … DAT12 in IT0041 are explained on page 02 Part 6. To loop over them, use DO … VARYING: each pass moves the variable to the next field of the group.

DATA: lv_lgart TYPE p0008-lga01,     " wage type, e.g. 1000 Basic pay
lv_betrg TYPE p0008-bet01.     " amount,    e.g. 5000.00

GET pernr.
rp_provide_from_last p0008 space pn-begda pn-endda.
CHECK pnp-sw-found = '1'.

DO 40 TIMES VARYING lv_lgart FROM p0008-lga01 NEXT p0008-lga02
VARYING lv_betrg FROM p0008-bet01 NEXT p0008-bet02.
IF lv_lgart IS INITIAL.
EXIT.                          " no more wage types filled
ENDIF.
WRITE: / pernr-pernr, lv_lgart, lv_betrg.
ENDDO.
" IT0041: find the date stored for date type 01 (date types are customizing)
DATA: lv_dar TYPE p0041-dar01,
lv_dat TYPE p0041-dat01.

rp_provide_from_last p0041 space pn-begda pn-endda.
DO 12 TIMES VARYING lv_dar FROM p0041-dar01 NEXT p0041-dar02
VARYING lv_dat FROM p0041-dat01 NEXT p0041-dat02.
IF lv_dar = '01'.
WRITE: / 'Date type 01:', lv_dat.
EXIT.
ENDIF.
ENDDO.
  • DO … VARYING is obsolete in modern ABAP but is the standard idiom in HR code. Modern alternative: build the field name and use ASSIGN COMPONENT |LGA{ lv_i WIDTH = 2 ALIGN = RIGHT PAD = '0' }| OF STRUCTURE p0008 TO <lv_lgart>.
  • Wage type codes are 4 characters and defined per customer and country in table T512W (texts in T512T) – see page 05.

Part 8 – PNPCE (GET PERAS) and PCH (GET OBJEC)

8.1 PNPCE – concurrent employment

With concurrent employment one real person (central person, object type CP) can have several personnel assignments – several PERNRs, e.g. two part-time contracts. PNPCE knows this hierarchy (person → group of assignments → assignment). The event for one assignment is GET PERAS; it replaces GET PERNR. Everything else (INFOTYPES, macros, PROVIDE) works as with PNP.

REPORT zhr_pnpce_demo.                " attributes: logical database PNPCE

NODES peras.                          " instead of TABLES pernr
INFOTYPES: 0001.

START-OF-SELECTION.

GET peras.
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found = '1'.
WRITE: / peras-pernr, p0001-ename, p0001-bukrs.
ENDIF.

8.2 PCH – organizational objects

PCH reads Personnel Planning objects (O organizational unit, S position, C job, P person …). The selection screen asks for plan version, object type, object ID and optionally an evaluation path; PCH then follows the path and triggers GET OBJEC for every object found. The PD infotype tables (P1000 Object, P1001 Relationships …) are filled like Pnnnn in PNP.

REPORT zhr_pch_demo.                  " attributes: logical database PCH

TABLES objec.
INFOTYPES: 1000, 1001.

START-OF-SELECTION.

GET objec.
CHECK objec-otype = 'O'.            " only organizational units
WRITE: / objec-objid, objec-stext.
" positions of this org unit valid today: relationship B 003 'incorporates' to type S
LOOP AT p1001 INTO DATA(ls_rel)
WHERE rsign = 'B' AND relat = '003' AND sclas = 'S'
AND begda <= sy-datum AND endda >= sy-datum.
WRITE: /5 'Position', ls_rel-sobid.
ENDLOOP.

OM objects, relationships and evaluation paths are explained on page 01 HCM Overview & Organizational Management; outside a PCH report use RH_STRUC_GET (Part 9).

Part 9 – Function modules: HR_READ_INFOTYPE, HR_READ_SUBTYPE, RH_READ_INFTY, RH_STRUC_GET

Function module

Reads

Notes

HR_READ_INFOTYPE

PA infotype records (PAnnnn) of one employee for a period

Checks HR authorizations; result table of type Pnnnn

HR_READ_SUBTYPE

Same, restricted to one subtype

e.g. IT0006 subtype 1, IT0105 subtype 0001

RH_READ_INFTY

PD infotype records (HRPnnnn) of OM objects

e.g. HRP1000 names, HRP1001 relationships

RH_STRUC_GET

All objects reached along an evaluation path from a start object

e.g. path O-S-P: org unit → positions → persons

HR_INFOTYPE_OPERATION

– (writes)

Create / change / delete infotype records – see page 04 Infotype Development, Enhancements & Authorizations

HR_READ_INFOTYPE

DATA lt_p0001 TYPE STANDARD TABLE OF p0001 WITH EMPTY KEY.

CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr           = lv_pernr
infty           = '0001'
begda           = sy-datum
endda           = sy-datum
TABLES
infty_tab       = lt_p0001
EXCEPTIONS
infty_not_found = 1
OTHERS          = 2.
IF sy-subrc = 0 AND lt_p0001 IS NOT INITIAL.
DATA(ls_p0001) = lt_p0001[ lines( lt_p0001 ) ].  " latest record
ENDIF.

HR_READ_SUBTYPE

DATA lt_p0006 TYPE STANDARD TABLE OF p0006 WITH EMPTY KEY.

CALL FUNCTION 'HR_READ_SUBTYPE'
EXPORTING
pernr           = lv_pernr
infty           = '0006'
subty           = '1'            " permanent residence
begda           = sy-datum
endda           = sy-datum
TABLES
infty_tab       = lt_p0006
EXCEPTIONS
infty_not_found = 1
OTHERS          = 2.

RH_READ_INFTY – name of an org unit

DATA lt_p1000 TYPE STANDARD TABLE OF p1000 WITH EMPTY KEY.

CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
plvar         = '01'             " active plan version
otype         = 'O'
objid         = lv_orgeh
infty         = '1000'
begda         = sy-datum
endda         = sy-datum
TABLES
innnn         = lt_p1000
EXCEPTIONS
nothing_found = 1
OTHERS        = 2.
IF sy-subrc = 0.
DATA(lv_org_name) = lt_p1000[ 1 ]-stext.
ENDIF.

RH_STRUC_GET – all employees of an org unit

DATA lt_result TYPE STANDARD TABLE OF swhactor WITH EMPTY KEY.

CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype      = 'O'
act_objid      = lv_orgeh
act_wegid      = 'O-S-P'         " evaluation path: org unit -> position -> person
act_begda      = sy-datum
act_endda      = sy-datum
TABLES
result_tab     = lt_result
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS         = 3.
IF sy-subrc = 0.
DELETE lt_result WHERE otype <> 'P'.  " keep persons only; objid = PERNR
ENDIF.
  • RH_STRUC_GET also returns RESULT_OBJEC (object names) and RESULT_STRUC (the tree with levels). Evaluation paths are maintained in OOAW (table T778A).
  • HR_READ_INFOTYPE returns the records sorted by date; the last line is the latest record. The FM reads the HR buffer, so repeated calls for the same person are cheap.

Part 10 – Reading without an LDB: direct SELECT on PAnnnn

Infotype tables are normal transparent tables (PA0001, PA0002 …), so you can SELECT from them – in any program type, with joins, and pushed down to SAP HANA. The price: you must write the date logic, skip locked records and check authorizations.

" records valid at least one day in the period [lv_begda, lv_endda]
SELECT pernr, begda, endda, orgeh, plans, kostl
FROM pa0001
WHERE pernr IN @s_pernr
AND begda <= @lv_endda           " starts before the period ends
AND endda >= @lv_begda           " ends after the period starts
AND sprps  = @space              " skip locked records
ORDER BY pernr, begda
INTO TABLE @DATA(lt_p0001).

" key date: the one record valid today
SELECT SINGLE orgeh, plans
FROM pa0001
WHERE pernr  = @lv_pernr
AND begda <= @sy-datum
AND endda >= @sy-datum
INTO @DATA(ls_today).

Finding the personnel number of the current SAP user (IT0105 subtype 0001) works the same way – example on page 02 Part 4.

LDB / FM

Direct SELECT

Authorization check

Built in (P_ORGIN …)

Missing – call HR_CHECK_AUTHORITY_INFTY (page 04) for every person / infotype you output

Date logic

Macros, PROVIDE, FM parameters

Own WHERE condition on BEGDA / ENDDA

Performance

Person by person

Set-based, joins, HANA pushdown – fastest for mass data

Where usable

LDB: executable reports only; FM: anywhere

Anywhere

Infotype logic

Handles subtypes, buffer, special infotypes

Only what the table contains

Never output HR data read with SELECT without an authorization check – this is a typical audit finding.

Part 11 – Complete sample report: PNP + IT0001/0002 + ALV

An employee list: for each selected person the latest organizational assignment and personal data in the period, shown in an ALV grid with CL_SALV_TABLE (ALV in depth: CORE ABAP › 03 Report Programming & ALV and OOPS ABAP › 04 ALV Reporting).

REPORT zhr_employee_list.
" Program attributes: type 1 (executable), logical database PNP

TABLES pernr.
INFOTYPES: 0001, 0002.

TYPES: BEGIN OF ty_out,
pernr TYPE pernr_d,
ename TYPE p0001-ename,
bukrs TYPE p0001-bukrs,
orgeh TYPE p0001-orgeh,
plans TYPE p0001-plans,
kostl TYPE p0001-kostl,
gbdat TYPE p0002-gbdat,
END OF ty_out.

DATA gt_out TYPE STANDARD TABLE OF ty_out WITH EMPTY KEY.

START-OF-SELECTION.

GET pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found <> '1'.
REJECT.                           " no org. assignment in the period
ENDIF.

APPEND VALUE #( pernr = pernr-pernr
ename = p0001-ename
bukrs = p0001-bukrs
orgeh = p0001-orgeh
plans = p0001-plans
kostl = p0001-kostl ) TO gt_out ASSIGNING FIELD-SYMBOL(<ls_out>).

rp_provide_from_last p0002 space pn-begda pn-endda.
IF pnp-sw-found = '1'.
<ls_out>-gbdat = p0002-gbdat.     " date of birth
ENDIF.

END-OF-SELECTION.
IF gt_out IS INITIAL.
MESSAGE 'No employees found' TYPE 'S' DISPLAY LIKE 'W'.
RETURN.
ENDIF.

TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
CHANGING  t_table      = gt_out ).
lo_alv->get_functions( )->set_all( abap_true ).      " sort, filter, export
lo_alv->get_columns( )->set_optimize( abap_true ).   " column widths
lo_alv->get_display_settings( )->set_striped_pattern( abap_true ).
lo_alv->display( ).
CATCH cx_salv_msg INTO DATA(lx_msg).
MESSAGE lx_msg TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
  • The LDB already checked P_ORGIN for every person, so no extra authorization code is needed.
  • Test it: enter a period (e.g. Current month) and a few personnel numbers or an org unit on the selection screen, press F8.

Part 12 – Interview questions

Q1. Why do HR reports use logical databases instead of SELECT?

PNP gives the standard HR selection screen, selects the persons, checks HR authorizations (P_ORGIN) and fills all infotype tables per person. The report only processes one person at a time in GET PERNR. A direct SELECT is possible but you must then do the date logic and the authorization check yourself.

Q2. Which HR logical databases do you know, and when do you use each?

PNP for HR master data (PA, time, payroll); PNPCE for the same with concurrent employment – recommended for new reports; PCH for personnel planning objects (OM, PD, training and events); PAP for recruitment.

Q3. What does the INFOTYPES statement do?

INFOTYPES: 0001. creates an internal table P0001 with header line and structure P0001. With an LDB it is filled at GET PERNR with all records of the person. MODE N stops the LDB from reading it.

Q4. What is the difference between RP_PROVIDE_FROM_LAST and RP_PROVIDE_FROM_FRST?

Both copy one record of a Pnnnn table into its header line: LAST the latest, FRST the earliest record valid in the given period (optionally for one subtype). PNP-SW-FOUND = '1' if a record was found, '0' if not.

Q5. Where are the HR macros defined?

Centrally in table TRMAC (hyphen form, e.g. RP-PROVIDE-FROM-LAST, RP-READ-INFOTYPE), so programs can use them without an INCLUDE; display them in SE16. PNP reports also get the underscore form RP_PROVIDE_FROM_LAST from the logical database.

Q6. When do you use PROVIDE instead of the macros?

When you need every change within a period, not just one record. PROVIDE loops over the sub-intervals in which the data of all listed infotype tables is constant and cuts BEGDA / ENDDA to each interval.

Q7. How do you read a repetitive structure such as the wage types of IT0008?

With DO 40 TIMES VARYING lv_lgart FROM p0008-lga01 NEXT p0008-lga02 VARYING lv_betrg FROM p0008-bet01 NEXT p0008-bet02, exiting when the wage type is initial. Modern alternative: ASSIGN COMPONENT with a generated field name.

Q8. What is an HR report category?

A setting in the program attributes of a PNP / PNPCE report that decides which selection fields and period types the standard selection screen shows. SAP delivers many; you can create your own in Customizing.

Q9. What is the difference between PNP and PNPCE?

PNPCE supports concurrent employment (one person with several personnel assignments). It uses NODES peras and GET peras instead of TABLES pernr and GET pernr, and has its own report categories.

Q10. How do you get all employees of an organizational unit?

Call RH_STRUC_GET with object type O, the org unit ID and evaluation path O-S-P, then keep the result lines with OTYPE = 'P'. In a PCH report the evaluation path on the selection screen does the same.

Q11. What must you take care of when you SELECT directly from PA0001?

Date logic (begda <= end AND endda >= start), locked records (SPRPS), and the missing authorization check – call HR_CHECK_AUTHORITY_INFTY before you output the data.

Q12. Which FMs read HR data and which one writes it?

Read: HR_READ_INFOTYPE, HR_READ_SUBTYPE (PA), RH_READ_INFTY (PD / OM), RH_STRUC_GET (structures). Write: HR_INFOTYPE_OPERATION, with the employee locked by BAPI_EMPLOYEE_ENQUEUE (page 04).

🏠 Start Here · ◀ 02 · Infotypes & PA · 04 · Infotype Development ▶ · Sections: CORE ABAP | OOPS ABAP | ABAP on HANA | Clean Core | RAP | ABAP Points | SAP Fiori | SAPUI5 | Mobile Development (MDK) | BTP Foundations | BTP Development | CAP | SAP Build | ABAP on BTP | Integration Suite | SAP Business AI | SAP BASIS | Security | SAP SDLC

Functional: FICO ABAP | TRM ABAP | VIM | SAP BIS | SD ABAP | MM ABAP | PP ABAP | QM ABAP | PM ABAP | PS ABAP | EWM | TM ABAP | EHS ABAP | HR ABAP | BW | SAP MDG | SAP Analytics Cloud | SAP Ariba | SAP CX | SAP IBP