RuntimeRunClassWithProfiling
Execute an ABAP class with the profiler enabled to capture performance data, returning a unique profiler ID and trace ID for analysis.
Instructions
[runtime] Execute ABAP class with profiler enabled and return created profilerId + traceId.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_name | Yes | ABAP class name to execute. | |
| description | No | Profiler trace description. | |
| all_procedural_units | No | ||
| all_misc_abap_statements | No | ||
| all_internal_table_events | No | ||
| all_dynpro_events | No | ||
| aggregate | No | ||
| explicit_on_off | No | ||
| with_rfc_tracing | No | ||
| all_system_kernel_events | No | ||
| sql_trace | No | ||
| all_db_events | No | ||
| max_size_for_trace_file | No | ||
| amdp_trace | No | ||
| max_time_for_tracing | No |
Implementation Reference
- Main handler function that executes ABAP class with profiling. Uses AdtExecutor to run the class with profiler parameters and returns profilerId + traceId.
export async function handleRuntimeRunClassWithProfiling( context: HandlerContext, args: RuntimeRunClassWithProfilingArgs, ) { const { connection, logger } = context; try { if (!args?.class_name) { throw new Error('Parameter "class_name" is required'); } const className = args.class_name.trim().toUpperCase(); const executor = new AdtExecutor(connection, logger); const classExecutor = executor.getClassExecutor(); const result = await classExecutor.runWithProfiling( { className }, { profilerParameters: { description: args.description, allProceduralUnits: args.all_procedural_units, allMiscAbapStatements: args.all_misc_abap_statements, allInternalTableEvents: args.all_internal_table_events, allDynproEvents: args.all_dynpro_events, aggregate: args.aggregate, explicitOnOff: args.explicit_on_off, withRfcTracing: args.with_rfc_tracing, allSystemKernelEvents: args.all_system_kernel_events, sqlTrace: args.sql_trace, allDbEvents: args.all_db_events, maxSizeForTraceFile: args.max_size_for_trace_file, amdpTrace: args.amdp_trace, maxTimeForTracing: args.max_time_for_tracing, }, }, ); return return_response({ data: JSON.stringify( { success: true, class_name: className, profiler_id: result.profilerId, trace_id: result.traceId, run_status: result.response?.status, trace_requests_status: result.traceRequestsResponse?.status, }, null, 2, ), status: result.response?.status, statusText: result.response?.statusText, headers: result.response?.headers, config: result.response?.config, }); } catch (error: any) { logger?.error('Error running class with profiling:', error); return return_error(error); } } - Tool definition and input schema for RuntimeRunClassWithProfiling. Defines name, description, available_in, and inputSchema with all profiler-related parameters.
export const TOOL_DEFINITION = { name: 'RuntimeRunClassWithProfiling', available_in: ['onprem', 'cloud'] as const, description: '[runtime] Execute ABAP class with profiler enabled and return created profilerId + traceId.', inputSchema: { type: 'object', properties: { class_name: { type: 'string', description: 'ABAP class name to execute.', }, description: { type: 'string', description: 'Profiler trace description.', }, all_procedural_units: { type: 'boolean' }, all_misc_abap_statements: { type: 'boolean' }, all_internal_table_events: { type: 'boolean' }, all_dynpro_events: { type: 'boolean' }, aggregate: { type: 'boolean' }, explicit_on_off: { type: 'boolean' }, with_rfc_tracing: { type: 'boolean' }, all_system_kernel_events: { type: 'boolean' }, sql_trace: { type: 'boolean' }, all_db_events: { type: 'boolean' }, max_size_for_trace_file: { type: 'number' }, amdp_trace: { type: 'boolean' }, max_time_for_tracing: { type: 'number' }, }, required: ['class_name'], }, } as const; - src/lib/handlers/groups/SystemHandlersGroup.ts:101-104 (registration)Import of handleRuntimeRunClassWithProfiling and its TOOL_DEFINITION into SystemHandlersGroup.
import { handleRuntimeRunClassWithProfiling, TOOL_DEFINITION as RuntimeRunClassWithProfiling_Tool, } from '../../../handlers/system/readonly/handleRuntimeRunClassWithProfiling'; - src/lib/handlers/groups/SystemHandlersGroup.ts:150-154 (registration)Registration of RuntimeRunClassWithProfiling tool in SystemHandlersGroup's getHandlers() method, mapping toolDefinition to handler.
{ toolDefinition: RuntimeRunClassWithProfiling_Tool, handler: (args: any) => handleRuntimeRunClassWithProfiling(this.context, args), }, - Higher-level HandlerProfileRun tool that delegates to handleRuntimeRunClassWithProfiling when target_type is CLASS.
export async function handleHandlerProfileRun( context: HandlerContext, args: HandlerProfileRunArgs, ) { if (args.target_type === 'CLASS') { if (!args.class_name) { throw new Error('class_name is required when target_type is CLASS'); } return handleRuntimeRunClassWithProfiling(context, { class_name: args.class_name, description: args.description, all_procedural_units: args.all_procedural_units, all_misc_abap_statements: args.all_misc_abap_statements, all_internal_table_events: args.all_internal_table_events, all_dynpro_events: args.all_dynpro_events, aggregate: args.aggregate, explicit_on_off: args.explicit_on_off, with_rfc_tracing: args.with_rfc_tracing, all_system_kernel_events: args.all_system_kernel_events, sql_trace: args.sql_trace, all_db_events: args.all_db_events, max_size_for_trace_file: args.max_size_for_trace_file, amdp_trace: args.amdp_trace, max_time_for_tracing: args.max_time_for_tracing, }); } if (!args.program_name) { throw new Error('program_name is required when target_type is PROGRAM'); } return handleRuntimeRunProgramWithProfiling(context, { program_name: args.program_name, description: args.description, all_procedural_units: args.all_procedural_units, all_misc_abap_statements: args.all_misc_abap_statements, all_internal_table_events: args.all_internal_table_events, all_dynpro_events: args.all_dynpro_events, aggregate: args.aggregate, explicit_on_off: args.explicit_on_off, with_rfc_tracing: args.with_rfc_tracing, all_system_kernel_events: args.all_system_kernel_events, sql_trace: args.sql_trace, all_db_events: args.all_db_events, max_size_for_trace_file: args.max_size_for_trace_file, amdp_trace: args.amdp_trace, max_time_for_tracing: args.max_time_for_tracing, }); }