/sap-project:sap-pfcg show <ROLE> | add-tcodes <ROLE> <T1,T2> [--generate] | generate <ROLE> | assign <ROLE> <USER[,..]> | unassign <ROLE> <USER>from sap-project
Automates SAP PFCG role management with one-line commands for show, add/remove tcodes, generate, user-compare, and assign/unassign. Every write is confirm-gated with a delta preview and verified by an AGR_* RFC re-read.
Ships in sap-project. 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 make the five safe Phase-1 role changes as one-liners: show (read-only dossier), add/remove menu tcodes, generate the profile (via SUPC, never the auth tree), user-compare, and assign/unassign users — every write confirm-gated on an explicit delta and verified by an authoritative RFC re-read.
Task: $ARGUMENTS
| File | Token / call | Purpose |
|---|---|---|
<SKILL_DIR>/references/sap_pfcg_verify.ps1 | -Mode snapshot|list | Role dossier (show) + write-gate re-read |
<SKILL_DIR>/references/sap_pfcg_create.vbs | GUI (%%ROLE_NAME%%·%%ROLE_DESC%%·%%TRANSPORT%%·%%SESSION_PATH%%·%%ATTACH_LIB_VBS%%·%%SESSION_LOCK_VBS%%) | PFCG create-single-role — recorded on EC2 2026-07-11 (Role>Create>Role → desc → Save; step-verified, assembled-driver smoke-test pending) |
<SKILL_DIR>/references/sap_pfcg_generate.vbs | GUI (%%ROLE_NAME%%·%%SESSION_PATH%%·%%ATTACH_LIB_VBS%%·%%SESSION_LOCK_VBS%%) | Profile generate — recorded on EC2 2026-07-11. Uses PFCG's in-editor Generate (auth-data screen 120 → Generate → confirm name; makes NO auth-tree edits) — supersedes the original SUPC plan per the "record GUI pfcg" instruction; PFCG_NEEDS_RECORDING (exit 3) if btnPROFIL1 isn't locatable on a release |
<SKILL_DIR>/references/sap_pfcg_menu.vbs | GUI | add/remove-tcodes menu flow — NEEDS_RECORDING: the menu-tab add-transaction goes through a GuiShell-toolbar pressButton whose fcode isn't drive-discoverable → needs SAP's built-in recorder (/sap-gui-probe --record, Mode R) |
/sap-su01 (assign/unassign) · /sap-suim (fetch-role diff) · /sap-transport-request (--type customizing) · /sap-run-report (RHAUTUPD_NEW) | sub-skills | Reused assignment writer / before-after diff / Customizing TR / user comparison |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lib.ps1 · sap_attach_lib.vbs (%%ATTACH_LIB_VBS%%) · sap_session_lock.vbs (%%SESSION_LOCK_VBS%%) | libs | RFC + Tier-3 attach + write lock |
<SAP_DEV_CORE_SHARED_DIR>/rules/safety_policy.md + <SAP_DEV_CORE_SHARED_DIR>/scripts/sap_safety_gate.ps1 | Rule 0 | Environment guard — Step 2 runs -Action assert first for every write mode |
Resolve work_dir + {RUN_TEMP} (canonical one-liner — sap_connection_lib.ps1 is dot-sourced
there — with Write-Output ('RUN_TEMP=' + (Get-SapRunTemp)) appended). {RUN_TEMP} = the
per-run scratch dir holding the log state file; mint it once here and reuse (re-minting breaks
the -Action end state-file lookup). Start logging (sap_log_helper.ps1,
state {RUN_TEMP}\sap_pfcg_run.json). Pinned RFC profile; GUI session for create/menu/generate.
show | create | add-tcodes | remove-tcodes | generate | user-compare | assign |
unassign. Uppercase ROLE/TCODES/USERS. Chained flags (--generate --compare) run under ONE
combined confirm gate.
Rule 0 first (safety_policy.md; show skips it):
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_safety_gate.ps1" -Action assert -Skill sap-pfcg —
SAFETY: ALLOW (0) proceed; TYPED_CONFIRM_REQUIRED (3) -> the operator types the shown
PROD <SID>/<CLIENT> token, re-run with -ConfirmationText '<their verbatim answer>', proceed only
on ALLOW_CONFIRMED; REFUSED class=<C> (1) / ERROR (2) -> STOP, end FAILED with
-ErrorClass <C>, relay the remediation lines — never bypass or drive PFCG manually instead. The
Step 4 confirm still applies after an ALLOW/ALLOW_CONFIRMED.
sap_pfcg_verify.ps1 -Mode snapshot gives client modifiability (T000) + role existence: refuse
AUTH_CLIENT_NOT_MODIFIABLE; create on an existing role -> PFCG_ROLE_EXISTS; the others on a
missing role -> AUTH_ROLE_NOT_FOUND. TSTC-validate each add-tcode; BAPI_USER_EXISTENCE_CHECK each
user.
... sap_pfcg_verify.ps1 -Mode snapshot -Role <R> -OutDir "{RUN_TEMP}\pfcg"
PFCG: dossier lines (desc / menu_tcodes / assigned_users / generated_profile / auth_rows /
client modifiability) + role_snapshot_<R>.tsv. show renders this and ENDS. For write modes, also
capture the /sap-suim fetch-role grant-set TSV as the human-facing before-state.
CONFIRM (yes/no; typed role-name when T000 category=P): "I will on role <R> in
<SID>/<CLIENT>: . Proceed?". On no -> SKIPPED. Then:
assign/unassign -> delegate to /sap-su01 assign|unassign <R> <USER> (the reused
BAPI_USER_ACTGROUPS_ASSIGN full-set-replace path: fresh GET_DETAIL + the requested delta ONLY,
abort on RETURN E/A incl. CUA-child, verify AGR_USERS re-read).
create / generate (recorded GUI writes) -> for create, resolve a Customizing TR via
/sap-transport-request --type customizing (single roles are usually client-local, so the driver
tolerates no TR popup; generate needs no TR). Substitute the attach + lock + arg tokens, bake
the resolved session path, and run the driver via 32-bit cscript:
$shared = '<SAP_DEV_CORE_SHARED_DIR>\scripts'
. "$shared\sap_connection_lib.ps1"
# BAKE the path into %%SESSION_PATH%% (attach Strategy 1) rather than exporting
# $env:SAPDEV_SESSION_PATH here: this generator is a SEPARATE process from the one
# that runs cscript, so the env var would already be gone and the attach lib would
# silently fall through to its sole-connection default (2026-08-06).
$sessionPath = Get-SapCurrentSessionPath -WorkTemp '{WORK_TEMP}' # or the --session value
$drv = 'sap_pfcg_create.vbs' # or 'sap_pfcg_generate.vbs'
$vbs = [IO.File]::ReadAllText("<SKILL_DIR>\references\$drv", [Text.Encoding]::UTF8)
$vbs = $vbs.Replace('%%ATTACH_LIB_VBS%%', "$shared\sap_attach_lib.vbs")
$vbs = $vbs.Replace('%%SESSION_LOCK_VBS%%', "$shared\sap_session_lock.vbs")
$vbs = $vbs.Replace('%%SESSION_PATH%%', $sessionPath)
$vbs = $vbs.Replace('%%ROLE_NAME%%', '<ROLE>')
$vbs = $vbs.Replace('%%ROLE_DESC%%', '<short description>') # create only
$vbs = $vbs.Replace('%%TRANSPORT%%', '<customizing-TR>') # create only; empty -> ABORT if PFCG prompts
[IO.File]::WriteAllText('{RUN_TEMP}\pfcg_run.vbs', $vbs, [System.Text.UnicodeEncoding]::new($false, $true))
Declare the GUI target in the SAME block as cscript — the attach lib reads
SAPDEV_EXPECT_SYSTEM/_CLIENT from the process environment, so a role create /
generate can never land on a system other than the one the RFC leg resolved:
. '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'
Set-SapGuiTargetExpectation -WorkTemp '{WORK_TEMP}' | Out-Null
& 'C:\Windows\SysWOW64\cscript.exe' //NoLogo "{RUN_TEMP}\pfcg_run.vbs"
Parse SUCCESS: / ERROR: plus the machine markers — PFCG_NO_AUTH_CREATE: (create; missing
S_USER_AGR activity 01 — verified on S4D/MICHAELLI + S4G/KM717; EC2/DEV102 has it), ABORT_EMPTY_TR:
(create; a TR popup appeared with no %%TRANSPORT%%), PFCG_NEEDS_RECORDING: exit 3 (generate;
btnPROFIL1 not locatable on this release → recapture). generate uses PFCG's in-editor Generate
— it enters the auth-data screen (120) but makes NO auth-value/org-level edits (only Generate +
confirm the proposed profile name + save); this supersedes the original SUPC design per the
"record GUI pfcg" decision.
add-tcodes / remove-tcodes -> sap_pfcg_menu.vbs ships NEEDS_RECORDING: the menu-tab
add-transaction drives a GuiShell-toolbar button (cntlTOOL_CONTROL) whose pressButton function
code is not discoverable by dumping the property tree, so drive-mode cannot capture it. Emit
PFCG_NEEDS_RECORDING and point to /sap-gui-probe --record (SAP's built-in recorder, Mode R) —
a clean abort until the flow is captured with a human operator's click as ground truth.
user-compare -> /sap-run-report RHAUTUPD_NEW role-scoped (or PFCG_TIME_DEPENDENCY for
--all-roles).
Mode-specific RFC re-read via sap_pfcg_verify.ps1: AGR_TCODES before/after diff == the requested
delta EXACTLY (else PFCG_VERIFY_MISMATCH, FAILED, show actual — even if the status bar said S);
generate -> AGR_PROF + auth_rows present (0 -> PFCG_GENERATE_FAILED; org-level warnings ->
GENERATED_WITH_WARNINGS, stated not hidden); assign -> AGR_USERS set == previous ± delta. Render
the /sap-suim before/after diff.
Register-SapArtifact (kinds auth-role-snapshot / auth-role-change / auth-assignment; scope
ROLE_<NAME>; verdict) for /sap-evidence-pack.
Log end. Error classes: AUTH_CLIENT_NOT_MODIFIABLE, PFCG_ROLE_EXISTS, PFCG_VERIFY_MISMATCH,
PFCG_GENERATE_FAILED, PFCG_NEEDS_RECORDING; reused RFC_LOGON_FAILED / GUI_TIMEOUT /
TR_NOT_MODIFIABLE / AUTH_ROLE_NOT_FOUND / AUTH_USER_NOT_FOUND / AUTH_TCODE_NOT_FOUND.
show SAP_BC_BASIS_ADMIN returned the
full dossier — desc "System Administrator", 38 menu tcodes, 0 assigned users, generated profile
T-SD020189, 146 auth rows, client category=T / modifiable=YES; a nonexistent role ->
AUTH_ROLE_NOT_FOUND. EC2 (ECC 6) was probed in-plan (all AGR_* + BAPI_USER_ACTGROUPS_ASSIGN
FMODE=R + PFCG/SUPC programs identical) but unreachable at build time; the RFC legs are one code
path. Build finding: AGR_TIMESTMP does not exist -> generation is verified via AGR_PROF +
AGR_1251 auth-row count, not a timestamp./sap-transport-request --type customizing extension.
Recorded 2026-07-11 (EC2 ERP/800, ECC6 rel 731; S/4 structurally identical — same SAPLPRGN_TREE
control IDs, only the on-screen text differs): create (Role>Create>Role → description → Save;
single roles are client-local so no TR popup fired) and generate (Authorizations tab → in-editor
Generate → confirm the proposed profile name → save). Build finding: role creation needs
S_USER_AGR activity 01 — S4D/MICHAELLI and S4G/KM717 both LACK it (PFCG_NO_AUTH_CREATE), only
EC2/DEV102 has it, so the create/generate legs were recorded there. Design shift: generate now
uses PFCG's in-editor Generate (it enters the auth-data screen but makes NO auth-value/org-level
edits — only Generate + confirm the name + save), superseding the plan's SUPC list flow per the
"record GUI pfcg" instruction. add-tcodes/remove-tcodes stays NEEDS_RECORDING — the
menu-tab add-transaction drives a GuiShell-toolbar button whose pressButton fcode is not
drive-discoverable, so it needs SAP's built-in recorder (/sap-gui-probe --record, Mode R).README.md (opens in a new tab)references/sap_pfcg_create.screens.json (opens in a new tab)references/sap_pfcg_create.vbs (opens in a new tab)references/sap_pfcg_generate.screens.json (opens in a new tab)references/sap_pfcg_generate.vbs (opens in a new tab)references/sap_pfcg_menu.vbs (opens in a new tab)references/sap_pfcg_verify.ps1 (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sap, pfcg, role-management, authorization, sap-gui-automation
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-project40 skills in this plugin
/sap-auth-diagnoseDiagnoses "no authorization" failures deterministically over RFC and proposes the
exact PFCG fix — no more pasting an SU53 screenshot and hand-searching SUIM. Given
the failed authorization object (+ optional field values, read off SU53 / an ST22
dump / an application-log message), it evaluates the target user against the
AUTHORITATIVE runtime user buffer (`SUSR_USER_AUTH_FOR_OBJ_GET`, remote-enabled on
S/4HANA 1909 + ECC 6) with faithful AUTHORITY-CHECK semantics — one authorization
instance must satisfy every field, '*' matches anything, VON..BIS ranges honoured —
so the verdict can never disagree with the real kernel check the way a hand-rolled
AGR_1251/UST12 join can. It then classifies each failure (`MISSING_OBJECT` /
`MISSING_VALUE` / `BUFFER_STALE`) plus user-level `USER_LOCKED` / `USER_EXPIRED` /
`ROLE_EXPIRED`, names the closest role the user already has (with what it currently
grants), and writes a diagnosis TSV + fix-proposal + ready-to-send security request.
Read-only toward roles and users — the fix is always a proposal, never a write.
Prerequisites: SAP profile via /sap-login (RFC); SAP NCo 3.1 (32-bit). su53 (GUI
auto-scrape of the failed objects) and trace (STAUTHTRACE) modes are the documented
next phase — until then the operator supplies the failed object (Claude decodes a
pasted SU53 into the check input).
/sap-auth-requirementsDerives the SAP authorization requirements a custom development actually needs — the
deliverable Z-transactions never hand the security team. derive reads a program/FM source over
RFC, extracts the EXPLICIT AUTHORITY-CHECK surface plus the IMPLICIT one (CALL TRANSACTION ->
S_TCODE, SUBMIT -> S_PROGRAM, OPEN/DELETE DATASET/TRANSFER -> S_DATASET, CALL FUNCTION
DESTINATION -> S_RFC, DDIC table writes -> S_TABU_DIS incl. dynamic MODIFY (var)), traces each
value to its nearest literal, and validates every object/field/activity against the live
catalog (TOBJ / TACTZ) — emitting a required-auth matrix with per-row CONFIRMED / INFERRED
honesty plus an SU24 proposal draft. su24-audit lists Z/Y tcodes against USOBX_C / USOBT_C and
flags the real gap: NO_PROPOSAL / CHECK_DISABLED / ONLY_S_TCODE / PROPOSAL_PRESENT with a
staleness date. Pure RFC + offline extraction (no wrapper FM, no dev-init, runs on a bare
security profile); a static value that cannot be resolved is INFERRED, never silently
CONFIRMED. Class/interface source needs an SE24 GUI download (pass --source-files) or degrades
to COULD_NOT_CHECK. Owns the AUTHREQ_* finding namespace so it never double-reports with
/sap-review-abap's security dimension. v2: su24-maintain / su21-create (confirm-gated GUI).
Prerequisites: pinned /sap-login RFC profile; NCo 3.1 (32-bit).
/sap-bpManages SAP Business Partners via the BP transaction using SAP GUI Scripting.
Creates new partners (Organization type) or updates existing ones.
Existence check, partner creation with role/grouping selection, and
partner update with field values from a definition file.
Prerequisites: Active SAP GUI session (use /sap-login first).
/sap-change-historyAnswers "who changed this object / this data, and when" headlessly over RFC — no more
hand-joining CDHDR/CDPOS in SE16N and decoding cluster rows by eye. Resolves a business
token (PO, customer, vendor, material, sales order, G/L account, cost center …) to its
change-document class, scans CDHDR for the change headers, then pulls the fully DECODED
field-level rows (table · field · old → new, with DDIC field labels) via CHANGEDOCUMENT_READ
through the dev-init RFC wrapper — which sidesteps both the CDPOS 512-byte RFC_READ_TABLE
limit and ECC-6's CDPOS cluster storage in one call. Renders an auditable timeline + an
evidence-grade TSV, and (`--correlate`) time-orders the changes against transport imports
and /sap-diagnose evidence so "TR imported → field changed 5 min later" reads as one story.
Read-only; no writes, no SQL, no GUI. Also does `user <U>` / `window --from/--to` scans and
a `classes` map dump. Prerequisites: pinned RFC profile via /sap-login; the dev-init wrapper
Z_GENERIC_RFC_WRAPPER_TBL (via /sap-dev-init — never deployed by this skill); SAP NCo 3.1 (32-bit).
/sap-config-compareKeyed, row-level RFC diff of ONE customizing table or view across two saved
connection profiles (or two clients of one system) — the shareable answer to
"it works in QAS but not in DEV/PRD". Resolves the object on both sides, computes
the compared-field set (drops the technical client key for client-dependent tables,
excludes unreadable/too-wide columns honestly), guards against an unbounded read,
does a chunked offset-based read of each side, and runs the ONE shared keyed-diff
engine to classify every key LEFT_ONLY / RIGHT_ONLY / CHANGED. Claude then translates
the raw deltas into functional meaning using DDIC texts. Output is a diffable diff.tsv
+ summary, registered for /sap-evidence-pack. Read-only. Prerequisites: two profiles
via /sap-login (pinned LEFT + --against RIGHT); SAP NCo 3.1 (32-bit). No GUI, no
Z-object, no dev-init.
/sap-cutover-runbookTurn a 200-step cutover Excel into a crash-safe, evidence-stamped tracker — the cutover
lead stops doing 3am bookkeeping and answers "are we on the critical path?" instantly.
`init` parses the runbook into a draft ledger behind a mandatory human-curation gate;
`record` stamps start/done/fail events with machine-read RFC evidence (transport import
return code from TPALOG, job status from TBTCO, table row counts) — never a screenshot;
`report` renders the live board with per-phase progress, blockers, and the critical path
over the remaining dependency DAG; `checkpoint --health` composes an advisory go/no-go with
a tri-state system-health snapshot (dumps, update backlog, qRFC/tRFC queues, locks, running
imports). v1 is read-only toward SAP (reads only); `run` auto-execution is v2. Prerequisites:
/sap-login profiles (one per system named in the plan); SAP NCo 3.1 (32-bit). No Z-object,
no dev-init — safe to point at a PRD/QAS cutover target.
Other plugins' skills for the same job