SAPContext
Provides compressed dependency context or CDS blast-radius impact for ABAP/CDS objects. Choose impact analysis to find what breaks when changing a CDS view, or deps to understand dependencies before editing.
Instructions
Get compressed dependency context or CDS blast-radius impact for an ABAP / CDS object.
Decision rule — pick the action based on the user's question:
"What breaks if I change ?" / "Who consumes <I_*>?" / "Impact analysis on " / "Blast radius" → action="impact"
"Understand dependencies before editing " / "What does X depend on?" → action="deps" (default)
"Find all callers of " (cache-warmup required) → action="usages"
action="impact" (CDS blast-radius, DDLS only): ALWAYS use this for CDS change-impact questions. Returns upstream AST dependencies plus downstream where-used results classified into RAP-aware buckets: projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls (DCLS), metadataExtensions (DDLX), abapConsumers, documentation (SKTD), tables, other. Also emits additive sibling-consistency diagnostics (consistencyHints + siblingExtensionAnalysis) when sibling DDLS variants in the same package show asymmetric metadata-extension coverage. DO NOT replicate this with SAPQuery against DDDDLSRC/ACMDCLSRC/DDLXSRC_SRC/SRVDSRC_SRC — those text scans produce noise (non-dependency matches, package group nodes) that this classifier already filters out. Optional includeIndirect=true widens to transitive consumers. Optional siblingCheck=false disables sibling analysis; siblingMaxCandidates controls fan-out (default 4, hard cap 10).
action="deps" (default): Returns only the public API contracts (method signatures, interface definitions, type declarations) of all objects that the target depends on — NOT the full source code. The most token-efficient way to understand dependencies. Instead of N separate SAPRead calls returning full source (~200 lines each), returns ONE response with compressed contracts (~15-30 lines each). Typical compression: 7-30x fewer tokens.
What deps extracts per dependency:
Classes: CLASS DEFINITION with PUBLIC SECTION only (methods, types, constants). PROTECTED, PRIVATE and IMPLEMENTATION stripped.
Interfaces: Full interface definition (interfaces are already public contracts).
Function modules: FUNCTION signature block only (IMPORTING/EXPORTING parameters).
CDS views (DDLS): All data sources (tables, other CDS views), association targets, and compositions. Each dependency's full source is included (table definitions, CDS DDL). Essential for CDS unit test generation — provides the dependency graph and field catalogs needed for cl_cds_test_environment doubles.
Filtering (deps): SAP standard objects (CL_ABAP_, IF_ABAP_, CX_SY_) are excluded. Custom objects (Z, Y*) are prioritized.
Use SAPContext BEFORE writing code that modifies or extends existing objects. Use SAPRead to get the full source of the target object, then SAPContext to understand its dependencies.
For non-CDS reverse-lookup, use SAPNavigate(action="references"). For CDS reverse-lookup, ALWAYS prefer action="impact" over SAPNavigate — it returns the same where-used data pre-classified into RAP buckets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Action: "impact" = CDS blast-radius analysis (DDLS only). USE THIS for any question like "what breaks if I change <view>", "who consumes <I_*>", "impact analysis on <CDS>", "downstream of <view>". Returns upstream AST dependencies + downstream where-used classified into RAP buckets (projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls, metadataExtensions, abapConsumers, documentation, tables, other), plus additive sibling-consistency diagnostics (consistencyHints + siblingExtensionAnalysis) when related DDLS siblings show asymmetric DDLX coverage. ALWAYS prefer over SAPQuery against DDDDLSRC/ACMDCLSRC/DDLXSRC_SRC/SRVDSRC_SRC (those text-scans produce noise this classifier filters out). Non-DDLS input returns a guardrail error. "deps" (default, can be omitted) = forward dependency context — "what does <object> depend on?". Returns public API contracts of dependencies. "usages" = reverse dependency lookup — "who calls <object>?". Requires cache warmup (--cache-warmup). Only "name" is needed. For CDS entities prefer action="impact" instead. | |
| type | No | Object type. Required for action="deps" and action="usages". Optional for action="impact" — defaults to DDLS (the only supported type for impact). | |
| name | Yes | Object name (e.g., ZCL_ORDER) | |
| source | No | Optional: provide source directly instead of fetching from SAP. Saves one round-trip if you already have the source from SAPRead. | |
| group | No | Required for FUNC type. The function group containing the function module. | |
| maxDeps | No | Maximum dependencies to resolve (default 20). Lower = faster + fewer tokens. | |
| depth | No | Dependency depth: 1 = direct deps only (default), 2 = deps of deps, 3 = maximum. Higher depth = more context but more SAP calls. | |
| includeIndirect | No | Only for action="impact". Include indirect (transitive) downstream where-used entries. Default false. | |
| siblingCheck | No | Only for action="impact". Enable sibling metadata-extension consistency analysis. Default true. | |
| siblingMaxCandidates | No | Only for action="impact". Maximum sibling DDLS candidates to compare. Default 4; hard cap 10. |