Registry
Ccodemod avatar

codemod/abap-subroutine-pass-by-reference

Rewrite ABAP FORM subroutine signatures to remove VALUE(...) wrappers from USING and CHANGING parameters so they pass by reference.

codemod0 executions

  • abap
  • form
  • subroutine
  • pass-by-reference
  • transformation
Connect a repo
npx codemod @codemod/abap-subroutine-pass-by-reference

@codemod/abap-subroutine-pass-by-reference

Rewrite ABAP FORM subroutine signatures to remove explicit pass-by-value wrappers from USING and CHANGING parameters. The codemod converts VALUE(parameter) declarations into plain parameter names so subroutine parameters are passed by reference.

Installation

bash
# Install from registry
codemod run @codemod/abap-subroutine-pass-by-reference

# Or run locally
codemod run -w workflow.yaml

Usage

This codemod targets ABAP source files matching **/*.abap and rewrites FORM declarations like:

abap
FORM update_total USING VALUE(iv_amount) TYPE i
                  CHANGING VALUE(cv_total) TYPE i.

into:

abap
FORM update_total USING iv_amount TYPE i
                  CHANGING cv_total TYPE i.

Preserve behavior:

  • Only FORM definitions are rewritten.
  • VALUE(...) in comments is left unchanged.
  • PERFORM calls and non-FORM declarations are left unchanged.

Implementation note:

  • ABAP is not a parser-backed JSSG language here, so the transform uses a source-text rewrite scoped to FORM ... . statements.

Development

bash
# Test the transformation
pnpm test

# Typecheck the codemod
pnpm run check-types

# Validate the workflow
pnpm dlx codemod@latest workflow validate -w workflow.yaml

# Publish to registry
pnpm dlx codemod@latest login
pnpm dlx codemod@latest publish

License

MIT

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.