SAPContext
Analyze ABAP/CDS objects to understand their purpose, dependencies, and impact before making changes. Returns intent and compressed dependency contracts.
Instructions
Primary tool for understanding ABAP/CDS objects before specs, reviews, explanations, or changes — use instead of SAPRead when the user asks what an object does. Returns intent first (the object KTD when available) then compressed dependency contracts. Use SAPRead after SAPContext for exact source/method bodies/grep/drafts.
Decision rule — pick the action from the user's question:
"What breaks if I change ?" / "Who consumes <I_*>?" / "Blast radius" → action="impact" (DDLS only).
"Which includes/appends extend ?" → action="structure", type="TABL".
"What does do?" / "Explain" / "deps before editing" → action="deps" (default).
"Find all callers of " (needs cache warmup) → action="usages".
impact (CDS blast-radius): upstream AST deps + downstream where-used, classified into RAP buckets (projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls, metadataExtensions, abapConsumers, documentation, tables, other) + sibling-consistency hints. Use this instead of text-scanning DDDDLSRC/ACMDCLSRC with SAPQuery (it filters the noise). Optional includeIndirect, siblingCheck, siblingMaxCandidates. deps (default): target KTD + the public API contracts of its dependencies (not full source) — one compact response vs N SAPRead calls (7-30x fewer tokens); SAP standard objects filtered out. For CDS, includes dependency DDL/field catalogs for cl_cds_test_environment. structure (TABL only): the DDIC include/append tree.
Use SAPContext BEFORE editing existing objects. For non-CDS reverse-lookup use SAPNavigate(references); for CDS prefer impact. Full detail: docs_page SAPContext.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Object name (e.g., ZCL_ORDER) | |
| type | No | Object type. Optional for action="impact" (defaults to DDLS); required otherwise. | |
| depth | No | Dependency depth: 1 = direct deps only (default), 2 = deps of deps, 3 = maximum. Higher depth = more context but more SAP calls. | |
| group | No | Required for FUNC type. The function group containing the function module. | |
| 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) = object understanding / forward dependency context — "what does <object> do?" or "what does <object> depend on?". Returns the object KTD when available plus 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. "structure" = TABL includes/appends. | |
| source | No | Optional: provide source directly instead of fetching from SAP. Saves one round-trip if you already have the source from SAPRead. | |
| maxDeps | No | Maximum dependencies to resolve (default 20). Lower = faster + fewer tokens. | |
| includeKtd | No | Only for action="deps". When true/default, prepend the object Knowledge Transfer Document (KTD/SKTD) when one exists. Set false to skip the KTD lookup. | |
| siblingCheck | No | Only for action="impact". Enable sibling metadata-extension consistency analysis. Default true. | |
| includeIndirect | No | Only for action="impact". Include indirect (transitive) downstream where-used entries. Default false. | |
| siblingMaxCandidates | No | Only for action="impact". Maximum sibling DDLS candidates to compare. Default 4; hard cap 10. |