patch_function_module
Replaces part of an ABAP function module's source by swapping exact old text with new text, locking the function group and optionally activating changes; blocks production writes.
Instructions
Modify PART of an existing ABAP function module. Function-module source lives inside a function group, so it must be locked/written through the fmodules URI - patch_program_source CANNOT do it (SAP rejects locking LU as R3TR PROG). Reads the current source, replaces oldString with newString (must match EXACTLY ONCE), then locks, PUTs, optionally activates, and unlocks. Refuses to run on production profiles. Look up the group first if unsure: SELECT FUNCNAME, PNAME FROM TFDIR - PNAME 'SAPLZFOO' means group 'ZFOO'.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"functionGroup": "<functionGroup>",
"functionModule": "<functionModule>",
"oldString": "<oldString>",
"newString": "<newString>"
},
"name": "patch_function_module"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activate | No | Activate after writing. Default false - activate in SE37 yourself. | |
| newString | Yes | Replacement text | |
| oldString | Yes | Exact existing text to replace. Must occur exactly once - include enough context to be unique. | |
| transport | No | Transport request, e.g. D01K903896. Omit only for local/$TMP objects. | |
| functionGroup | Yes | Function group WITHOUT the SAPL prefix, e.g. ZABLMM_QCF_WF | |
| functionModule | Yes | Function module name, e.g. ZABLMM_QCF_WF_APPROVE |