DeleteLocalTypes
Clears local type definitions from an ABAP class's implementation include. Manages object locking and optional activation.
Instructions
Delete local types from an ABAP class by clearing the implementations include. Manages lock, update, unlock, and optional activation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_name | Yes | Parent class name (e.g., ZCL_MY_CLASS). | |
| transport_request | No | Transport request number. | |
| activate_on_delete | No | Activate parent class after deleting. Default: false |
Implementation Reference
- The main handler function `handleDeleteLocalTypes` that executes the DeleteLocalTypes tool logic: creates ADT client, deletes local types via the client, optionally activates the class, and returns result.
export async function handleDeleteLocalTypes( context: HandlerContext, args: DeleteLocalTypesArgs, ) { const { connection, logger } = context; try { const { class_name, transport_request, activate_on_delete = false, } = args as DeleteLocalTypesArgs; if (!class_name) { return return_error(new Error('class_name is required')); } const client = createAdtClient(connection, logger); const className = class_name.toUpperCase(); logger?.info(`Deleting local types for ${className}`); try { const localTypes = client.getLocalTypes(); const deleteResult = await localTypes.delete({ className, transportRequest: transport_request, }); if (!deleteResult) { throw new Error(`Delete did not return a result for ${className}`); } if (activate_on_delete) { await client.getClass().activate({ className }); } logger?.info(`✅ DeleteLocalTypes completed successfully: ${className}`); return return_response({ data: JSON.stringify( { success: true, class_name: className, transport_request: transport_request || null, activated: activate_on_delete, message: `Local types deleted successfully from ${className}.`, }, null, 2, ), } as AxiosResponse); } catch (error: any) { logger?.error( `Error deleting local types for ${className}: ${error?.message || error}`, ); let errorMessage = `Failed to delete local types: ${error.message || String(error)}`; if (error.response?.status === 404) { errorMessage = `Local types for ${className} not found.`; } else if (error.response?.status === 423) { errorMessage = `Class ${className} is locked by another user.`; } return return_error(new Error(errorMessage)); } } catch (error: any) { return return_error(error); } } - TOOL_DEFINITION constant with the tool name 'DeleteLocalTypes', inputSchema (class_name required, transport_request optional, activate_on_delete optional with default false), and description.
export const TOOL_DEFINITION = { name: 'DeleteLocalTypes', available_in: ['onprem', 'cloud', 'legacy'] as const, description: 'Delete local types from an ABAP class by clearing the implementations include. Manages lock, update, unlock, and optional activation.', inputSchema: { type: 'object', properties: { class_name: { type: 'string', description: 'Parent class name (e.g., ZCL_MY_CLASS).', }, transport_request: { type: 'string', description: 'Transport request number.', }, activate_on_delete: { type: 'boolean', description: 'Activate parent class after deleting. Default: false', default: false, }, }, required: ['class_name'], }, } as const; - TypeScript interface `DeleteLocalTypesArgs` defining arguments for the handler.
interface DeleteLocalTypesArgs { class_name: string; transport_request?: string; activate_on_delete?: boolean; } - src/lib/handlers/groups/HighLevelHandlersGroup.ts:66-69 (registration)Import of TOOL_DEFINITION (aliased as DeleteLocalTypes_Tool) and handleDeleteLocalTypes from the handler file into HighLevelHandlersGroup.
import { TOOL_DEFINITION as DeleteLocalTypes_Tool, handleDeleteLocalTypes, } from '../../../handlers/class/high/handleDeleteLocalTypes'; - src/lib/handlers/groups/HighLevelHandlersGroup.ts:849-852 (registration)Registration of DeleteLocalTypes_Tool and its handler (with context) in the HighLevelHandlersGroup tool list.
{ toolDefinition: DeleteLocalTypes_Tool, handler: withContext(handleDeleteLocalTypes), },