CLAUDE.md — HR Infotype Reader (Global Aggregation Class)
CLAUDE.md — HR Infotype Reader (Global Aggregation Class)
This file is the entry point for Claude Code when working on this project.
Read it first. Individual specifications live under specs/.
Project context
The artifact to build is a global, reusable ABAP OO class that reads an arbitrary list of PA infotypes (PA0000, PA0001, PA0002, …) for a single PERNR within a given BEGDA/ENDDA window and returns a time-sliced aggregated table: one row per unique combination of field values across all requested infotypes, with the infotype records nested per row as sub-tables.
Deliverables
| # | Name | Type | Spec |
|---|---|---|---|
| 1 | ZCL_HR_INFOTYPE_READER | Global class | specs/infotype_reader_spec.md |
| 2 | ZCX_HR_INFOTYPE_READER | Exception class | specs/exception_class_spec.md |
| 3 | Internal infotype-read pattern | Pattern doc | specs/infotype_reading_pattern.md |
Non-negotiable technical rules
These are hard constraints for this codebase. Violations should fail review.
- Use
CL_HRPA_READ_INFOTYPEviaIF_HRPA_READ_INFOTYPE, notHR_READ_INFOTYPE. Obtain the instance viaCL_HRPA_READ_INFOTYPE=>GET_INSTANCE( IMPORTING infotype_reader = ... ). Seespecs/infotype_reading_pattern.md. - No LDB
PNPCE. The class is a utility and must be callable from any context (reports, BAdIs, background jobs, odata artifacts, RAP behaviors). Authorization is handled explicitly via theno_auth_checkparameter ofIF_HRPA_READ_INFOTYPE->READ/READ_WIDEand the returnedmissing_authflag. - Two-level buffering is mandatory.
- Class-level meta cache (
GT_META_CACHE, keyed by(infty, molga)) for the T777D/T582V/T582W classification and linkage data that is static per MOLGA. - Instance-level PRELP cache (
MT_PRELP_CACHE, keyed by(pernr, infty)) for raw read results. Prevents a second physical read for the same employee/infotype within the reader lifetime.
- Class-level meta cache (
- Primary vs Secondary dispatch is explicit. Driven by
T777D-INFKN:'I'= primary,'Z'= secondary. For primary with a linked secondary (resolved viaT582V→T582W), useREAD_WIDEand cache both rows. For secondary on its own, find the owning primary viaT582W→T582V, wide-read the primary, then serve the secondary from cache. Standalone primary usesREAD. The top-levelREAD_AGGREGATED_*methods also auto-expand the caller'sIT_INFOTYPESwith the linked partner of each entry, so both sides of a primary/secondary pair appear in the result regardless of which side was requested — typed-mode callers must declareT_IT<NNNN>for both (seespecs/infotype_reader_spec.md§6.4). - PRELP → PNNNN conversion via
CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN_TAB. Never try to manually un-pack PRELP. The cache stores raw PRELP; the conversion to typedP<NNNN>rows happens at serve time. CX_HRPA_VIOLATED_ASSERTIONis the expected framework exception from the reader. Catch it locally and re-raise asZCX_HR_INFOTYPE_READERwith a definedtextidand numeric exception code. Never let it escape.MISSING_AUTHis a warning, not an exception. The infotype is skipped, a warning is appended to the message table, processing continues for the remaining infotypes. Raising on auth failure would break batch runs where exactly this scenario is expected for some employees.- Constructors do only safe work (field assignments, internal table init). Heavy I/O, authority checks and DB reads belong in explicit methods that can raise exceptions. This aligns with the project convention set by
ZCL_HR_XML_*. The class isCREATE PRIVATE; instantiate viaZCL_HR_INFOTYPE_READER=>CREATE( … ). - All exceptions are typed — raise
ZCX_HR_INFOTYPE_READERwith a definedtextidand numeric code. Never raise genericCX_ROOTor swallow exceptions silently. - Single-responsibility.
ZCL_HR_INFOTYPE_READERreads and aggregates. It does not write, log to application log (it returns messages for the caller to log), and does not depend onZCL_HR_XML_*classes.
Coding standards
- Naming:
Zprefix, classZCL_HR_INFOTYPE_READER, exceptionZCX_HR_INFOTYPE_READER. - Parameters:
IV_/IT_/IS_/IR_for input,EV_/ET_/ES_/ER_for output,CV_/CT_/CS_for changing,RV_/RT_/RS_/RR_for returning. - Internal method parameters may use
I_/E_/C_/R_where brevity helps; public methods always use the fullIV_-style prefix. - Constants:
GC_*class-level,LC_*local, upper-snake names. - Attributes: class-level
GT_*/GO_*/GV_*, instanceMT_*/MO_*/MV_*. - All public methods and attributes have ABAP Doc comments (
"!). - Modern ABAP constructor expressions (
VALUE,NEW, inlineDATA,FOR … IN …,CORRESPONDING) are preferred when readability is equal or better. Classic syntax is fine for database reads where it reads more cleanly. - Unit tests live in the local test include (ABAP Test Class Unit). Minimum coverage: happy path with one infotype, happy path with multiple infotypes requiring time-slicing, primary+secondary pairing (wide read), invalid PERNR, invalid date range, locked records (
SPRPShandling), structure mismatch in typed-mode call, buffer-hit path,missing_authwarning path.
Tooling
abap-docs MCP server
This project uses the abap-docs MCP server as the authoritative reference for SAP class and interface signatures, BAdI definitions, and DDIC types. Claude Code must query abap-docs before hand-writing signatures for any standard SAP object:
CL_HRPA_READ_INFOTYPEand its interfaceIF_HRPA_READ_INFOTYPE(methodsREAD,READ_WIDE,GET_INSTANCE)CL_HR_PNNNN_TYPE_CAST(PRELP_TO_PNNNN_TAB)CL_HRPA_TCLAS(constantsTCLAS_EMPLOYEEetc.)CX_HRPA_VIOLATED_ASSERTION- DDIC types:
PRELP,PRELP_TAB,HRPAD_INFOTYPE_DATA_TAB,T777D,T582V,T582W,P<NNNN>structures - Polish-specific infotype structures:
P0515,P0528,P0557,P0558,P0569
If a signature returned by abap-docs conflicts with what appears in a spec, the abap-docs result wins — update the spec and flag the change in the commit message.
Configure in .mcp.json / claude_code_config.json at the project root. The server name used in prompts is abap-docs.
How Claude Code should approach changes
- When asked to implement or modify a method, first open the corresponding spec under
specs/. If behavior is not covered by the spec, stop and ask rather than inferring. - When a spec and the code disagree, the spec is the source of truth unless the user explicitly overrides it. In that case, update the spec in the same change.
- When introducing a new infotype into an existing implementation, verify with
abap-docswhetherP<NNNN>exists as a DDIC structure and check itsT777D-INFKNclassification. Customer infotypes (9000–9999) may need custom metadata handling if they are not represented inT582V/T582W. - Preserve the distinction between "hard error" (raise
ZCX_HR_INFOTYPE_READER) and "soft warning" (append toET_MESSAGESand continue). Seespecs/exception_class_spec.mdfor the classification table.
Out of scope for this class
- Writing / modifying / deleting infotype records (INSERT / MODIFY / DELETE operations).
- Cluster data (B2, CU, etc.) and PCL reads.
- OM infotypes (
HRP1000,HRP1001, …). A separate OM reader class may reuse this class's patterns but is not in scope. - Payroll results (
PAYxx_RESULT_*). - Time management infotypes in evaluated form (raw reads of
2001/2002/2003are fine if requested explicitly — only the evaluation engine is out of scope). - Multi-PERNR reads. The class reads exactly one
PERNRper call. Callers looping over employees instantiate the reader once and reuse the instance — the buffer then works across the loop.