Fix ABAP automatically (deterministic)
fix_abapCorrect ABAP code by applying abaplint's verified, machine-applicable fixes, returning parser-guaranteed modern syntax while leaving unfixable issues for review.
Instructions
Apply abaplint's own machine-applicable corrections to ABAP sources and return the corrected code: keyword casing, obsolete statements with defined modern replacements (MOVE → =, and every other rule that ships a concrete edit), applied in verified batches — after each batch the result is re-parsed, and a batch that would break the parse is discarded, so the output is parser-guaranteed, never guessed. Findings WITHOUT a machine fix come back in remaining — those need judgment (yours or an agent's, proven afterwards with compare_abap). Use this when someone highlights code and wants it corrected to best practices / modern syntax instantly, as the mechanical first pass before any AI rewriting, or to modernize a file before review. It does not invent rewrites (only fixes abaplint defines), does not resolve cloud blockers that need re-architecture (dynpro, WRITE output — see plan_cloud_migration), and is not a formatter (format_abap pretty-prints without changing statements). Example: fix_abap({ "files": [ { "source": "report zdemo.\ndata lv_x type i.\nmove 5 to lv_x." } ] }).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Source files to analyze, up to 32 per call, 100k chars each. | |
| rules | No | abaplint rule overrides merged onto the preset, e.g. { "keyword_case": { "style": "lower" } } — fixes follow your org's pack, same as lint_abap. | |
| preset | No | Which ruleset supplies the fixes: "style" (default) fits isolated snippets; "full" expects all referenced objects provided; "syntax-only" yields no style fixes. | style |
| abapVersion | No | ABAP language version to parse and fix against ("Cloud" for ABAP Cloud code). | v758 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| fixed | Yes | What was fixed (capped at 200 entries; fixedCount carries the total). | |
| remaining | Yes | Findings with no machine fix — judgment work; rework them and verify with compare_abap. | |
| fixedCount | Yes | Total machine fixes applied. | |
| iterations | Yes | Fix batches applied (each batch re-parses before the next). | |
| stoppedEarly | No | Present when the safety valve discarded a batch or the batch cap was reached. |