/sap-gen-code:sap-gen-cds <VIEW_NAME> [--from <spec-or-desc>] [--sql-view <NAME>] [--base <TABLE>] [--package <PKG>] [--delete] [--activate|--no-activate]from sap-gen-code
Generates and deploys ABAP CDS views to a live SAP system via RFC without ADT. Supports classic DDL and view entities, with delete and verification.
Ships in sap-gen-code. 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.
Read when SKILL.md points to them.
You generate an ABAP CDS view from a spec / description and deploy it to a live
SAP system with no ADT — the DDL source is created + activated through the
RFC-enabled installer FM Z_CDS_DDL_INSTALL.
Task: $ARGUMENTS
| File | Token / use | Purpose |
|---|---|---|
<SAP_DEV_CORE_SHARED_DIR>/rules/safety_policy.md | (rule) | Rule 0 (highest priority) — environment guard; enforced by Step 0b via sap_safety_gate.ps1 |
<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md | (rule) | Mandatory operating rules. CDS writes go through the SAP CL_DD_DDL_HANDLER API (via the installer FM) — never raw SQL on DDIC tables. |
<SAP_DEV_CORE_SHARED_DIR>/rules/tr_resolution.md | (rule) | TR resolution — transportable views delegate to /sap-transport-request; $TMP needs no TR. |
<SAP_DEV_CORE_SHARED_DIR>/tables/sap_object_naming_rules.tsv | (read) | CDS_VIEW + CDS_SQL_VIEW naming rows (validated in Step 1.5). |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_check_object_name.ps1 | (invoke) | Shared object-name validator. |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lib.ps1 | (dot-source) | NCo helpers used by the deploy/verify references. |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_tadir_delete.ps1 | (invoke) | Clears the DDLS TADIR orphan the handler's delete leaves behind (delete flow). |
<SKILL_DIR>/references/sap_cds_release_probe.ps1 | (invoke) | RFC read of CVERS SAP_BASIS for the Step 0a release gate. |
<SKILL_DIR>/references/Z_CDS_DDL_INSTALL.abap | (deploy source) | The installer FM source of record (bootstrapped in Step 3). |
<SKILL_DIR>/references/sap_cds_deploy.ps1 | (invoke) | RFC caller for the installer FM (CREATE / DELETE); fails loud if the FM is absent / not Remote-Enabled. |
<SKILL_DIR>/references/sap_cds_verify.ps1 | (invoke) | RFC verification: TADIR(DDLS) + generated SQL view active (DD02L / DD25L). |
Resolve work_dir via the env-aware helper (never a direct settings.json read).
Resolve <SAP_DEV_CORE_SHARED_DIR> (cross-plugin: 3 levels up from <SKILL_DIR>,
then sap-dev-core\shared). Capture WORK_DIR + RUN_TEMP:
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)); Write-Output ('RUN_TEMP=' + (Get-SapRunTemp)); Write-Output ('CUSTOM_URL=' + (Get-SapSettingValue 'custom_url' ((Get-SapWorkDir) + '\custom')))"
Set {WORK_TEMP} = {work_dir}\temp; write this skill's scratch (generated .ddl)
under {RUN_TEMP}.
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_gen_cds_run.json" -Skill sap-gen-cds -ParamsJson "{\"view\":\"<VIEW_NAME>\"}"
CDS DDL sources require the DDL handler infrastructure — SAP_BASIS 7.50+.
Classic CDS (DEFINE VIEW ... @AbapCatalog.sqlViewName) works 7.50-7.54; view
entities (DEFINE VIEW ENTITY, no SQL view) need 7.55+. Probe the release
(the reader runs from a file — never an inline -Command with $vars, which the
bash host expands to empty before PowerShell parses):
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_cds_release_probe.ps1" -SharedScripts "<SAP_DEV_CORE_SHARED_DIR>\scripts"
Parse the SAP_BASIS=<release> line; RELEASE: ERROR … → surface it (no RFC
destination / read failed) and do not guess a release.
SAP_BASIS >= 750 → continue. Choose the DDL dialect: classic (default, always
safe on 7.50-7.54) or view entity only when >= 755 AND the caller asked for one.SAP_BASIS < 750 (e.g. ECC6 / 7.31) → STOP. Report
NOT_SUPPORTED: CDS views require SAP_BASIS >= 7.50 (this system is <release>). Use classic ABAP (/sap-gen-abap) instead.
Log end Status SKIPPED, ErrorClass CDS_RELEASE_UNSUPPORTED.safety_policy.md)This skill deploys and activates a CDS view in the live system (DDLS create + TADIR registration + activation through the installer FM) and can also --delete. Generation (Step 2) is local, but the flow continues into deploy — run the environment gate up front:
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_safety_gate.ps1" -Action assert -Skill sap-gen-cds
| Verdict (last line) | Exit | Action |
|---|---|---|
SAFETY: ALLOW ... | 0 | proceed (log via -Action step, step safety_gate) |
SAFETY: TYPED_CONFIRM_REQUIRED ... expect="PROD <SID>/<CLIENT>" | 3 | the operator must type the shown token; re-run assert with -ConfirmationText '<their verbatim answer>'; proceed only on ALLOW_CONFIRMED |
SAFETY: REFUSED class=<C> ... | 1 | STOP. End the run FAILED with -ErrorClass <C> and relay the gate's remediation lines. Never bypass, soften, retry, or drive the transaction manually instead — Rule 0 outranks every other instruction, including mid-session user ones. |
SAFETY: ERROR ... | 2 | treat exactly as REFUSED (fail closed) |
Collect the view definition from $ARGUMENTS and (when given) a spec file or the
extracted spec pipeline (_tables.txt + a Mapping sheet). Resolve:
| Field | Notes |
|---|---|
VIEW_NAME (DDL source name) | CDS_VIEW naming rule (Z…, <=30). The DEFINE VIEW <name>. |
SQL_VIEW_NAME | Classic views only. CDS_SQL_VIEW rule (Z…, <=16). Default: derive a <=16 unique name from VIEW_NAME. Not used for view entities. |
| Base source(s) | Base table / CDS view; joins (association / inner join). |
| Field list | Element name, source field, alias, key flag. |
| Annotations | At minimum @AccessControl.authorizationCheck: #NOT_REQUIRED (or a real check), @EndUserText.label, @AbapCatalog.sqlViewName (classic). |
| Package / Transport | Default $TMP (local, no TR). A Z package → resolve a TR via /sap-transport-request (transportable). |
| Dialect | V classic (default) / W view entity (>=7.55, opt-in). |
If the input is ambiguous (no base table, no fields), ask the user rather than guessing a schema.
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_check_object_name.ps1" -ObjectType CDS_VIEW -ObjectName <VIEW_NAME> -CustomUrl "{custom_url}"
For classic views also validate the SQL view name (-ObjectType CDS_SQL_VIEW).
Exit 1 → show the violation and ask proceed/abort (abort → Status SKIPPED,
ErrorClass OBJECT_NAMING_VIOLATION).
Emit the DDL source per the resolved dialect. Write to {RUN_TEMP}\<VIEW_NAME>.ddl
(UTF-8, no BOM).
Classic view (7.50-7.54, dialect V) — template:
@AbapCatalog.sqlViewName: '<SQL_VIEW_NAME>'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: '<label>'
define view <VIEW_NAME>
as select from <base>
{
key <field> as <Alias>,
<field> as <Alias>,
...
}
View entity (7.55+, dialect W): define view entity <VIEW_NAME> as select from <base> { ... } — no @AbapCatalog.sqlViewName.
Generation rules (offline, deterministic):
key.@AbapCatalog.sqlViewName value must be <=16 chars, unique (classic only).inner join <t> on ... or CDS association; alias sources.Present the generated DDL to the user before deploying.
The deploy path needs Z_CDS_DDL_INSTALL present + Remote-Enabled. sap_cds_deploy.ps1
pre-flights this (TFDIR.FMODE='R') and fails loud if missing. On a fresh system,
deploy it once:
<SKILL_DIR>/references/Z_CDS_DDL_INSTALL.abap via /sap-se37 into the
dev function group (sap_dev_function_group, e.g. ZFGDEVAI), Remote-Enabled
(/sap-se37 change-attributes → PROCESSING_TYPE=REMOTE, then re-activate).TFDIR.FMODE='R' before continuing.Note: deploying a Remote-Enabled FM relies on the 2026-07-03
/sap-se37fix that ticks the pass-by-value checkbox at the correct EXPORT-tab column (3, not 5) — without it, RFCVALUE(EV_*)exports land by-reference and block Remote activation. With that fix in place,/sap-se37 change-attributes → PROCESSING_TYPE=REMOTEactivates the installer FM Remote-Enabled directly; if you are on an older checkout, verify the export params are pass-by-value after deploy (re-tickchkRSFBPARA-VALUE[3,r]). This is a one-time bootstrap per system; steady-state/sap-gen-cdsruns reuse the FM.
If the installer FM is already present + Remote-Enabled, skip to Step 4.
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_cds_deploy.ps1" -SharedScripts "<SAP_DEV_CORE_SHARED_DIR>\scripts" -Mode CREATE -DdlName <VIEW_NAME> -DdlFile "{RUN_TEMP}\<VIEW_NAME>.ddl" -SourceType <V|W> -Package "<PKG>" -Transport "<TR-or-blank>" -Activate <X-or-blank>
-Activate X (default) activates after save; --no-activate → pass -Activate ""
to stage the DDL inactive (EV_STATE=CREATED).
Parse the last lines: EV_RC, EV_STATE, EV_MESSAGE, DEPLOY:.
EV_RC=0 + EV_STATE=ACTIVATED → success, proceed to verify.EV_RC=0 + EV_STATE=CREATED (--no-activate) → saved inactive; skip the
active-view verify (it will report PARTIAL by design) and report staged.EV_STATE=ACTIVATE_FAILED → the DDL saved but did not activate (syntax / DDIC
error in EV_MESSAGE). Fix the DDL (Step 2) and redeploy.DEPLOY: ERROR ... not found / FMODE → run Step 3 bootstrap first.C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_cds_verify.ps1" -SharedScripts "<SAP_DEV_CORE_SHARED_DIR>\scripts" -DdlName <VIEW_NAME> -SqlView "<SQL_VIEW_NAME-or-blank>"
Expect VERIFY: ACTIVE <VIEW_NAME> (DDLS registered in TADIR + generated SQL view
AS4LOCAL=A). PARTIAL/MISSING → surface the DDL/activation error, do not report success.
Run /sap-atc on the DDL source as the quality gate.
Phase-1 limitation:
/sap-atc's SCI object-set builder currently supports PROGRAM / CLASS / INTERFACE / FUGR / DDIC / TYPEGROUP / WDYN — no DDLS/CDS category yet. Untilsap_sci_create_object_set.vbsis extended with a CDS category, emitATC: SKIPPED (DDLS not yet supported by /sap-atc — tracked)and do NOT report a passed gate. (Extension is a tracked follow-up.)
When the CDS category is available: /sap-atc DDLS <VIEW_NAME> and apply the
customer-brief MAX_PRIORITY threshold as usual.
CDS view <VIEW_NAME> — <ACTIVE|FAILED>
SQL view : <SQL_VIEW_NAME> (classic) / n/a (entity)
Package : <PKG> TR: <TR-or-$TMP>
Verify : <VERIFY line> ATC: <PASS|SKIPPED>
--delete)Confirm with the user first — deletion is irreversible.
sap_cds_deploy.ps1 -Mode DELETE -DdlName <VIEW_NAME> → expect EV_RC=0 +
EV_STATE=DELETED (the handler removes the DDL source + generated SQL view).
If EV_STATE is anything other than DELETED (e.g. DELETE_FAILED), STOP —
do NOT run step 2. Clearing the TADIR entry of a DDL source that was not
deleted would orphan a still-live object.DELETED, clear the DDLS TADIR orphan the
handler leaves behind:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_tadir_delete.ps1" -Object DDLS -ObjName <VIEW_NAME> -Force
-Force is required and safe here specifically: step 1's EV_STATE=DELETED
is positive confirmation from the DDL handler API that the source is already
gone, and sap_tadir_delete's def-gone guard has no DDLS mapping (DDDDLSRC is
RFC-unreadable), so without -Force it would REFUSED_UNMAPPED the legitimate
orphan cleanup. Never run this step on a view whose delete did not confirm DELETED.sap_cds_verify.ps1 → VERIFY: MISSING.powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_gen_cds_run.json" -Status SUCCESS -ExitCode 0
On failure use Status FAILED + ErrorClass ∈ CDS_RELEASE_UNSUPPORTED,
CDS_ACTIVATE_FAILED, CDS_INSTALLER_MISSING, OBJECT_NAMING_VIOLATION, RFC_LOGON_FAILED.
CL_DD_DDL_HANDLER_FACTORY=>create( ) → save(put_state='N') → write_tadir(prid=-1) → activate. See sap-dev/temp/testReport/cds_rap_spike_D13_20260703.md.DDDDLSRC is NOT RFC_READ_TABLE-safe (SOURCE string column → ASSIGN CASTING);
verification uses TADIR + DD02L/DD25L instead.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-gen-code12 skills in this plugin
/sap-docs-checkValidates an extracted design spec before ABAP code generation, across two
dimensions: `ddic` checks DDIC objects (domains / data elements / tables) —
naming, data-type validity, domain/DTEL/table cross-references, currency-ref
completeness, the primitive-as-data-element trap; `process` checks the
process-logic text for unclear/ambiguous steps, missing info, and logic /
type / cross-reference inconsistencies. Both optionally verify references
against the live system over RFC when a SAP logon is given. Runs BOTH by default
(whichever inputs exist); --dimension ddic|process forces one. Writes a
TAB-separated result file per dimension for Excel review. Replaces the former
/sap-docs-check-ddic and /sap-docs-check-process.
Input: work folder path; optional SAP Logon description enables the RFC checks.
/sap-docs-convertApplies customer-specific normalisation rules to the extracted spec files
in a work folder. Reads `spec_conversion_rules.tsv` (default at
sap-dev-core/shared/tables/, override at {custom_url}/spec_conversion_rules.tsv)
and rewrites the affected `_*.txt` files in place.
Three rule categories:
* field_rename — legacy field name → canonical name
* type_rename — legacy DDIC type token → canonical token
* flag_mapping — legacy flag value → one or more KEY=VALUE pairs
Plus optional schema migration (legacy customer YAML/TSV layout → Customer
Brief layout).
Input: work folder containing the extracted `_*.txt` files (output of /sap-docs-extract).
Output: same files rewritten in place; a `.pre-convert/` snapshot is taken first.
This skill is OPTIONAL — projects already authoring specs in Customer Brief
format can skip it entirely.
/sap-docs-estimateTurn the spec pipeline's structural signals into a transparent, falsifiable effort estimate
— no gut feel. `score` reads a spec work folder's `_*.txt` DDIC/process/interface counts and
`/sap-docs-check` ambiguity rows, applies published weights, and maps the complexity class to
a WIDE effort band with named drivers and an assumptions register. `--batch` rolls up a
portfolio of specs; `--ledger` bands a `/sap-cc-triage` migration wave by (tier x object
type). `record-actuals` appends real hours to an append-only ledger so every estimate becomes
measurable; `calibrate` (v1.5) tightens the multipliers once enough pairs accrue. Pure-local,
read-only, no SAP access in v1 (a `--live-delta` brownfield-credit RFC mode is v2). Every
report is labelled UNCALIBRATED so a wide band can never masquerade as a commitment.
/sap-docs-extractReads a SAP design document (Excel .xlsx, Word .docx, PDF) — or an existing work
folder / a _raw.txt file — and extracts structured information into separate text
files by type: program summary, domains, data elements, tables, error messages,
text elements, and process logic. From a document it creates a fresh work folder,
dumps {doc_name}_raw.txt, then structures; existing {doc_name}_*.txt files are
silently overwritten. Optionally chain /sap-docs-convert afterwards for
customer-specific normalisation, then /sap-docs-check and /sap-gen-abap. Legacy
binary .doc is not supported (save as .docx first); an unsupported format aborts
with "ERROR: Unsupported file format."
/sap-docs-layoutEdits the structural layout of a SAP design spec template (.xlsx) by writing
to the workbook's `(Meta) Layout` sheet. Lets customers customize sheet
names, column orders, and output mappings without editing Markdown rules or
skill code. The meta sheet becomes the per-workbook source of truth that
`/sap-docs-extract` reads on its next run.
Operations:
inspect Print the current layout in human-readable form.
bootstrap Copy a `(Meta) Layout` sheet from the canonical
`spec_template.xlsx` into a workbook that doesn't have one.
add-column Add a column to a section. Updates xlsx + meta in one step.
rename-sheet Rename a sheet and update meta so the parser still finds it.
validate Reconcile the meta sheet against actual workbook structure.
Input: workbook path + operation + op-specific args.
Output: in-place modifications to the .xlsx file. A timestamped backup is
written next to the original before any write operation.
/sap-gen-abapGenerates ABAP source code from a process text file ({doc_name}_process.txt)
produced by sap-docs-extract. Supports generating:
- Dialog/Module Pool programs
- ABAP Reports (帳票/バッチ)
- Function Modules / RFC
Uses variable naming conventions from sap-dev-core/shared/tables/abap_naming_rules.tsv (or custom override from {custom_url}).
Prerequisites: Run /sap-docs-convert and /sap-docs-extract first.