Run ABAP (ADT Console)
sap_run_consoleExecute ABAP snippets directly on the SAP server via ADT class-run, with no RFC SDK needed. Call any function module or BAPI and return results using out->write().
Instructions
Execute an ABAP snippet server-side via the ADT class-run endpoint — no RFC SDK required. The snippet becomes the body of IF_OO_ADT_CLASSRUN~MAIN in a reusable local ($TMP) runner class, so it can CALL FUNCTION any function module / BAPI and print results with out->write( ). This is the SDK-free substitute for the sap_rfc_* tools.
Args:
abap_code (string): ABAP for the method body. 'out->write( v )' returns data; 'out' is ref to if_oo_adt_classrun_out.
class_name (string): runner class (default 'ZMCP_CONSOLE', $TMP local).
response_format.
Returns (json): { className, activated, output, message }.
Examples:
Call a function module: CALL FUNCTION 'RFC_SYSTEM_INFO' IMPORTING rfcsi_export = DATA(ls). out->write( ls-rfcsaprl ).
Quick value: out->write( |Client { sy-mandt }, user { sy-uname }| ). Notes:
Requires S_DEVELOP (creates/activates a temp class). Dev/sandbox only — not production.
For data-changing BAPIs, add CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' in the same snippet.
Prefer sap_read_table / sap_sql_query for plain data reads.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abap_code | Yes | ABAP statements for the method body. Use 'out->write( value )' to return data ('out' is ref to if_oo_adt_classrun_out). Can CALL FUNCTION any FM/BAPI. | |
| class_name | No | Runner class name (default 'ZMCP_CONSOLE', created local in $TMP). | |
| response_format | No | Output format: 'markdown' (human-readable, default) or 'json' (structured). | markdown |