Skip to content
Development
Skill

/sap-fix-abap

Fixes ABAP source code issues found by sap-check-abap (all dimensions). Reads the check result file(s), builds a fix plan, and applies fixes: - NAMING violations: renames variables throughout the file - UNUSED variables: comments out declarations - SYNTAX-SAFE rewrites

From plugin
sap-dev
8123 skills3 agents
Install
$ npx -y skills add sapdev-ai/sap-dev --skill sap-fix-abap --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/sap-fix-abap

Context preview

The summary Claude sees to decide when to auto-load this skill.

Fixes ABAP source code issues found by sap-check-abap (all dimensions). Reads the check result file(s), builds a fix plan, and applies fixes: - NAMING violations: renames variables throughout the file - UNUSED variables: comments out declarations - SYNTAX-SAFE rewrites

SKILL.md

sap-fix-abap.SKILL.md
name: sap-fix-abap
description: |
  Fixes ABAP source code issues found by sap-check-abap (all dimensions).
  Reads the check result file(s), builds a fix plan, and applies fixes:
  - NAMING violations: renames variables throughout the file
  - UNUSED variables: comments out declarations
  - SYNTAX-SAFE rewrites (SQL_STRICT_COMMA / line-length / DECL_ORDER)
  - CALL FUNCTION param fixes (UNKNOWN_PARAM rename / MISSING_MANDATORY stub /
    WRONG_SECTION move) from the `fm` dimension — absorbed from the former sap-fix-fm
  - SYNTAX errors: a bounded AI-assisted check->patch->re-check loop that drives the
    headless `sap_rfc_syntax_check.ps1` engine (no blind auto-fix)
  - TYPE_NOT_FOUND and other semantic codes: flagged for manual review
  Creates a timestamped backup (.bak) before modifying the source file.
  Prerequisites: Run sap-check-abap first to produce the result file(s). The `fm`
  and `syntax` fix paths need SAP NCo 3.1 (32-bit) + the dev-init wrapper.
argument-hint: "<path-to-abap-source-file> [<path-to-check-result-tsv>] [--syntax-loop]"

SAP Fix ABAP Skill

You fix ABAP source code quality issues detected by sap-check-abap. You rename variables that violate naming conventions, comment out unused declarations, and flag type issues for manual review. You always back up the file before making changes.

Task: $ARGUMENTS

---

Shared Resources

| File | Purpose | |---|---| | `<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md` | Mandatory operating rules | | `<SAP_DEV_CORE_SHARED_DIR>/rules/language_independence_rules.md` | GUI-scripting language independence — offline fixer, but rule applies to downstream deploy skills the fixed source feeds | | `<SAP_DEV_CORE_SHARED_DIR>/rules/abap_code_quality_rules.md` | ABAP code-quality rules — fixes applied here (variable renames, unused-comment-out) must preserve / restore modern-ABAP conventions; never introduce literal MESSAGE strings or downgrade syntax to obsolete forms while fixing |

---

Step 0 — Resolve Work Directory

**Resolve `work_dir` via the env-aware helper** — do NOT take `work_dir` from a direct `settings.json` read (that ignores the `SAPDEV_AI_WORK_DIR` env var and `userconfig.json`). Use the `WORK_DIR=` value printed by:

powershell -NoProfile -ExecutionPolicy Bypass -Command ". '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_settings_lib.ps1'; . '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'; Write-Output ('WORK_DIR=' + (Get-SapWorkDir))"

The settings note below still applies to the OTHER keys.

**Settings reads/writes follow `<SAP_DEV_CORE_SHARED_DIR>/rules/settings_lookup.md`** — merge per-key on the `.value` field (env var → `settings.local.json` → `userconfig.json` → `settings.json`); non-per-connection writes go to `userconfig.json`. Resolve cross-plugin paths: 3 levels up from `<SKILL_DIR>`, then into `sap-dev-core\settings.json` and (if present) `sap-dev-core\settings.local.json`. Set `{WORK_TEMP}` = `{work_dir}\temp` and ensure it exists:

cmd /c if not exist "{WORK_TEMP}" mkdir "{WORK_TEMP}"

Set `{RUN_TEMP}` = the per-run scratch dir (`Get-SapRunTemp` mints + creates `{work_dir}\temp\run_<id>`):

powershell -NoProfile -ExecutionPolicy Bypass -Command ". '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'; Write-Output ('RUN_TEMP=' + (Get-SapRunTemp))"

Per the CLAUDE.md "Two-bucket temp model" write this skill's `_run.json` state under `{RUN_TEMP}`; keep `{WORK_TEMP}` (base) only for `Get-SapCurrentSessionPath -WorkTemp`.

---

Step 0.5 — Start Logging

Start a structured log run. State file: `{RUN_TEMP}\sap_fix_abap_run.json`. Best-effort.

powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_fix_abap_run.json" -Skill sap-fix-abap -ParamsJson "{\"abap_file\":\"<ABAP_FILE>\",\"result_tsv\":\"<TSV>\"}"

---

Step 1 — Parse Arguments

Extract from `$ARGUMENTS`:

  • **ABAP source file path** — required. Ask if not provided.
  • **Check result TSV path** — optional; default is `<abap-file>.check.tsv`.

Also look for the sibling result files the other `sap-check-abap` dimensions write (fix whichever are present):

  • `<abap-file>.check_fm.tsv` — `fm`-dimension findings (CALL FUNCTION params) → Step 6b.
  • `<abap-file>.syntax.tsv` — `syntax`-dimension findings → the Step 8 syntax loop.

Verify both files exist:

powershell -Command "if (Test-Path 'ABAP_FILE') { 'OK' } else { 'NOT FOUND' }"
powershell -Command "if (Test-Path 'RESULT_FILE') { 'OK' } else { 'NOT FOUND' }"

If either file does not exist, tell the user and stop.

---

Step 2 — Read and Parse the Result TSV

Read the result TSV file. The file begins with a header section:

STATUS:	SUCCESS_WITH_ISSUES: N declaration(s), M issue(s).
ABAP_FILE	<path>
NAMING_RULES	<path>
TIMESTAMP	<datetime>
TOTAL_DECLARATIONS	N
TOTAL_ISSUES	M

Followed by a blank line, column headers, and tab-delimited finding rows:

CHECK_TYPE	SEVERITY	LINE	VARIABLE	SCOPE	DATA_KIND	DETAIL	FIX_ADVICE

Parse all findings into a list. Classify each by fixability. The table covers EVERY code `/sap-check-abap` can emit (VBS engine, Step 1.5 object naming, and the Step 3.5 / 3.6 / 3.7 sidecar validators). **Auto** is reserved for transforms that cannot change runtime semantics; any code whose fix could — even when a mechanical rewrite looks tempting — is **Manual** with guidance.

| CHECK_TYPE | Fixable? | Action | |---|---|---| | `NAMING` | Auto | Rename variable throughout file (case-insensitive, word-boundary aware) | | `UNUSED` | Auto | Comment out declaration line (skip chain declarations) | | `SQL_STRICT_COMMA` | Auto | Insert the missing commas between SELECT-list fields (`SELECT a b c` → `SELECT a, b, c`) — pure syntax; SAP rejects the statement without them (§9) | | `LINE_TOO_LONG` / `LINE_HARD_LIMIT` | Auto | Wrap the statement at a token boundary onto a continuation line. **Manual** when the over

Read more
Ships withsap-dev

SAP development automation skills for AI coding assistants. Windows-only — the skills drive SAP GUI for Windows via GUI Scripting (plus optional RFC via SAP NCo); there is no macOS/Linux path.

Get the whole plugin

Other skills on sap-dev.