/sap-abap:cds-rewritefrom sap-abap
Rewrite the data logic of an ABAP report, class or function module into CDS view entities, with tests that prove the output is unchanged and a runtime comparison before and after. Use when a Z program reads data with SELECTs inside loops, FOR ALL ENTRIES, nested SELECTs, or builds joins, filters and totals in ABAP; when someone asks to "move this to CDS", "code pushdown", "make this report faster on HANA", "modernize this report", "replace these SELECTs with a view", or prepares a report for Fiori, RAP or an OData API. Not for update logic (INSERT/UPDATE/MODIFY), not for pure UI changes, not for objects outside the customer namespace.
Ships in sap-abap. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Move data access out of ABAP and into CDS view entities, so HANA does the joins, filters and totals where the data lives. Behaviour must not change. Every rewrite ships with tests that prove it, and with runtime numbers that justify it.
Worth it:
Leave it in ABAP:
If the measured runtime doesn't improve and the code doesn't get simpler, stop and report that. No gain, no rewrite.
Find out which of the three setups the team has before step 1, and say which one you are using.
1. Inventory. Read the object and everything it includes. List every data access in a table: line, statement, tables, WHERE fields, what ABAP does with the result afterwards (loop join, filter, total, lookup). Add the where-used of the object. With an ABAP MCP server, read live source and DDIC; without one, work on the abapGit export and ask for missing DDIC definitions.
2. Pin down today's behaviour. Before touching anything, write ABAP Unit tests that capture
the current output on representative test data, using CL_OSQL_TEST_ENVIRONMENT to replace the
database tables. Include edge cases: empty input table (the FOR ALL ENTRIES trap), duplicates,
missing master data, authorization-restricted rows. Run them. They must pass on the old code.
3. Design, then STOP for approval. Propose:
define view entity objects: data sources, joins vs associations, WHERE, GROUP BY,
calculated fields, parameters for selection-screen inputsZI_ interface/basic views, ZC_ consumption views; follow the
team's CLAUDE.md if it says otherwise)define role) that replaces AUTHORITY-CHECKs where the check is row-level
and maps cleanly; keep the ABAP check where it doesn'tDo not write code until a person approves this design.
4. Build. Create the view entity and access control, activate them, then change the program to
read from the view and delete the replaced ABAP logic. With write access over MCP, do this in DEV
in an allowed package; otherwise write the sources to files for a person to create in ADT.
Add CDS tests with CL_CDS_TEST_ENVIRONMENT. Run syntax check, ATC and all tests (the old
characterization tests and the new CDS tests) until every one passes.
5. Measure. Compare runtime before and after on realistic data in DEV or QAS: SAT (runtime analysis) for the whole program, ST05 (SQL trace) for the database part. Report both numbers, the number of DB round trips and the data volume transferred, if available.
6. Hand over. Assign everything to one transport (views, access control, changed program, test classes). Write the transport description: what moved into CDS, what stayed, test results, runtime before and after. A person releases the transport.
define view entity needs SAP_BASIS 7.55+ (S/4HANA 2020 or newer). On older
releases use classic define view with an SQL view name, and say so in the design.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub marian-kamenistak/sap-ai-skills --plugin sap-abap10 skills in this plugin
/bugfixFix a bug in SAP ABAP code from a Jira bug, an ST22 short dump, an error message or an application log, by tracing the call chain back to the cause, proving it with the code, writing a test that reproduces it and then the smallest fix. Use when someone shares a short dump (runtime error, exception, CX_ class), says "this report crashes", "fix this dump", "wrong value after save", "job fails every night", "users get error message X", "why does this BAdI fail", or a production incident lands in DEV for a fix. Not for unclear new requirements (use spec-grill), not for cleanup without a defect (use refactor)./code-reviewReview SAP ABAP code in a transport, package, diff or exported files, using ATC findings as the base plus a checklist for Clean ABAP, security (missing AUTHORITY-CHECK, SQL injection), performance on HANA (SELECT in loops, SELECT *, FOR ALL ENTRIES with an empty table) and the team's naming rules, with a severity and a proposed fix per finding. Use when someone asks to "review this transport", "review my ABAP", "check this code before release", "is this ready for QAS", "code review this diff", "what's wrong with this program", or before transport-release. Not for fixing the findings (the author decides; use refactor or implement), not for reviewing SAP standard code./documentationWrite technical documentation for an SAP ABAP object or package from the code itself, covering purpose, inputs and outputs, tables read and written, who calls it and what it calls, a Mermaid sequence diagram and known risks, as Markdown for Confluence or a Jira ticket. Use when someone asks to "document this class", "write docs for this Z program", "explain this package for the wiki", "write a technical spec from the code", "onboarding doc for this interface", "what does this function module do, written up", or after implement or transport-release. Not for answering a one-off "how does it work" question (use reverse-engineer), not for writing a functional specification (use spec-grill)./implementBuild a new SAP ABAP feature from an approved specification to activated, tested code in DEV assigned to a transport, with two technical options for a person to choose from and ABAP Unit tests for each acceptance criterion. Use when someone says "implement this ticket", "build this", "develop this change", "add this field / check / output to the Z program", "write the BAdI implementation", "create the class for this spec", or hands over a spec that scored 8/10 or more in spec-grill. Not for unclear tickets (run spec-grill first), not for bugs (use bugfix), not for restructuring old code without new behaviour (use refactor)./refactorRefactor legacy SAP ABAP code in small, tested steps toward Clean ABAP without changing behaviour, starting with characterization tests that pin down today's output. Use when someone asks to "clean up this program", "refactor this Z report", "make this testable", "split this huge method", "replace FORM routines with a class", "modernize the syntax", "remove duplicated code", "this code is unreadable", or prepares old code for a change. Not for new behaviour (use implement), not for moving data reads into CDS views (use cds-rewrite), not for fixing a known bug (use bugfix)./reverse-engineerExplain how existing SAP ABAP code works or why it fails, by finding the entry point (transaction, report, BAdI, user exit, RFC, batch job) and following the call chain, data flow and where-used, with a Mermaid diagram and evidence from the code. Use when someone asks "how does X work", "where is this field filled", "why does Y happen", "what calls this function module", "what does this Z program do", "trace this transaction", "which BAdI changes this value", or needs to understand legacy code before a change, a refactor or a bugfix. Read-only, never changes code. Not for writing documentation for others (use documentation) and not for fixing the bug (use bugfix).Other plugins' skills for the same job