SAPDiagnose
Run diagnostics on ABAP objects: syntax checks, unit tests, ATC checks, and analyze runtime errors, short dumps, and OData performance.
Instructions
Run diagnostics on ABAP objects and analyze runtime errors. Actions:
"syntax": syntax-check (name+type; optional version; optional source = pre-write dry-run, nothing written).
"unittest": run ABAP Unit tests (name+type).
"atc": run ATC checks (name+type; optional variant).
"cds_testcases": SAP-suggested ABAP Unit test cases for a CDS entity (name; read-only; SAP_BASIS 8.16+).
"object_state": compare active and inactive source versions without fetching both (name+type; CLAS compares all includes). Returns ETags, hashes, divergence flags.
"quickfix": get quick-fix proposals at a position (name+type+source+line; optional column, sourceUri).
"apply_quickfix": apply one proposal, return text deltas, no write (name+type+source+line+proposalUri+proposalUserContent; pass proposalUserContent through exactly, may be empty).
"dumps": list/read ST22 short dumps (no id = list; id = read; includeFullText, sections).
"traces": list/analyze profiler traces (id+analysis: hitlist=hot spots, statements=call tree, dbAccesses=DB stats).
"trace_start": arm a profiler trace for the NEXT matching execution, then reproduce and read via "traces" (write scope; defaults: next HTTP request, SQL on; optional traceUser/processType/maxExecutions/expiresHours/sqlTrace/…).
"trace_requests": list armed trace requests. "trace_cancel": cancel one by id (write scope).
"system_messages": list SM02 messages. "gateway_errors": list /IWFND/ERROR_LOG (on-prem; detailUrl or id+errorType for detail).
"odata_perf": diagnose why an OData call is slow (url = host-relative path from the Network tab); returns the sap-statistics timing split (DB/ABAP/framework/auth) + a verdict. Read-only; needs allowDataPreview.
"authorization_trace": read the on-prem STUSERTRACE authorization trace from SUAUTHVALTRC (optional user/authObject/onlyFailures/maxResults). Read-only; needs SAP_ALLOW_DATA_PREVIEW. Example: {"action":"authorization_trace","user":"AUTH_TEST","onlyFailures":true}.
"cds_sql": show the native SQL a CDS view compiles to (name; read-only; may be absent on old releases).
"sql_trace_state" / "set_sql_trace_state" (sqlOn; needs SAP_ALLOW_WRITES) / "sql_trace_directory": ST05 SQL-trace control. Quickfix workflow: syntax/ATC → quickfix → apply_quickfix → write via SAPWrite. Full action reference: docs_page SAPDiagnose.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Dump or trace ID (for dumps/traces actions); also the trace-request id to cancel (for trace_cancel). Omit to list, provide to get details. | |
| to | No | Optional upper time boundary for feed-based diagnostics actions (system_messages/gateway_errors). | |
| url | No | For odata_perf: the host-relative OData path to probe, from the Fiori app's Network tab (e.g. "/sap/opu/odata4/sap/.../Entity?$filter=…"). Must be a path on the connected system — absolute URLs are rejected. | |
| from | No | Optional lower time boundary for feed-based diagnostics actions (system_messages/gateway_errors). | |
| line | No | Source line number for quickfix evaluation (required for quickfix/apply_quickfix). | |
| name | No | Object name (for syntax/unittest/atc/object_state); the CDS entity / DDLS source name for cds_testcases and cds_sql | |
| type | No | Object type (PROG, CLAS, etc.) (for syntax/unittest/atc/object_state) | |
| user | No | SAP-user filter for dumps, feeds, or authorization_trace. | |
| sqlOn | No | For action="set_sql_trace_state": true to arm the ST05 SQL trace, false to disarm. Combine with user to filter the trace to one SAP user. | |
| action | Yes | Diagnostic action | |
| column | No | Source column number for quickfix evaluation (default 0 for quickfix actions). | |
| source | No | Current source code (required for quickfix/apply_quickfix). | |
| variant | No | ATC check variant (for atc action) | |
| version | No | Source version for syntax check (default "active"). Use "inactive" to validate pending changes. | |
| analysis | No | Trace analysis type (for traces action with id). hitlist = execution hot spots, statements = call tree, dbAccesses = database access stats. | |
| coverage | No | For action="unittest": also return statement/branch/procedure coverage for the object, plus methodsBelowFull — the methods below 100% statement coverage, worst first (what to test next) — in one extra round-trip. If the coverage endpoint or measurement is unavailable, returns the tests without coverage. Default false. | |
| sections | No | Dump chapter IDs to include for dumps detail mode (for example ["kap0","kap3","kap8"]). Omit to use focused defaults. | |
| sqlTrace | No | For trace_start: capture SQL/DB accesses (default true — required for analysis="dbAccesses"). | |
| aggregate | No | For trace_start: aggregate the trace (default true). | |
| detailUrl | No | ADT detail URL for gateway_errors detail mode (preferred over id+errorType). Accepts absolute or /sap/bc/adt/... path. | |
| errorType | No | Gateway error type for gateway_errors detail by id (for example "Frontend Error"). Required when using id without detailUrl. | |
| sourceUri | No | Exact ADT source URI for quickfix/apply_quickfix. Defaults to the type/name main source; use this for class includes such as /includes/definitions. | |
| traceUser | No | For trace_start/trace_requests: the SAP user whose matching execution is traced/listed. Defaults to the connected user. | |
| authObject | No | Authorization object filter, e.g. S_TCODE. | |
| maxResults | No | Maximum results for dumps/system_messages/gateway_errors (default 50) or authorization_trace (default 100); bounded to a safe cap. | |
| objectType | No | For trace_start: what to match within the process. Defaults to the valid type for the process type (http→url, dialog→transaction, batch→report, rfc→functionModule). | |
| description | No | For trace_start: optional label for the trace request. | |
| processType | No | For trace_start: the kind of work process to capture. Default "http" (OData/Gateway). dialog = SAP GUI transaction, batch = background job, rfc = RFC call. | |
| proposalUri | No | Quickfix proposal URI from quickfix action (required for apply_quickfix). | |
| expiresHours | No | For trace_start: hours until the armed request auto-expires (default 24). | |
| onlyFailures | No | For authorization_trace: return only denied checks (RC<>0), similar to the SU53 failure view. | |
| maxExecutions | No | For trace_start: how many matching executions to capture before the request is consumed (default 1). | |
| includeFullText | No | For dumps detail mode only: include full formattedText blob. Default false to reduce token usage. | |
| proposalUserContent | No | Opaque userContent from quickfix action (required for apply_quickfix). May be an empty string; pass through exactly. | |
| proposalAffectedObjects | No | Optional affectedObjects array from quickfix action. Include content for each affected source unit when applying multi-object quickfixes. |