Skip to content

feat(adt): SAP Enhancement Framework (ENHO) read support#130

Open
barkow15 wants to merge 3 commits into
oisee:mainfrom
barkow15:feat(adt)/read-enhancements
Open

feat(adt): SAP Enhancement Framework (ENHO) read support#130
barkow15 wants to merge 3 commits into
oisee:mainfrom
barkow15:feat(adt)/read-enhancements

Conversation

@barkow15

Copy link
Copy Markdown

Adds the ability to read SAP enhancement implementations (ENHO objects) through the MCP surface — bridging the gap between what the ADT REST API exposes and what a developer actually sees in SE80.

Background

SAP's enhancement framework stores plug-in implementations as independent ADT objects (ENHO/XH, ENHO/XC, etc.). SE80 merges these into the host include's displayed source at render time, but the raw ADT source endpoint never returns them. On classic ECC systems, the REST surface is missing entirely for HOOK_IMPL plug-ins — making them invisible to any tool that only speaks ADT REST.

What's new

GetEnhancement(name) — resolves an ENHO by name via SearchObject, then fetches its source through a 3-step fallback chain:

  1. Modern ADT REST (/sap/bc/adt/enhancements/enhoxh/<name>/source/main)
  2. Plural-form REST variant (some NetWeaver releases use a different path)
  3. RFC fallback via ZADT_VSP WebSocket using native READ REPORT — the only reliable path on classic ECC, where RPY_PROGRAM_READ raises CANCELLED inside RFC contexts

GetEnhancementByRef(ref) — same fetch logic, but skips re-resolution so that callers who obtained their ref via the table fallback retain the EnhInclude field (the real REPOSRC entry name with =-padding), rather than falling back to the lossy <name>E convention.

ListEnhancementsForInclude(includeName) — lists all ENHO implementations attached to a given include, also with a 3-step fallback:

  1. Enhancement-browser REST (/sap/bc/adt/enhancements/enhoxhs?enhancedObjectUri=…)
  2. Object-references REST
  3. Table join (D010INC ⨝ ENHINCINX) for ECC / older NetWeaver — the only path that works for HOOK_IMPL plug-ins on those systems

GetIncludeMerged(includeName) — returns an include's source with each referenced ENHO spliced in at its $*$\SE:(N) anchor, matching what SE80 shows with "Display Source (Modified)". Unresolvable anchors are appended with an explanatory header rather than dropped.

WebSocket: ReadSource action — added to DebugWebSocketClient alongside the existing CallRFC. Uses server-side READ REPORT instead of RPY_PROGRAM_READ to avoid the authorization dialog that blocks RFC-context reads on classic ECC.

Regex compatibility — fixed embedded ABAP (ZCL_VSP_*) to use only POSIX character classes and syntax supported on SAP versions older than 7.55, where Perl-style patterns aren't available.

Compatibility

The feature degrades gracefully at every step. When neither REST endpoint nor the ZADT_VSP bridge is available, the caller receives a structured error with enough metadata (package, include name) to navigate to the object in SE80 manually. No existing tool behavior is changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant