runSnippet
Execute ABAP code on the SAP system to test function modules, class methods, or calculations, and return the printed output.
Instructions
Run a piece of ABAP on the system and return what it printed. The snippet is wrapped in a throwaway class implementing IF_OO_ADT_CLASSRUN, created in $TMP, activated, executed with runClass and deleted again - which is the only way ADT executes ABAP at all. Write output with out->write( lv_x ) or out->write_text( ... ); out is the console object the interface hands to main. It answers the questions no read can: what a function module returns for these inputs, what a class method does with this data, what a calculation comes to. It runs code on the target system as your user, so a snippet that writes changes data - it counts as a writing tool and is refused in read-only mode. On a syntax error the activation messages come back with the source, and the class is removed either way.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The ABAP to run, line by line, as it would stand inside a method. `out` is available for output. | |
| dryRun | No | Return the class source that would be created, without touching the system. | |
| className | No | Name for the throwaway class. Default: ZMCP_SNIP_<timestamp in base 36>. | |
| keepClass | No | Leave the class on the system instead of deleting it - for a snippet to run again or open in ADT. Default false. | |
| transport | No | Transport request, needed only outside $TMP. | |
| packageName | No | Where to create it. Default $TMP, which needs no transport; anything else does. | |
| declarations | No | Class-level declarations the snippet needs: TYPES, CONSTANTS, DATA. They go into the private section. |