SAP HR Tables Every ABAP Developer Needs to Know
SAP HR Tables Every ABAP Developer Needs to Know
Master the essential PA tables, infotypes, and cluster tables that power SAP Human Capital Management
If you're working with SAP HR (Human Capital Management), understanding the underlying table structure is non-negotiable. Unlike other SAP modules where data storage follows a relatively straightforward pattern, SAP HR introduces unique concepts like infotypes, cluster tables, and time-dependent data structures that can confuse even experienced ABAP developers.
In this comprehensive guide, we'll dive deep into the SAP HR tables every developer needs to master. Whether you're building custom reports, developing interfaces, or troubleshooting payroll issues, this knowledge will become your foundation for working effectively with HR data in SAP systems.
Understanding the Infotype Concept
Before we explore specific tables, let's establish what makes SAP HR data storage unique. The cornerstone of SAP HR is the infotype concept—a systematic way of organizing employee data into logical, time-dependent information units.
An infotype is essentially a four-digit identifier (like 0001, 0002, 0008)
that represents a specific category of employee information. Each infotype
has its own dedicated database table following the naming convention PA#### where #### is the infotype number. This design allows SAP to maintain complete
historical records of every change to employee data.
Key Infotype Characteristics:
- Time-dependent: Every record has BEGDA (begin date) and ENDDA (end date)
- Personnel-specific: Linked to employee number (PERNR)
- Subtype-capable: Many infotypes support subtypes for further categorization
- Audit-ready: Complete historical tracking of all changes
This time-dependency is crucial. When you query PA tables, you're not just getting the current state—you're accessing a complete temporal database that can answer questions like "What was this employee's salary on January 15, 2023?" or "When did they change departments last year?"
PA0001: Organizational Assignment—The Central HR Table
If there's one SAP HR table you absolutely must know, it's PA0001. This table stores organizational assignment data and serves as the backbone of virtually every HR report and interface.
What PA0001 Contains
PA0001 maintains the organizational structure assignment for each employee, including:
- BUKRS: Company code
- WERKS: Personnel area
- PERSG: Employee group
- PERSK: Employee subgroup
- ORGEH: Organizational unit
- PLANS: Position
- STELL: Job
- KOSTL: Cost center
Common PA0001 Query Patterns
Here's a typical ABAP query to retrieve current organizational assignments:
SELECT pernr, bukrs, werks, orgeh, plans, kostl, begda, endda
FROM pa0001
INTO TABLE @DATA(lt_org_assignment)
WHERE endda = '99991231' " Current records only
AND begda <= @sy-datum " Valid today
AND sprps = 'X'. " Lock indicator
LOOP AT lt_org_assignment INTO DATA(ls_org).
" Process current organizational data
ENDLOOP. Pro Tip: The 99991231 Pattern
The end date 99991231 (December 31, 9999) is SAP's standard
way of indicating a currently valid record. When combined with BEGDA <= SY-DATUM, this ensures you're getting active
assignments. Always include the lock indicator check (SPRPS) to exclude logically deleted records.
Why PA0001 Matters
Nearly every custom HR report joins to PA0001 because it provides the organizational context for employee data. Whether you're building a headcount report, analyzing cost center assignments, or creating organizational charts, PA0001 is your starting point. It's also essential for authorization checks—many HR security concepts rely on organizational assignment data.
PA0002: Personal Data—Demographics and Identity
PA0002 stores the personal data for employees, including demographics, nationality, and personal identifiers. This is typically the second table developers work with after PA0001.
Key Fields in PA0002
- VORNA: First name
- NACHN: Last name
- GBDAT: Date of birth
- GBORT: Place of birth
- NATIO: Nationality
- FAMST: Marital status
- GESCH: Gender
Privacy and Security Considerations
PA0002 contains sensitive personal information subject to GDPR and other privacy regulations. When working with this table:
- Implement strict authorization checks before reading
- Mask or anonymize data in non-production environments
- Log all access for audit purposes
- Never include personal data in debug outputs or logs
SELECT pernr, vorna, nachn, gbdat
FROM pa0002
INTO TABLE @DATA(lt_personal)
WHERE endda = '99991231'
AND begda <= @sy-datum
ORDER BY pernr.
" Always implement authorization check
LOOP AT lt_personal INTO DATA(ls_personal).
AUTHORITY-CHECK OBJECT 'P_ORGIN'
ID 'INFTY' FIELD '0002'
ID 'AUTHC' FIELD '03'. " Display authorization
IF sy-subrc <> 0.
" Handle unauthorized access
DELETE lt_personal.
CONTINUE.
ENDIF.
ENDLOOP. The subtypes in PA0002 are particularly important. Different countries and regions may use different subtypes to capture region-specific personal data requirements. Always check your system's configuration to understand which subtypes are active.
PA0008: Basic Pay—Compensation Data
PA0008 is where SAP stores employee compensation information. This is one of the most security-sensitive tables in the entire SAP system, and access is typically highly restricted.
Understanding Wage Types
PA0008 doesn't just store a single salary field. Instead, it uses wage types (field LGART) to categorize different types of compensation:
- Base salary
- Hourly rates
- Bonuses and incentives
- Allowances
- Special payments
Key Fields
- LGART: Wage type (the type of payment)
- BETRG: Amount
- WAERS: Currency
- ANZHL: Number (for unit-based wage types)
- OPKEN: Payroll indicator
SELECT pernr, lgart, betrg, waers, anzhl, begda, endda
FROM pa0008
INTO TABLE @DATA(lt_compensation)
WHERE endda = '99991231'
AND begda <= @sy-datum
AND lgart IN @lr_wage_types. " Restrict to specific wage types
" Join with wage type text for reporting
SELECT lgart, lgtxt
FROM t512t
INTO TABLE @DATA(lt_wage_text)
WHERE sprsl = @sy-langu.
LOOP AT lt_compensation ASSIGNING FIELD-SYMBOL(<fs_comp>).
" Process compensation data with extreme security
" Never log amounts or display without authorization
ENDLOOP. Security Warning:
PA0008 requires the highest level of protection. In most organizations, only payroll specialists and specific HR personnel have access. Custom programs reading PA0008 should implement multi-level authorization checks and comprehensive audit logging. Consider using authorization object P_ORGIN with INFTY '0008' and appropriate AUTHC values.
Annual Salary vs. Periodic Amounts
One common confusion: PA0008 can store both annual salary amounts and periodic amounts (monthly, hourly, etc.). The ANSAL field provides the annual salary equivalent, but depending on wage type configuration, the BETRG field might represent different time periods. Always check the wage type configuration in table T512W to understand the periodicity.
Other Essential PA Tables
PA0000: Actions
Stores HR actions (hiring, transfers, terminations) and their effective dates. Critical for understanding employee lifecycle events.
PA0007: Planned Working Time
Contains work schedule information including weekly hours, work schedule rules, and time management status. Essential for time and attendance integration.
PA0041: Date Specifications
Tracks important dates like hire date, seniority date, and contract end dates. Often used in calculations for leave accruals and benefits eligibility.
PA0105: Communication
Stores contact information using subtypes (0001 for system user ID, 0010 for email, etc.). This structure allows multiple communication channels per employee.
" Retrieve employee email addresses
SELECT pernr, subty, usrid_long
FROM pa0105
INTO TABLE @DATA(lt_emails)
WHERE endda = '99991231'
AND begda <= @sy-datum
AND subty = '0010'. " Email subtype
" Get system user IDs
SELECT pernr, subty, usrid
FROM pa0105
INTO TABLE @DATA(lt_userids)
WHERE endda = '99991231'
AND begda <= @sy-datum
AND subty = '0001'. " System user IDCluster Tables: PCL1 and PCL2—Payroll's Hidden Complexity
Here's where SAP HR gets truly unique: cluster tables PCL1 and PCL2. These aren't your typical database tables—they're compressed, binary storage containers that hold payroll results and time evaluation data.
Why Cluster Tables Exist
Payroll processing generates massive amounts of data: every wage type calculation, every tax determination, every deduction. Storing this in traditional transparent tables would create performance nightmares. SAP's solution: pack related data into compressed binary clusters stored in PCL1 and PCL2.
PCL1: Time Management Clusters
PCL1 stores time-related clusters including:
- B1: Time events and attendances
- B2: Time evaluation results
- ZL: Time data for time management
PCL2: Payroll Clusters
PCL2 contains payroll results with cluster types like:
- RU: Payroll results for country-specific processing
- RX: Retroactive accounting results
- RI: International payroll results
- CD: Cumulated data
Reading Cluster Data—The Right Way
You cannot simply SELECT from PCL1 or PCL2 like normal tables. SAP provides specific function modules and logical databases to access this data:
" Reading payroll results from PCL2
DATA: ls_rgdir TYPE pc261,
lt_results TYPE STANDARD TABLE OF pc207.
" First, read directory to find available payroll periods
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = lv_pernr
TABLES
in_rgdir = lt_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
" Then read actual payroll results
LOOP AT lt_rgdir INTO ls_rgdir
WHERE srtza = 'A'. " Type A = Actual payroll run
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = 'RU'
employeenumber = lv_pernr
sequencenumber = ls_rgdir-seqnr
TABLES
payroll_result = lt_results
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_import = 2
OTHERS = 3.
" Process results
ENDLOOP. Important Note:
Never attempt to read cluster tables using native SQL or direct SELECT statements. Always use SAP-provided function modules like PYXX_READ_PAYROLL_RESULT, CU_READ_RGDIR, or logical database PNP. These tools handle decompression, authorization, and proper data interpretation.
When You Need Cluster Data
Most HR reporting doesn't require cluster table access. PA tables contain master data; clusters contain results. You need clusters when:
- Building payroll result reports (payslips, wage type summaries)
- Analyzing time evaluation outcomes
- Reconciling payroll calculations
- Creating retroactive payment analysis
- Auditing specific payroll runs
For master data reporting (current assignments, personal data, organizational structure), stick with PA tables—they're faster and much simpler to work with.
Organizational Management Tables: HRP Series
Beyond Personnel Administration (PA) tables, SAP HR includes Organizational Management (OM) tables that define organizational structures, positions, jobs, and their relationships. These tables follow a different naming convention: HRP####.
HRP1000: Objects
The master table for organizational objects. Every organizational unit, position, job, and work center has a record here with its object ID (OBJID) and object type (OTYPE):
- O: Organizational unit
- S: Position
- C: Job
- K: Work center
HRP1001: Relationships
Defines relationships between organizational objects. This is where you find reporting structures, position assignments, and organizational hierarchies using relationship types (RELAT) like:
- 002: Reports to (organizational hierarchy)
- 003: Belongs to
- 008: Holder of position
" Build organizational hierarchy
SELECT objid, short, stext
FROM hrp1000
INTO TABLE @DATA(lt_orgunits)
WHERE otype = 'O'
AND plvar = '01'
AND endda >= @sy-datum
AND begda <= @sy-datum.
" Get reporting relationships
SELECT objid, sobid, relat
FROM hrp1001
INTO TABLE @DATA(lt_relationships)
WHERE otype = 'O'
AND plvar = '01'
AND relat = '002' " Reports to
AND endda >= @sy-datum
AND begda <= @sy-datum. Linking PA and OM Data
The connection between Personnel Administration and Organizational Management happens through PA0001. The PLANS field (position) and ORGEH field (organizational unit) reference HRP1000 objects. This linkage allows you to create reports that combine employee master data with organizational structure:
" Complete employee organizational context
SELECT p~pernr, p~ename, pa~orgeh, pa~plans,
o~stext AS orgunit_text, pos~stext AS position_text
FROM pa0001 AS pa
INNER JOIN hrp1000 AS o
ON o~objid = pa~orgeh
AND o~otype = 'O'
INNER JOIN hrp1000 AS pos
ON pos~objid = pa~plans
AND pos~otype = 'S'
INTO TABLE @DATA(lt_org_context)
WHERE pa~endda = '99991231'
AND pa~begda <= @sy-datum.Best Practices for Working with SAP HR Tables
1. Always Filter by Date
HR tables are time-dependent. Without proper date filtering, you'll retrieve historical records you don't need. Standard pattern:
WHERE endda = '99991231' " or >= sy-datum for current records
AND begda <= sy-datum 2. Implement Comprehensive Authorization
Use authorization object P_ORGIN for infotype access, P_ORGINCON for organizational data, and PLOG for OM data. Never bypass authorization checks in production code.
3. Use Logical Database PNP
For complex HR reports, leverage logical database PNP. It handles authorization, date selection, and provides optimized data retrieval:
REPORT z_hr_report.
TABLES: pernr.
INFOTYPES: 0001, 0002, 0008.
START-OF-SELECTION.
GET pernr.
" p0001, p0002, p0008 automatically filled
WRITE: / pernr-pernr, p0001-orgeh, p0002-nachn. 4. Check Lock Indicators
Most PA tables include lock indicator fields (SPRPS, SPRSL). Always check these to avoid processing logically deleted records.
5. Understand Delimiters
When records are "delimited" in SAP HR, the ENDDA is changed to the delimiter date—not deleted from the table. Your queries must account for this by checking ENDDA >= SY-DATUM for current records.
6. Performance Optimization
PA tables can be enormous. Always:
- Use database indexes (PERNR, BEGDA, ENDDA)
- Restrict selections with WHERE conditions
- Avoid SELECT * when you need specific fields
- Consider table buffering for small master data tables
Common Development Scenarios
Scenario 1: Current Employee Headcount by Organization
SELECT pa~orgeh, COUNT( DISTINCT pa~pernr ) AS headcount
FROM pa0001 AS pa
WHERE pa~endda = '99991231'
AND pa~begda <= @sy-datum
AND pa~sprps = 'X'
GROUP BY pa~orgeh
ORDER BY pa~orgeh. Scenario 2: Employee Profile with Multiple Infotypes
SELECT p2~pernr, p2~vorna, p2~nachn,
p1~orgeh, p1~plans, p1~kostl,
p7~arbst " Weekly hours
FROM pa0002 AS p2
INNER JOIN pa0001 AS p1
ON p1~pernr = p2~pernr
AND p1~endda = '99991231'
AND p1~begda <= @sy-datum
INNER JOIN pa0007 AS p7
ON p7~pernr = p2~pernr
AND p7~endda = '99991231'
AND p7~begda <= @sy-datum
WHERE p2~endda = '99991231'
AND p2~begda <= @sy-datum
AND p2~pernr IN @lr_personnel. Scenario 3: Finding Historical Changes
" Track organizational changes for an employee
SELECT pernr, orgeh, plans, begda, endda, uname, aedtm
FROM pa0001
INTO TABLE @DATA(lt_history)
WHERE pernr = @lv_pernr
ORDER BY begda DESCENDING.
" This shows every organizational assignment throughout historyTroubleshooting Common Issues
Problem: Missing Records
Check date ranges, lock indicators, and authorization. Use transaction PA20 to verify data exists in the infotype.
Problem: Duplicate Records
Multiple records with overlapping dates may exist due to subtypes or sequential numbers (SEQNR). Include SUBTY and SEQNR in your selection if duplicates appear.
Problem: Performance Issues
Ensure you're filtering by PERNR in the WHERE clause when possible. PA tables use PERNR as the primary key component. Use ST05 SQL trace to identify missing indexes or inefficient queries.
Problem: Cluster Read Failures
Verify payroll has been run for the period you're trying to read. Check the RGDIR directory first to confirm results exist. Ensure you're using the correct cluster ID for your country variant.
Advanced Topics: Custom Infotypes
Organizations often create custom infotypes (9000-9999 range) for company-specific data. These follow the same principles as standard infotypes:
- Table name: PA9xxx
- Time-dependent with BEGDA/ENDDA
- Linked to PERNR
- Created using transaction PM01
When working with custom infotypes, always check the data dictionary (SE11) to understand the field structure, as these vary significantly between organizations.
Conclusion: Building Your HR Data Mastery
Mastering SAP HR tables is a journey, not a destination. The infotype concept, time-dependency, cluster tables, and organizational management structures represent a sophisticated approach to managing human capital data that rewards deep understanding.
Start with PA0001 and PA0002 for basic employee information. Graduate to PA0008 when you need compensation analysis (with proper authorization). Explore cluster tables PCL1 and PCL2 only when payroll results are truly necessary. And leverage organizational management tables (HRP series) to build organizational context into your reports.
Remember: authorization and data privacy aren't optional in HR development. Every query you write should include proper authorization checks, and every program should log sensitive data access.
The SAP HR tables we've covered form the foundation of virtually every HR business process. Whether you're building reports for management, creating interfaces to external systems, or developing custom applications, this knowledge will serve you throughout your SAP career. Keep this guide handy, practice with real data in your development system, and always prioritize data security in production implementations.