Skip to main content
Glama

Write ABAP Source

sap_write_source
Destructive

Replace existing ABAP source code for programs, classes, or function modules with full stateful locking and ETag conflict detection. Optionally activate the object after writing to apply changes immediately.

Instructions

Replace the source code of an EXISTING program, include, class, interface, or function module. This MODIFIES the SAP system.

The tool runs the full stateful flow: lock -> write source -> (optionally activate) -> unlock. It captures the current ETag to avoid overwriting concurrent changes.

Args:

  • object_type ('program'|'include'|'class'|'interface'|'function').

  • object_name (string): must already exist (this tool does not create objects).

  • function_group (string): required for functions.

  • source (string): the complete replacement source.

  • transport (string): required for non-local objects; get one from sap_list_transports.

  • activate (boolean, default false): activate after writing.

  • response_format ('markdown' | 'json').

Returns (json): { objectType, objectName, sourceUri, bytesWritten, transport?, activated, activationMessages: [{type,text}], message }.

Examples:

  • "Update class CL_FOO and activate" -> object_type='class', object_name='CL_FOO', source='...', transport='DEVK900123', activate=true. Error Handling:

  • 423 -> object locked by someone else. 412 -> ETag changed (re-read first).

  • Missing transport on a transportable object -> returns an actionable error; the lock is released automatically.

  • Activation errors are returned in activationMessages (the source is still written but inactive).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesThe full new source code to write (replaces existing source).
activateNoIf true, activate the object after writing. If false, it stays inactive.
transportNoTransport request (e.g. 'DEVK900123'). Required for transportable (non-local) objects.
object_nameYesObject name. The object must already exist.
object_typeYesObject kind to write.
function_groupNoRequired when object_type='function'.
response_formatNoOutput format: 'markdown' (human-readable, default) or 'json' (structured).markdown
Install Server

TDQS

A4.5/5.0
Behavior5/5

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

The description adds substantial behavior beyond the destructiveHint annotation: it reveals the full stateful lock-write-activate-unlock flow, ETag-based concurrency protection, automatic lock release on errors, and that activation errors leave the source written but inactive. No contradiction with annotations.

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?

The description is long but every section earns its place: args, return shape, example, and error handling. It is well-structured with headers and bullets, making the dense information easy for an agent to scan and act on.

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?

Given the tool's complexity, 7 parameters, no output schema, and destructive behavior, the description is remarkably complete. It covers the write flow, concurrency, transports, activation behavior, error codes, return fields, and a concrete example, leaving little for an agent to guess.

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 description coverage is 100%, so the input schema already documents every parameter. The description's Args list mostly restates schema information, though it does add practical context like 'required for functions' and 'required for non-local objects.' That is useful but not a major semantic addition beyond the schema.

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?

The description states a specific verb and resource: 'Replace the source code of an EXISTING program, include, class, interface, or function module.' It also explicitly says the tool does not create objects, which distinguishes it clearly from sap_create_object and other siblings.

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

Usage Guidelines4/5

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

The description gives clear context for when to use the tool, including the requirement that the object already exist and that a transport is needed for non-local objects, with direction to sap_list_transports. It does not enumerate all alternatives, but the 'does not create objects' note and transport guidance are strong practical cues.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/appmaster3000/sap-abap-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server