/sap-dev-core:sap-compare <OBJECT_NAME> --against <profile-hint> [--type ...] [--ddic|--source]from sap-dev-core
Compares the same ABAP object across two SAP systems via RFC, producing structured field diffs, source diffs, and AI-summarized differences with release-skew annotations. Read-only; useful for landscape drift analysis and pre-transport checks.
Ships in sap-dev-core. 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.
Diffs one repository object between two systems and explains the differences.
Use it for landscape drift ("works in QAS, fails in DEV"), pre-transport sanity
checks, and confirming an import landed. Pure read-only on both systems
(observes shared/rules/skill_operating_rules.md).
| File | Path | Purpose |
|---|---|---|
sap_settings_lib.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_settings_lib.ps1 | Get-SapSettingValue |
sap_connection_lib.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1 | Get-SapWorkDir, Resolve-SapProfileHint, Get-SapCurrentConnectionProfile |
sap_dpapi.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_dpapi.ps1 | decrypt RIGHT password (-Action unprotect; invoked as a subprocess) |
sap_rfc_lib.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_lib.ps1 | Connect-SapRfc, Disconnect-SapRfc, New-RfcReadTable |
sap_rfc_read_source.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_read_source.ps1 | Read-SapAbapSource (cross-system source) |
sap_compare_ddic.ps1 | <SKILL_DIR>\references\sap_compare_ddic.ps1 | dual-connect DDIC fetch + structured field diff -> diff.json |
sap_compare_diff.ps1 | <SKILL_DIR>\references\sap_compare_diff.ps1 | normalize + text diff (source mode) |
sap_log_helper.ps1 | <SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1 | structured logging |
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))"
| Setting | Default if blank |
|---|---|
work_dir | C:\sap_dev_work |
Parse WORK_DIR= and RUN_TEMP= from stdout.
Set {WORK_TEMP} = {work_dir}\temp and {RUN_TEMP} = the RUN_TEMP= value
(Get-SapRunTemp mints + creates {work_dir}\temp\run_<id>). Set
{OUT} = {RUN_TEMP}\compare\{OBJECT} — per-run private scratch, so concurrent
/sap-compare runs never clobber each other's left.def/right.def/diff.json.
Ensure {OUT} exists:
cmd /c if not exist "{OUT}" mkdir "{OUT}"
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_compare_run.json" -Skill sap-compare -ParamsJson "{\"args\":\"{RAW_ARGS}\"}"
{OBJECT} = first positional, uppercased.--against <hint> -> {AGAINST} (required). Uses Resolve-SapProfileHint
grammar: UUID, last, default, <SID>, <SID>/<CLIENT>/<USER>, or a
description substring.--type -> {TYPE} (default auto).--ddic / --source -> force {MODE} (otherwise derived in Step 3).The reference scripts own the dual connection. For source mode, the SKILL can also drive it directly. Resolution refuses on ambiguity (mirrors the broker "ambiguous = refuse loudly" rule):
. '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'
. '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_lib.ps1'
# LEFT = pinned (empty params => Connect-SapRfc falls back to the pinned profile)
$left = Connect-SapRfc -DestName "CMP_LEFT"
if (-not $left) { Write-Output "ERROR: LEFT not connected (run /sap-login)"; exit 2 }
# RIGHT = --against profile, explicit creds
$cands = @(Resolve-SapProfileHint -Hint '{AGAINST}')
if ($cands.Count -eq 0) { Write-Output "ERROR: profile '{AGAINST}' not found"; exit 2 }
if ($cands.Count -gt 1) { Write-Output "ERROR: '{AGAINST}' is ambiguous — qualify as <SID>/<CLIENT>/<USER>"; exit 2 }
$t = $cands[0]
$pw = (& '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_dpapi.ps1' -Action unprotect -Value "$($t.password_dpapi)" 2>$null) -as [string]
$right = Connect-SapRfc -Server $t.application_server -Sysnr $t.system_number `
-MessageServer $t.message_server -LogonGroup $t.logon_group -SystemID $t.system_id `
-Client $t.client -User $t.user -Password $pw -Language $t.language -DestName "CMP_RIGHT"
if (-not $right) { Write-Output "ERROR: RIGHT '{AGAINST}' not connected (RFC creds / DPAPI / reachability)"; exit 2 }
Record {LEFT_SID} / {RIGHT_SID} and each profile's server_release_marker for the Step 5 annotation.
Note:
Connect-SapRfcpublishes$g_*caller-scope vars (last call wins) andDisconnect-SapRfccleans up the last config. Keep$left/$rightand let the reference scripts own lifecycle; don't rely on$g_*after the 2nd connect.
If {TYPE}=auto, probe LEFT via New-RfcReadTable (same table set as
/sap-explain-object Step 3: TRDIR/TFDIR/SEOCLASS/DD02L/DD04L/DD01L/DD40L).
| Detected type | {MODE} |
|---|---|
| table, structure, data element, domain, table type | ddic |
| program, include, fm | source |
| class / interface | source (RFC source unsupported -> see Limitations) |
--ddic / --source override the mapping.
powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_compare_ddic.ps1" -Object "{OBJECT}" -Type "{DDIC_TYPE}" -Against "{AGAINST}" -OutDir "{OUT}"
sap_compare_ddic.ps1 connects both systems, fetches the definition on each
(DDIF_FIELDINFO_GET for table/structure; DDIF_DTEL_GET / DD01L / DD40L
for DE/domain/table type — the chain from sap_rfc_lookup_ddic.ps1,
parameterized by -Dest), and writes {OUT}\diff.json + left.def / right.def.
diff.json:
{ "object":"{OBJECT}","type":"{DDIC_TYPE}",
"left":{"sid":"{LEFT_SID}","exists":true,"read_status":"OK"},
"right":{"sid":"{RIGHT_SID}","release":"...","exists":true,"read_status":"OK"},
"verdict":"DIFFERS","reason":"",
"identical":false,
"added":[{"field":"ZZREASON","datatype":"CHAR","len":"40","dec":"0"}],
"removed":[], "type_changed":[{"field":"MENGE","left":"QUAN","right":"QUAN"}],
"length_changed":[{"field":"NAME1","left":"30.0","right":"40.0"}],
"reordered":["WERKS","MATNR"] }
read_status per side distinguishes a genuine absence from a fetch failure:
OK (read, present), ABSENT (read, object not found), FAILED (RFC/read error
— state unknown). verdict is the authoritative result — the script emits
IDENTICAL/DIFFERS only when BOTH sides read OK; if either side is FAILED, or
both sides are ABSENT, it emits COMPARE_UNAVAILABLE (exit 1) with reason,
never a false IDENTICAL. One side ABSENT + the other OK → DIFFERS ("exists
only on LEFT/RIGHT").
Parse the RESULT: line:
| Last-but-one line | Meaning |
|---|---|
RESULT: IDENTICAL | both read OK + structurally equal |
RESULT: DIFFERS | both read (fields differ, or exists on exactly one side) |
RESULT: COMPARE_UNAVAILABLE - <reason> | a side failed to read, or absent on both — do not report identical; surface the reason and stop |
. '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_read_source.ps1'
$L = Read-SapAbapSource -Name '{OBJECT}' -Type '{TYPE}' -OutDir '{OUT}\left' -Dest $left -WithIncludes
$R = Read-SapAbapSource -Name '{OBJECT}' -Type '{TYPE}' -OutDir '{OUT}\right' -Dest $right -WithIncludes
Then unified diff (per file; includes matched by name):
powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_compare_diff.ps1" -LeftDir "{OUT}\left" -RightDir "{OUT}\right" -OutFile "{OUT}\diff.txt"
Handle Status per side: NOT_FOUND -> record "exists only on LEFT/RIGHT";
UNSUPPORTED (class) -> stop with the class-limitation message.
diff.mdRead diff.json (ddic) or diff.txt (source) plus both release markers; write {OUT}\diff.md:
read_status is FAILED, or both ABSENT). Never render a
COMPARE_UNAVAILABLE result as "identical" — report the reason instead.server_release_marker is
probably a version delta, not a defect).Print {OUT} + the verdict. Disconnect both destinations. {OUT} and the
_run.json state live under {RUN_TEMP} (per-run private scratch), swept
automatically by Remove-SapStaleRunTemp — copy any diff.md the user wants to
keep to a stable location before it ages out.
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_compare_run.json" -Status SUCCESS -ExitCode 0
(On failure use -Status FAILED -ExitCode 1. -Status must be one of SUCCESS|FAILED|SKIPPED|EXISTED|ABANDONED.)
/sap-explain-object {OBJECT} to understand one side's logic,
or feed diff.md into a fix on the lagging system (/sap-se38 / /sap-se11 / ...).| Symptom | Cause | Fix |
|---|---|---|
ERROR: profile not found / ambiguous | bad --against hint | qualify as <SID>/<CLIENT>/<USER> |
| RIGHT decrypt fails | profile saved by a different Windows user (DPAPI CurrentUser) | re-save via /sap-login as the current user |
UNSUPPORTED (source) | class/interface over RFC | use ADT mode (planned) or compare on the GUI-attached system only |
| many spurious source diffs | gen-timestamp / formatting | extend sap_compare_diff.ps1 normalization rules |
sap_rfc_read_source.ps1 (RPY); without it, source mode is unavailable.--right-name <name>.reordered is informational, not a defect.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-dev-core61 skills in this plugin
/sap-activate-objectActivates an inactive SAP repository object via SAP GUI Scripting. Routes to
the correct transaction by object type: SE38 for reports/programs/function-
group main programs, SE37 for function modules, SE24 for classes/interfaces
/methods, SE11 for DDIC objects (table, view, dataelement, structure,
tabletype, typegroup, domain, searchhelp, lockobject). Handles the
"inactive objects worklist" popup that SAP shows when there are multiple
inactive objects of the same locality (transportable vs. local — SAP filters
the popup by package locality of the triggering object). Verifies activation
via PROGDIR (programs/FMs include) and DWINACTIV.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-api-advisorNatural-language SAP API discovery over RFC (no GUI): turn a goal like "create
a sales order" or "post a goods movement" into a ranked, trap-annotated,
paste-ready shortlist of BAPIs / function modules / classes — with released
state (S/4), interface + documentation for the top candidates, the team's known
traps inlined, and a ready-to-paste CALL FUNCTION snippet. Reads the BAPI
catalog (BAPI_MONITOR_GETLIST), TFDIR/TFTIT name+text, SEOCLASS, ARS_W_API_STATE
(S/4 released state), FUPARAREF/FUNCT + DOCU_GET. HARD rule: it never test-calls
a candidate — snippets are text only. Read-only; deploys nothing.
Use for: "which BAPI/FM for X", find an API, is this BAPI released, API to
create/read/post <object>, discover function module, released API S/4.
`successor` (released→sanctioned replacement) is phase 2; `scan` is phase 3.
Prerequisites: an RFC-capable connection profile (/sap-login). No dev-init, no GUI.
/sap-atcRuns the SAP ABAP Test Cockpit (ATC) end-to-end as a quality gate:
builds an SCI Object Set scoped to the target object(s), creates an
ATC Run Series bound to that set, polls the ATC Run Monitor until the
run completes, then reads the Priority 1 / Priority 2 / Priority 3
finding counts from the Manage Results screen and (best-effort)
downloads the result text file. Applies the customer brief's
MAX_PRIORITY threshold to decide pass / fail.
Replaces the legacy SCI-results-tree implementation that lacked a
Priority column. Per-stage VBS references are recorded against the
S/4HANA 1909 ATC layout — re-record on first failure with
/sap-gui-probe --record if your release uses different tree node IDs / grid
column IDs.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-call-bdcExecutes BDC (Batch Data Communication) sessions in SAP via RFC.
Reads SHDB recording files from the bdc/ folder, connects via
SAP NCo 3.1, calls ABAP4_CALL_TRANSACTION, and outputs
full BDCMSGCOLL messages to a result file.
Connection parameters resolved from the AI session's pinned profile in
connections.json (saved via /sap-login).
Prerequisites: SAP profile saved via /sap-login (RFC password required).
SAP NCo 3.1 (32-bit, .NET 4.0) in GAC.
/sap-change-packageChanges the package (TADIR-DEVCLASS) assignment of an SAP repository object
via the "Object Directory Entry" dialog (Goto > Object Directory Entry).
Routes by object type to SE38 / SE37 / SE24 / SE11 / SE91 / CMOD (the last
for enhancement projects — used by /sap-cmod). Handles three
flows automatically based on current vs new package locality:
(a) $TMP → transportable (Z*/Y*): resolves a modifiable TR via
/sap-transport-request, then enters the new package + TR.
(b) transportable A → transportable B: pre-checks E071/E070 to ensure
the object is NOT linked to a modifiable TR (would block the move).
(c) transportable → $TMP: confirms the move and presses "Local object".
Verifies via TADIR re-query.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-check-abapValidates ABAP source (report / program / FM / class / include) before
deployment — one skill, dimension-dispatched: naming (variable conventions),
type (DDIC type validity), unused (dead variables), sql (SELECT/UPDATE/DELETE
fields vs table defs), contract (offline generation rules), spec (offline: code
covers every dependency / message / text / selection field in the design spec),
fm (CALL FUNCTION params / sections / types vs the live FM over RFC — absorbed
from the former sap-check-fm), syntax (compiler-level EDITOR_SYNTAX_CHECK via
RFC, catching real errors offline before any GUI upload). Writes tab-delimited
result files with fix advice; feed findings to /sap-fix-abap. SAP connection
optional — offline skips type/sql/fm/syntax; live dimensions that can't run
report COULD_NOT_CHECK, never a silent pass.
Prerequisites: SAP GUI (SAP.Functions COM); SAP NCo 3.1 (32-bit) + the dev-init
wrapper Z_GENERIC_RFC_WRAPPER_TBL for the syntax dimension.
Other plugins' skills for the same job