Skip to main content
Glama

Sap Se37 Edit

sap_se37_edit
Destructive

Edit an existing ABAP function module in SE37 by replacing its full source, running syntax checks, and activating it; changes revert automatically if checks fail.

Instructions

Edit an existing ABAP function module in SE37. If sap-adt is available, prefer its patch_source or set_source_from_file tools — faster, no GUI needed.

Replaces the entire source code, runs syntax check (Ctrl+F2), and activates (Ctrl+F3). Auto-reverts if check or activation fails.

Important: Only for EXISTING function modules. To create new ones, use abapGit.

Workflow: Read current source with sap_se37_lookup first (check the Quelltext/Source Code tab), modify it, then call this tool with the full new source.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "function_module": "<function_module>",
      "new_source": "<new_source>"
    },
    "name": "sap_se37_edit"
  }
}

Input Schema

NameRequiredDescriptionDefault
sessionNoSession ID (e.g., "s1", "s2"). None uses primary session.
agent_idNoAgent identifier for binding check. Optional.
new_sourceYesComplete new ABAP source code to replace the current code.
function_moduleYesName of the function module (e.g., 'Z_TEST_MCP_EDIT').

Output Schema

NameRequiredDescriptionDefault
errorNoError message if success=False
popupNoPresent when a popup dialog is active on screen
successNoWhether the operation succeeded
activatedNoWhether the function module was successfully activated
active_windowNoWhich window was operated on (e.g., 'wnd[0]', 'wnd[1]'). If 'wnd[1]' or higher, a modal dialog is open.
backup_sourceYesOriginal source code before editing (for reference/undo)
check_messagesNoMessages from syntax check and activation
function_moduleYesName of the function module that was edited

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial behavior beyond the annotations: full source replacement, an automatic syntax check, activation, and automatic revert on failure. That revert-on-failure detail is exactly the kind of safety context annotations do not convey. However, it remains silent on permission/authorization requirements and on session/agent_id binding semantics, so with destructiveHint=true already declared it adds useful but not complete behavioral coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the operation, then alternates/guidance, then side effects, then workflow, each as a short scannable block. The 'Important' note slightly restates the opening 'existing' scope, but every line still carries actionable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive whole-source-replacement tool, the description covers preconditions, side effects, failure handling, and the recommended preceding step, while the output schema and destructive/readOnly annotations handle return values and risk signaling. Nothing an agent needs before invoking it appears missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all four parameters are already documented, and the baseline is 3. The description reinforces the critical constraint that new_source must be the complete source (not a patch) and that it should be obtained by modifying lookup output, which adds modest meaning beyond the schema's own wording.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Edit an existing ABAP function module in SE37') and scopes it to existing modules, which separates it from creation flows and from the SE24/SE38 editor siblings. An agent can identify the target object and operation without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit preferred alternative ('If sap-adt is available, prefer its patch_source or set_source_from_file tools'), an explicit exclusion ('Only for EXISTING function modules. To create new ones, use abapGit'), and a concrete call sequence via sap_se37_lookup. Both when-to-use and when-not-to-use are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.