Skip to content

Code Editing

stud0709 edited this page May 22, 2026 · 3 revisions

Code Editing Tools

This set of tools enables the agent to effectively edit and syntax-check ABAP sources. The editing workflow:

  • Fetch the file from SAP
  • Edit and check syntax in a local file
  • With write permission: push, activate. Without write permission: the user is responsible for pushing the source to SAP
  • Currently, the agent cannot create new repository objects from scratch. It can only modify the source code or XML payload of existing artifacts. You must first manually create an empty shell in the SAP backend before the agent can implement or adjust it. Supported objects include standard ABAP textual objects (e.g., Classes, Interfaces, Executable Programs, Function Modules) as well as XML-based repository objects (e.g., Data Elements, Domains, Tables, Structures).
  • Every code push is recorded in the internal version control system.

Version Control

  • You can diff the versions and restore them to SAP system whenever needed.

Diff

Available MCP Tools

Tool Name Description
sap_activate_object Activates an inactive ABAP object (draft) in the SAP backend.
- Output: Automatically returns ABAP syntax errors via the chkl:messages payload if activation fails.
- Schema: Uses standard object_name and object_type (or object_uri) for URI resolution.
sap_ast_query Surgically locate structural node coordinates (Method, Form, Variable) using offline AST. Optionally provide object_uri to dynamically extract structural code segments remotely without loading massive payloads locally.
sap_ast_replace Structurally mutates the AST by cleanly replacing or deleting specific node constructs without regex strings.
sap_check_syntax Runs a native ADT syntax check matching Eclipse engine logic to validate ABAP code without saving.
sap_diff_versions Compares two source versions of an SAP object and returns a unified diff.
- Semantic Targets: "draft" (local file), "active" (live SAP active), "inactive" (live SAP inactive).
- Relative SQLite Targets: "-1" (latest local baseline), "-2" (version before that).
- Absolute SQLite Targets: "1", "2" (specific version numbers).
Defaults: from_version="draft", to_version="active".
sap_fetch_inactive_objects Fetches the list of all inactive objects currently held by the authenticated user from the SAP backend.
sap_push_source Pushes local ABAP source code to the SAP backend as an inactive version.
- Auto-Unlocks: The object lock is automatically released upon success. Do not call sap_unlock_source.
- Errors: Fails with TRANSPORT_REQUIRED if a task number is missing.
- Orchestration: Consult .agents/skills/sap-dev/references/SOURCE_PUSH_GUIDE.md for complex ETag collision recovery and ATC queue arrays.
sap_scaffold_interface Orchestrates native AST-driven generation of a formatted implementation skeleton for any SAP Interface. Pings ADT's JSON logic engine offline. Provide the system_id, the source interface, and your destination definition.
sap_simulate_snippet Accepts a raw, un-wrapped block of ABAP code, dynamically injects it into Z_AGENT_SANDBOX, and executes ADT syntax validation cleanly.
sap_syntax_quick_fix Evaluates native SAP Syntax Quick Fixes for an offending source block.
- Evaluation: Pass object_uri, code, and finding_uri to evaluate available fixes.
- Extraction: Pass fix_index to retrieve the suggested replacement code snippet without mutating the backend.

Clone this wiki locally