KorhanKara/abap-clean-core-successors / skill/clean-core-successors
clean-core-successors
UnverifiedAnswer which released CDS view field replaces a classic SAP table field (MARA-MATNR to I_PRODUCT-Product), what replaces another SAP object such as a function module, class or old CDS view, and rewrite simple SELECTs from a classic table to a released CDS view, from data read out of a real SAP system. Use whenever the user asks what to use instead of a table, table field, function module, BAPI, class or data element, which CDS view replaces a table, how to migrate a SELECT to a released API or clean core, or shares a SELECT on a classic table. Also use to load the user's own file downloaded from the ZCLEAN_CORE_SUCCESSORS report.
Clean core successors
The user wants to replace a classic SAP object with a released one: a table with a released CDS view, a function module, class or data element with its released successor. SAP publishes which object replaces which. This skill adds what SAP does not publish, which view field replaces which table field, and whether a successor really clears the ATC finding.
Answer from the data, never from memory. CDS field names look guessable and are
not: MARA-MATKL is ProductGroup, not MaterialGroup.
Look it up
Run the scripts from this skill's folder. Use python3, or py -3 on Windows.
python3 scripts/lookup.py --table MARA --field MATNR # which view field replaces this field
python3 scripts/lookup.py --table MARA # all views and their full mapping
python3 scripts/lookup.py --cds I_PRODUCT --field ProductGroup # where a view field comes from
python3 scripts/lookup.py --rewrite "SELECT SINGLE matnr matkl FROM mara INTO @DATA(ls_mara) WHERE matnr = @lv_matnr."
python3 scripts/lookup.py --object BAPI_PROCORD_GET_DETAIL # successor of any object, * as wildcard
python3 scripts/lookup.py --object I_STOCK* --type DDLS
Not-released views are skipped. Add --allow-unreleased only to explain why a
view SAP names is not usable.
How to answer
-
Show the change, then ask before applying it. Always. For every fix, show the old code and the new code one after the other, with a short table of what each old field or object became and what was left out and why. Then ask the user whether to apply it. Do not write to the user's system, file or editor until they say yes, even when they asked you to "fix" or "convert" the code. If they say no, leave everything as it was.
-
Several views can cover one field.
MARA-MATNRisProductin five views. Prefer the view that covers every field the user'sSELECTreads, so the statement keeps one source.--rewritesorts candidates by fewestunmappedFields. For a single field the data gives no ranking: list the views and ask which other fields the user reads, instead of picking one from memory. -
computed: truein a--cds --fieldanswer means the view field has no single column:readsColumnsandexpressionsay what it is built from. -
Alias every renamed field as
CdsField AS original_field. The rest of the program still uses the old names, and the alias keeps the change to one statement.--rewritealready does this; do the same in any rewrite you write by hand (joins, subqueries,FOR ALL ENTRIES). -
Write the SELECT in this order: field list,
FROM,WHERE,GROUP BY,ORDER BY,INTO,UP TO, one clause per line.--rewritealready does this, and maps table columns inWHEREandORDER BYtoo. -
Report unmapped fields, never drop them. A field missing from a view means that view is the wrong target or the rewrite needs a join. Dropping it gives code that compiles and returns wrong data.
-
usedInExpressionis information, not a replacement. It lists view fields that use the column inside aCASE, a calculation or a function, with the definition. The value can differ from the column, so do not alias the view field to the column. Show the expression and let the user decide. -
An empty mapping can be correct. A view SAP names as successor can read a different table or take a field through an association.
-
A mapping is not proof of the same rows. The view can filter or join. Present rewrites as drafts to compile and test, and name the release the data was read from (
dataReleasein the output) when it matters. -
Recommend only successors that clear the ATC finding.
--objectmarks each row withclearsAtcFinding; onlyabapCloud: Releasedis true. AKey user onlysuccessor is released for key user apps but not for ABAP Cloud, so ATC still reports it as an internal API;Not releasedis not usable either. When asked about such an object, name SAP's successor but say plainly that using it would not clear the ATC finding, and do not put it into a rewrite. The report's screen hides these successors for the same reason. -
A function module has no field mapping. For
--objectresults, give the successor and its type; for a CDS successor of a table, continue with--table. -
No row for an object means SAP's list names no successor. It does not mean the object is safe to use. Say what the data shows and do not invent a successor.
The data
references/core-data-services.json holds one entry per table and view pair:
tableName, cdsName, released and a mapping list. Each row has cdsField
and tableField. Rows with computed: true also carry expression and
definedIn: the view field reads that column inside an expression. A row with an
empty tableField could not be traced to a column of the table.
references/successors.json holds one row per object and successor:
objectType, objectName, objectState, successorType, successorName and
abapCloud. Function modules appear under their own name.
references/DATA_VERSION.json records where each file came from. Both bundled
files are read from a standard S/4HANA 2025 system (S4CORE 109 SP1) with add-on
and customer fields removed. Other releases can have other fields and other
successors; the user's own file settles that.
Use the user's own system
When the user's release differs, or they want their own extension fields, they can load their own data:
- Install the
ZCLEAN_CORE_SUCCESSORSreport from this repository, with abapGit or by pastingstandalone/zclean_core_successors.abapinto a new report. - Run it and press Download JSON in the toolbar. The report asks where to save the file; any folder works.
- Run
python3 scripts/import_mapping.py <path to the file>from this skill's folder, the copy the assistant loads. The file carries its release;--releaseonly overrides it.
The one file holds both the mapping and the successor list. The import replaces
both bundled files and keeps the old ones with a .bak suffix. The new files can
hold the user's own fields, so they stay on their machine.
Releases before S/4HANA 2022
The report needs S/4HANA 2022 or later: it reads SAP's successor list in the system, which is the same data ATC's "Usage of APIs" check reads, and SAP fills that list from 2022 on. On an older release the report stops, and this skill with its bundled S/4HANA 2025 data is the only source. When the user is on an older release, answer from the bundled data and say once that it comes from S/4HANA 2025: a view, field or successor it names may not exist in their release yet, so they should check it in their system (SE11, ADT) before using it.
Creating objects in an SAP system is the user's decision. Do not install or run the report for them without asking.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |