/sap-dev-core:sap-api-advisor discover "<natural-language goal>" [--top=N] [--details=N] [--type=fm|bapi|class|any] [--package=<pat>]from sap-dev-core
Discovers SAP BAPIs, function modules, and classes via natural-language queries over RFC. Returns ranked, trap-annotated shortlists with interface docs and paste-ready CALL FUNCTION snippets. Read-only; never executes candidates.
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.
You turn a natural-language goal into a ranked, trap-annotated API shortlist, entirely over RFC (SAP NCo 3.1, 32-bit PowerShell). No GUI. Read-only (Rule 1). You never smoke-call a candidate — not even a "read-only" one; the deliverable is metadata + docs + a text snippet, never an executed FM (Rule 5).
Task: $ARGUMENTS
| File | Token | Purpose |
|---|---|---|
<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md | (rule) | Mandatory operating rules (esp. Rule 1 read-only, Rule 5 no unsolicited execution) |
<SKILL_DIR>/references/sap_api_discover.ps1 | %%RFC_LIB_PS1%% (only) | RFC backend: -Action harvest|released|detail. %%SAP_*%% stay literal → Connect-SapRfc fills them from the pinned profile |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lib.ps1 | %%RFC_LIB_PS1%% | NCo connect/disconnect; fills %%SAP_*%% from the pinned profile |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lookup_fm.ps1 | (CLI) | Cached FM signature (RPY_FUNCTIONMODULE_READ_NEW) for the top candidates — reuse, don't re-implement |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_error_hints.ps1 | (CLI) | -Action resolve — team frequently_errors traps for the top FMs (READ only; curation stays in /sap-error-kb) |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_artifact_lib.ps1 | %%ARTIFACT_LIB_PS1%% | Register the advisory + candidate TSV for /sap-evidence-pack |
No VBS, no golden-screen baseline, no session lock — this skill never drives the GUI.
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 ('ARTIFACT_DIR=' + (Get-SapSettingValue 'artifact_dir' ((Get-SapWorkDir) + '\artifacts'))); Write-Output ('RUN_TEMP=' + (Get-SapRunTemp))"
Set {RUN_TEMP} (all generated scratch), {ARTIFACT} = the artifact dir.
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_api_advisor_run.json" -Skill sap-api-advisor -ParamsJson "{\"mode\":\"<MODE>\"}"
| Mode | Meaning |
|---|---|
discover "<goal>" (default for a bare quoted string) | ranked API shortlist — v1, Steps 2–8 below |
successor <NAME> | phase 2 — print "successor mode is planned for phase 2 (released-state + sanctioned successor from the knowledge pack); not in v1" and stop |
scan <OBJECT> | phase 3 — print the same "not in v1" note and stop |
Flags: --top=N (ranked rows shown, default 10), --details=N (deep-detailed top N, default 3), --type=fm|bapi|class|any (default any), --package=<pat> (optional grouping hint). Materialize the backend once (substitute only %%RFC_LIB_PS1%%, leave %%SAP_*%% literal → Connect-SapRfc uses the pinned profile):
$ps = [IO.File]::ReadAllText('<SKILL_DIR>\references\sap_api_discover.ps1', [Text.Encoding]::UTF8)
$ps = $ps.Replace('%%RFC_LIB_PS1%%', '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_lib.ps1')
[IO.File]::WriteAllText('{RUN_TEMP}\api_run.ps1', $ps, (New-Object Text.UTF8Encoding($false)))
Write-Host 'Done'
From the goal derive THREE things and echo them in one line so the user can correct course before the harvest:
goods movement → also goodsmvt; sales order
→ also salesorder, vbak; purchase order → po, ekko, bapi_po;
material → matnr, mara. (Live-verified: on a JA system "post goods movement"
only found BAPI_GOODSMVT_CREATE once goodsmvt was a keyword.)BAPI_<NOUN>% and module-prefix guesses (BAPI_SALESORDER%,
BAPI_GOODSMVT%, MB_%, SD_%). These drive the TFDIR name search + the
name-relevance ranking boost.--type (default any).Searching create a sales order → keywords
create, sales, order, salesorder; name patternsBAPI_SALESORDER%; typeany. Harvesting the BAPI catalog + TFDIR
- TFTIT now…
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "{RUN_TEMP}\api_run.ps1" -Action harvest -Keywords "<k1,k2,...>" -NamePatterns "<pat1,pat2>" -Type "<type>" -Max 40 -OutTsv "{RUN_TEMP}\api_candidates.tsv"
STATUS: NO_MATCH → tell the user no API matched and suggest reformulating (add
the object name, or the SAP abbreviation); never invent a name; stop (log SUCCESS).STATUS: RFC_LOGON_FAILED / a NOTE:-flagged catalog failure with zero rows →
RFC_ERROR; surface + stop with the /sap-login hint.STATUS: OK n=<k> total=<t> capped=<bool> → capped=true means total exceeded
40; the shortlist is the most-relevant 40 (mention it). Each CAND: line has
match (keywords hit), src (catalog/name/text), fmode, released,
obsolete, comp, text.For the top ~10 candidate FM names, enrich released state (S/4 only):
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "{RUN_TEMP}\api_run.ps1" -Action released -Names "<name1,name2,...>"
STATUS: NOT_APPLICABLE → ECC / any release without the API-release contract:
render the released column as NOT_APPLICABLE (no release contract on this release) for every candidate — never blank, never a false "released".REL: name=… state=… successor=… → per-candidate release state (state=NOT_LISTED
= the API isn't in ARS_W_API_STATE; report as such, not as "not released").Show a ranked table (top --top, default 10) with a visible score column and
the rubric, applied by you over the harvest + released data:
released (S/4) > BAPI-catalog member (non-obsolete) > RFC-enabled (fmode=R) >
name-pattern fit (goal words in the API name) > package plausibility > text match.
Demote obsolete=X with the reason printed. Use judgment the raw score can't:
the canonical API for the goal (e.g. BAPI_SALESORDER_CREATEFROMDAT2,
BAPI_GOODSMVT_CREATE) belongs at/near the top even when a keyword-heavier row
scored higher — say why. Zero rows survived → NO_MATCH; never fabricate.
--details (default 3)Signature (cached) + parameter texts + FM docs:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_rfc_lookup_fm.ps1" -FmName "<FM>" ... # signature (reuse; do NOT re-implement)
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "{RUN_TEMP}\api_run.ps1" -Action detail -Names "<FM1,FM2,FM3>" -OutFile "{RUN_TEMP}\api_docs.txt"
DETAIL: fm=… param=… text=… gives parameter short texts; doc_lines + the
-OutFile capture the DOCU_GET documentation.
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_error_hints.ps1" -Action resolve -Objects "<FM1,FM2,FM3>" ...
Render CONFIRMED rows as a "Known traps" block per detailed candidate (READ only).
Write {ARTIFACT}\advisory_<slug>.md: the system identity (SID / client / release
marker — so the snippet is never mistaken as verified elsewhere), the ranked table
with scores + reasons, and per detailed candidate: interface digest, docs digest,
traps, and a CALL FUNCTION snippet with exception handling + a BAPIRET2 loop
and — for BAPIs — an explicit BAPI_TRANSACTION_COMMIT / ROLLBACK note. State
plainly in the advisory: "I did not test-call this; here is the snippet." Then
register:
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_artifact_lib.ps1" -Register -Skill sap-api-advisor -Kind api_advisory -Format md -Path "{ARTIFACT}\advisory_<slug>.md" -Coverage <CHECKED|COULD_NOT_CHECK> -Verdict <MATCHED|NO_MATCH>
Coverage=COULD_NOT_CHECK when released-state was NOT_APPLICABLE/unreadable (so a
"use this API" line always carries the caveat). Also register api_candidates.tsv
(-Kind api_candidates).
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_api_advisor_run.json" -Status <SUCCESS|FAILED> -ExitCode <0|1> [-ErrorClass <CLASS> -ErrorMsg "<short>"]
error_class: infra RFC_LOGON_FAILED / RFC_ERROR only (v1 discover adds no new
class; NO_MATCH is a normal SUCCESS verdict, not a failure). Phase 2 (successor)
will add API_KB_MISSING.
NO_MATCH (never invented names); RFC_ERROR on RFC
failure (never a GUI-fallback claim); released-state unavailable → NOT_APPLICABLE
/ COULD_NOT_CHECK, which caps any recommendation with an explicit caveat.discover only. successor (released → sanctioned replacement via the
phase-2 knowledge pack + ARS_W_API_STATE SUCCESSOR_* columns) and scan
(walk /sap-explain-object edges) are later phases.ARS_W_API_STATE absent on ECC → NOT_APPLICABLE).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-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.
/sap-check-fixRoutes "check and fix" / "check" / "fix" requests for an EXISTING SAP object to
the correct workbench skill (sap-se38 / sap-se37 / sap-se24 / sap-se11) by an
explicit object-type keyword, or — when no keyword is given — auto-detects the
type by probing SE38 → SE37 → SE24 → SE11 (Display), then dispatches in
check-and-fix mode. If the object matches an SAP-enhancement-component pattern
(function-exit FM EXIT_SAP*, exit include ZX*, table-enhancement CI_*, SAPLX*
screen exit), it is confirmed via MODSAP and routed to /sap-cmod instead (which
edits the correct underlying object — for a function exit the ZX* customer
include, never the standard FM — and re-activates the CMOD project). Invoke on
"check and fix / check / fix <kind> <name>" where <kind> is report/program, FM,
class/interface, a DDIC type, or omitted.
Prerequisites: active SAP GUI session (/sap-login first). Does not deploy new
objects — the target must already exist.
Other plugins' skills for the same job