addMethod
Add a method to an ABAP class, inserting declaration and implementation, locking, writing, and activating. Detects duplicates and supports dry-run diffs.
Instructions
Add a method to a class: the declaration goes into the visibility section, the implementation before the closing ENDCLASS, and the whole lock/write/unlock/activate sequence follows. The signature is passed as data and the ABAP is built here, in the indentation the class already uses. This is otherwise two patchObjectSource edits into two different parts of one source, with line numbers that both have to be right. A method that is already there is refused with the line it is on, rather than declared twice. Pass dryRun to see the diff without writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dryRun | No | Show the diff without locking or writing. | |
| static | No | CLASS-METHODS rather than METHODS. | |
| raising | No | Exception classes, e.g. ["cx_sy_zerodivide"]. | |
| activate | No | Activate afterwards (default true). | |
| changing | No | Parameters as data: [{name, type, optional?, default?}]. | |
| className | Yes | Class name, e.g. ZCL_APP. | |
| exporting | No | Parameters as data: [{name, type, optional?, default?}]. | |
| importing | No | Parameters as data: [{name, type, optional?, default?}]. | |
| returning | No | Returning parameter: {name, type}. Becomes RETURNING VALUE(name) TYPE type. | |
| transport | No | Transport request. The number of the REQUEST, not of a task inside it. | |
| methodName | Yes | Name of the new method. | |
| visibility | No | public, protected or private. Default public. | |
| declaration | No | Declaration text to use verbatim instead of building one from the parameters above. For a signature this cannot express. | |
| implementation | No | Body lines, without METHOD/ENDMETHOD. Omit and a TODO comment is left in their place. |