Repository navigation
Debugging
The sap-dev AI skill provides comprehensive ABAP debugging capabilities built on the native SAP ADT HTTP debugger engine (/sap/bc/adt/debugger/*).
It supports debugging across SAP GUI for Windows, SAP GUI for Java, HTTP / OData / Fiori APIs, RFC Function Modules, and Background Tasks.
| Tool Name | Lifecycle Stage | Description |
|---|---|---|
sap_debug_trace |
One-Shot (Track A) |
Recommended: Automated execution trace. Sets a breakpoint (line, statement, exception, or message), fires an asynchronous trigger request, catches the session, steps forward, evaluates SY system fields & watched variables, and guarantees auto-cleanup in a single call. |
sap_debug_breakpoint |
Setup | Unified breakpoint manager: set, list, or clear external/session breakpoints across strictly typed targets (line, statement, exception, message). Supports user targeting (e.g. user: "YDZHENYEYEV"). |
sap_debug_attach |
Attach | Initializes background HTTP long-poll listener, catches waiting debuggee sessions, and can automatically resynchronize & trigger SAP GUI execution (trigger_program: "ZREPORT") or HTTP endpoints (trigger_uri: "..."). |
sap_debug_context |
Inspect | Retrieves current stack frames, active variables, and auto-evaluated SY system fields from the active debug session. |
sap_debug_step |
Navigate | Executes a debugging step (stepInto, stepOver, stepReturn, stepContinue, detachDebugger, terminateDebuggee) and returns the updated stack and variables. |
sap_debug_evaluate |
Inspect | Evaluates and drills down into complex internal tables, structures, or expressions (parent_id: "LT_DATA"). |
sap_debug_cleanup |
Teardown | Drops active debug sessions and safely wipes external breakpoints from backend ICFATTRIB tables. |
For 95% of API, OData, or backend debugging needs, use sap_debug_trace. It executes the entire lifecycle (set breakpoint
{
"line": {
"class": "CL_ADT_MESSAGE_CLASS_API",
"line": 225
},
"trigger_request": {
"uri": "/sap/bc/adt/messageclass?corrNr=A4HK900151",
"method": "POST",
"body": "<?xml version=\"1.0\"...?>"
},
"watch_variables": ["LV_SUBRC", "LV_OBJECT_NAME"],
"auto_step_count": 2
}
When deep multi-step exploration or variable drilling is required:
-
Set Breakpoint:
sap_debug_breakpoint(action: "set", line: {class: "CL_MY_CLASS", line: 42}) -
Attach Listener:
sap_debug_attach(trigger_uri: "/sap/opu/odata/sap/ZSERVICE_SRV/EntitySet", timeout_seconds: 30) -
Step & Inspect:
sap_debug_step(action: "stepOver")sap_debug_evaluate(parent_id: "LT_CUSTOMERS")
-
Cleanup:
sap_debug_cleanup()
When debugging interactive transactions, classic Dynpro screens, or reports executed in SAP GUI for Windows or SAP GUI for Java:
sequenceDiagram
autonumber
actor User as Developer (SAP GUI)
participant Bridge as sap-bridge (MCP)
participant SAP as SAP Backend (Kernel)
Note over User,SAP: One-Time Setup: Enable External Debugging in SE38 Settings
Bridge->>SAP: sap_debug_breakpoint(set line 12 for User)
Bridge->>SAP: sap_debug_attach(starts long-poll listener)
User->>SAP: Enter /H_REFRESH_EXT_BPS in GUI command field
SAP-->>User: "External breakpoints loaded, debugging activated"
User->>SAP: Press F8 (Execute ZREPORT)
SAP->>SAP: Work Process halts at Line 12
SAP->>Bridge: Notify debuggee session
Bridge->>SAP: Attach and fetch stack + variables
Bridge-->>User: Returns variable inspection to AI Agent
Bridge->>SAP: sap_debug_step(stepOver / detachDebugger)
SAP-->>User: Resumes execution in SAP GUI window
- Open transaction
SE38orSE80. - Navigate to menu: Utilities
$\rightarrow$ Settings$\rightarrow$ ABAP Editor$\rightarrow$ Debugging. - Under Debug External Requests (e.g. RFC, HTTP):
- Select the User radio button and verify your SAP username (e.g.,
YDZHENYEYEV). - Keep Current application server only unchecked.
- Select the User radio button and verify your SAP username (e.g.,
- Click the green checkmark (
$\checkmark$ ) to save.
Whenever new breakpoints are registered, load them into your active GUI session:
- In the SAP GUI command box (top-left), enter:
and press Enter. The status bar confirms: "External breakpoints loaded, debugging activated".
/H_REFRESH_EXT_BPS - To explicitly re-bind your user session:
/H_REACTIVATE_EXTD_DBG KIND=USER USER=<SY-UNAME>.
The agent can automate the entire listen
sap_debug_attach(
system_alias: "TD1-100",
trigger_program: "ZPUZZLE_1X",
timeout_seconds: 60
)
sap-bridge will establish the listener, trigger GUI resynchronization in the attached session, and run SE38 $\rightarrow$ F8.
When executing transactions or clicking buttons manually:
-
Agent sets breakpoint:
sap_debug_breakpoint(action: "set", line: {program: "ZREPORT", line: 12}) -
Agent starts listener:
sap_debug_attach(timeout_seconds: 120) -
Developer runs GUI action: In SAP GUI, run
/H_REFRESH_EXT_BPSand press F8 (or click a dynpro button). - Agent inspects: Work process halts; the agent receives current line, stack trace, and variable values.
-
Agent steps or resumes:
sap_debug_step(action: "stepOver")-
sap_debug_step(action: "detachDebugger")releases control back to your SAP GUI window.
-
Cleanup:
sap_debug_cleanup()ensures zero lingering backend locks.