Run ABAP Report
sap_run_reportRun an ABAP report on the SAP system and retrieve its list output as text. Confirm standard or namespaced programs to execute them with real side effects.
Instructions
EXECUTES an ABAP report (program) on the SAP system and returns its list output as text. This runs real code with real side effects — the report may post documents, change configuration, lock objects or run for minutes. It is not a preview and there is no dry run.
The report runs synchronously (SUBMIT ... EXPORTING LIST TO MEMORY AND RETURN) inside the HTTP work process, so the output comes back in the same call, typically in under a second for a small report.
Args:
program_name (string): the report to run.
confirm_non_custom (boolean): must be true for any program not starting with Z or Y. Namespaced programs (/ABC/...) count as non-custom and need it too.
strip_list_header (boolean, default true): remove the ABAP list header lines.
max_chars (number): cap on returned characters (default 20000, max 60000).
response_format.
Returns (json): { programName, exists, authorized, ok, output, rawOutput, lineCount, bytes, durationMs, truncated, message }. ok=false means the run did not happen or produced no usable result — ALWAYS read ok, never assume success.
Examples:
"Run my report ZFI_CHECK and show the output" -> program_name='ZFI_CHECK'.
"Run the standard report RSUSR002" -> program_name='RSUSR002', confirm_non_custom=true (and be sure that is wanted). SELECTION-SCREEN PARAMETERS CANNOT BE PASSED:
The SAP endpoint's SUBMIT has no WITH clause, so a report with a selection screen runs on its DEFAULT values, silently. No client can work around this. If a report needs input, give its parameters DEFAULT values, generate a variant-free wrapper report, or use sap_job_schedule. Clean output via RESULT_TEXT (the reason to prefer this over scraping a list):
The handler ends with IMPORT result_text FROM MEMORY ID 'RESULT_TEXT'. A report that does EXPORT result_text = lv_string TO MEMORY ID 'RESULT_TEXT'. gets that exact string back — no list header, no 255-byte padding, no CRLF records. For a report you generate, emit JSON that way and read it back verbatim.
Use one channel or the other. A report that both WRITEs and exports gets the result string appended after the list, and the handler never clears RESULT_TEXT — a value left by an earlier run can reappear, so do not treat its presence as proof this run produced it. Notes:
HTTP 200 does not mean success: SAP answers "program does not exist" and authorization refusals with 200 and a plain sentence. This tool classifies the body and reports exists/authorized/ok accordingly, keeping the untouched body in rawOutput.
Empty output is a legitimate result for a report that WRITEs nothing, and is also what a report that terminates early looks like — the endpoint cannot tell them apart.
Only classic list output (WRITE) is captured. ALV grids and screens have no GUI to render into and are not tested on this system.
The only server-side gate is S_DEVELOP (OBJTYPE=PROG, ACTVT=16), which a developer passes for EVERY program including SAP standard. The Z/Y namespace rule enforced here is the real safety boundary.
A timeout does not cancel the report — it keeps running server-side. For long-running work use sap_job_schedule, which runs in the background and returns a job id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_chars | No | Cap on returned output characters (default 20000). | |
| program_name | Yes | Report/program name (e.g. 'ZFI_FSV_RECREATE'). Case-insensitive. | |
| response_format | No | Output format: 'markdown' (human-readable, default) or 'json' (structured). | markdown |
| strip_list_header | No | Drop the standard ABAP list header (date / title / page number and the dashed rule) from the output. | |
| confirm_non_custom | No | Required true to run a program outside the Z*/Y* namespace (SAP standard reports and namespaced /ABC/ programs). Running standard reports can post documents, change configuration or run for a long time; the server refuses without this flag. |