Skip to main content
Glama

DeleteBehaviorImplementation

Delete an ABAP behavior implementation from the SAP system with a pre-deletion check. Supports optional transport request for local objects.

Instructions

Delete an ABAP behavior implementation from the SAP system. Includes deletion check before actual deletion. Transport request optional for $TMP objects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
behavior_implementation_nameYesBehaviorImplementation name (e.g., Z_MY_BEHAVIORIMPLEMENTATION).
transport_requestNoTransport request number (e.g., E19K905635). Required for transportable objects. Optional for local objects ($TMP).

Implementation Reference

  • Main handler function handleDeleteBehaviorImplementation - uses AdtClient.getBehaviorImplementation().delete() to delete an ABAP behavior implementation. Includes validation, deletion check, error handling with status codes (404, 423, 400), and SAP XML error parsing.
    export async function handleDeleteBehaviorImplementation(
      context: HandlerContext,
      args: DeleteBehaviorImplementationArgs,
    ) {
      const { connection, logger } = context;
      try {
        const { behavior_implementation_name, transport_request } =
          args as DeleteBehaviorImplementationArgs;
    
        // Validation
        if (!behavior_implementation_name) {
          return return_error(
            new Error('behavior_implementation_name is required'),
          );
        }
    
        const client = createAdtClient(connection, logger);
        const behaviorImplementationName =
          behavior_implementation_name.toUpperCase();
    
        logger?.info(
          `Starting behavior implementation deletion: ${behaviorImplementationName}`,
        );
    
        try {
          // Delete behavior implementation using AdtClient (includes deletion check)
          const behaviorImplementationObject = client.getBehaviorImplementation();
          const deleteResult = await behaviorImplementationObject.delete({
            className: behaviorImplementationName,
            transportRequest: transport_request,
          });
    
          if (!deleteResult || !deleteResult.deleteResult) {
            throw new Error(
              `Delete did not return a response for behavior implementation ${behaviorImplementationName}`,
            );
          }
    
          logger?.info(
            `✅ DeleteBehaviorImplementation completed successfully: ${behaviorImplementationName}`,
          );
    
          return return_response({
            data: JSON.stringify(
              {
                success: true,
                behavior_implementation_name: behaviorImplementationName,
                transport_request: transport_request || null,
                message: `BehaviorImplementation ${behaviorImplementationName} deleted successfully.`,
              },
              null,
              2,
            ),
          } as AxiosResponse);
        } catch (error: any) {
          logger?.error(
            `Error deleting behavior implementation ${behaviorImplementationName}: ${error?.message || error}`,
          );
    
          // Parse error message
          let errorMessage = `Failed to delete behavior implementation: ${error.message || String(error)}`;
    
          if (error.response?.status === 404) {
            errorMessage = `BehaviorImplementation ${behaviorImplementationName} not found. It may already be deleted.`;
          } else if (error.response?.status === 423) {
            errorMessage = `BehaviorImplementation ${behaviorImplementationName} is locked by another user. Cannot delete.`;
          } else if (error.response?.status === 400) {
            errorMessage = `Bad request. Check if transport request is required and valid.`;
          } else if (
            error.response?.data &&
            typeof error.response.data === 'string'
          ) {
            try {
              const { XMLParser } = require('fast-xml-parser');
              const parser = new XMLParser({
                ignoreAttributes: false,
                attributeNamePrefix: '@_',
              });
              const errorData = parser.parse(error.response.data);
              const errorMsg =
                errorData['exc:exception']?.message?.['#text'] ||
                errorData['exc:exception']?.message;
              if (errorMsg) {
                errorMessage = `SAP Error: ${errorMsg}`;
              }
            } catch (_parseError) {
              // Ignore parse errors
            }
          }
    
          return return_error(new Error(errorMessage));
        }
      } catch (error: any) {
        return return_error(error);
      }
    }
  • TOOL_DEFINITION export - schema for the DeleteBehaviorImplementation tool: name, availability (onprem/cloud), description, inputSchema requiring 'behavior_implementation_name' with optional 'transport_request'.
    export const TOOL_DEFINITION = {
      name: 'DeleteBehaviorImplementation',
      available_in: ['onprem', 'cloud'] as const,
      description:
        'Delete an ABAP behavior implementation from the SAP system. Includes deletion check before actual deletion. Transport request optional for $TMP objects.',
      inputSchema: {
        type: 'object',
        properties: {
          behavior_implementation_name: {
            type: 'string',
            description:
              'BehaviorImplementation name (e.g., Z_MY_BEHAVIORIMPLEMENTATION).',
          },
          transport_request: {
            type: 'string',
            description:
              'Transport request number (e.g., E19K905635). Required for transportable objects. Optional for local objects ($TMP).',
          },
        },
        required: ['behavior_implementation_name'],
      },
    } as const;
  • Tool registration in HighLevelHandlersGroup - maps DeleteBehaviorImplementation_Tool to handleDeleteBehaviorImplementation handler with context wrapping.
    {
      toolDefinition: DeleteBehaviorImplementation_Tool,
      handler: withContext(handleDeleteBehaviorImplementation),
  • Compact router registration for BEHAVIOR_IMPLEMENTATION object type with delete operation mapped to handleDeleteBehaviorImplementation.
    BEHAVIOR_IMPLEMENTATION: {
      create: handleCreateBehaviorImplementation as unknown as CompactHandler,
      get: handleGetBehaviorImplementation as unknown as CompactHandler,
      update: handleUpdateBehaviorImplementation as unknown as CompactHandler,
      delete: handleDeleteBehaviorImplementation as unknown as CompactHandler,
    },
  • DeleteBehaviorImplementationArgs TypeScript interface defining the input parameters: behavior_implementation_name (required) and transport_request (optional).
    interface DeleteBehaviorImplementationArgs {
      behavior_implementation_name: string;
      transport_request?: string;
    }
Behavior3/5

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

Without annotations, the description carries the full burden. It discloses a deletion check before actual deletion and transport request handling, adding useful behavioral context. However, it does not mention irreversibility or dependencies, which would improve transparency.

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 two sentences, concise and front-loaded. Every sentence adds value: the first states the action, the second adds behavioral and parameter context. No wasted words.

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

Completeness4/5

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

For a simple delete operation, the description covers the key behaviors (deletion check, transport handling). It could mention the destructive nature more explicitly, but it is adequate given the tool's simplicity.

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 the description adds no new meaning beyond what is already in the parameter descriptions. The note about transport requests is redundant with the schema.

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

Purpose4/5

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

The description explicitly states the verb 'Delete' and the resource 'ABAP behavior implementation', making the tool's purpose clear. However, it does not differentiate from sibling delete tools like DeleteBehaviorDefinition, so it does not achieve the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool over other delete tools. The only usage note is about transport requests for $TMP objects, which is more of a parameter detail than a selection criterion.

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

Install Server

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/fr0ster/mcp-abap-adt'

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