/sap-gen-code:sap-gen-idoc-handler generate <mapping.tsv> --idoctype <BASICTYPE> [--message-type <MESTYP>] [--fm-name Z_IDOC_INPUT_X] [--fugr FG] [--bapi BAPI] [--deploy ask|yes|no] | verify-wiring <FM> --idoctype <BT> --message-type <MT> [--process-code PC] [--partner P --partner-type LS|KU|LI]from sap-gen-code
Generates correct inbound IDoc processing function modules for SAP ECC/S4 from segment metadata and mapping specs, with ABAP Unit tests and wiring 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 a correct inbound IDoc handler FM (+ seeded ABAP Unit test) from IDoc-type metadata and a mapping spec, deploy it behind a confirm gate through the workbench skills, and check its WE57/BD51/WE42 wiring — read-only until the gated deploy, and never auto-writing the SAP-standard config tables.
Task: $ARGUMENTS
The metadata read + wiring check are scripts; you fill the golden template (references/ idoc_inbound_handler_template.abap) + test template from the segment tree and mapping spec.
| File | Token / call | Purpose |
|---|---|---|
<SKILL_DIR>/references/sap_idoc_type_read.ps1 | -IdocType <BT> | Segment-tree metadata (IDOCTYPE_READ_COMPLETE) |
<SKILL_DIR>/references/sap_idoc_wiring_check.ps1 | -FmName ... | verify-wiring RFC read (EDIFCT/TBD51/TEDE2/EDP21) |
<SKILL_DIR>/references/idoc_inbound_handler_template.abap | template | Golden handler (fixed signature + protocol) |
<SKILL_DIR>/references/idoc_inbound_test_template.abap | template | Seeded ABAP Unit test |
<SKILL_DIR>/references/idoc_mapping_template.tsv | template | Mapping-spec input shape |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lookup_struct.ps1 · sap_rfc_lookup_fm.ps1 | shared | segment struct + BAPI signature |
/sap-check-abap · /sap-function-group · /sap-se37 · /sap-se38 · /sap-run-abap-unit | sub-skills | gate + gated deploy + test |
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))"
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_gen_idoc_handler_run.json" -Skill sap-gen-idoc-handler -ParamsJson "{}"
Modes: generate | verify-wiring. Validate FM/report names via sap_check_object_name.ps1. Load
the mapping spec; unknown rule token or missing target -> IDOC_MAPPING_INVALID (fail loud).
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_idoc_wiring_check.ps1" -FmName <FM> -IdocType <BT> -MessageType <MT> [-ProcessCode <PC>] [-Partner <P> -PartnerType <LS|KU|LI>] -SharedDir "<SAP_DEV_CORE_SHARED_DIR>"
Render the WIRING: lines + VERDICT: (WIRED / PARTIAL / UNWIRED / COULD_NOT_CHECK). A read that
errors is COULD_NOT_CHECK, never a false PRESENT. Done.
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_idoc_type_read.ps1" -IdocType <BT> [-CimType <EXT>] -OutFile "{RUN_TEMP}\<name>_idoc_segments.tsv" -SharedDir "<SAP_DEV_CORE_SHARED_DIR>"
IDOC_TYPE_NOT_FOUND -> abort. Cross-check every mapping-spec segment against the tree — a spec
segment not in the tree is a HARD error naming the segment (never silently generate a bad decode).
sap_rfc_lookup_struct.ps1 on each mapped SEGMENTTYP (they are plain DDIC structures) + sap_rfc_lookup_fm.ps1
on --bapi; sap_error_hints.ps1 -Action resolve for trap hints (frequently_errors loop).
Fill idoc_inbound_handler_template.abap -> <name>_handler.abap (per-mapping WHEN '<SEG>' decode
blocks, the BAPI call from the mapped fields, MSG_CLASS from the customer brief; release ABAP level per
the brief for an ECC target) and idoc_inbound_test_template.abap -> <name>_test.abap (canned EDIDD
from sample_value). Write <name>_wiring_instructions.md (numbered WE57/BD51/WE42/WE20 steps).
/sap-check-abap on both sources; loop fixes until clean.
--deploy no/silence -> SKIPPED (sources stay local). yes (or an explicit confirm to the ask
prompt listing FM / FG / test report / target system) -> /sap-function-group (ensure) -> /sap-se37
(FM) -> /sap-se38 (test report); TRs resolve inside those skills. Then /sap-run-abap-unit Z<FM_STEM>_TEST and report per-method pass/fail.
Print the wiring instructions and run sap_idoc_wiring_check.ps1 (read-only) — expected mostly MISSING
on a fresh FM (that IS the operator TODO list). NEVER auto-write EDIFCT/TBD51/TEDE2/EDP21 (Rule 1:
SAP-standard config tables; /sap-update-addon is Y/Z-only).
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_gen_idoc_handler_run.json" -Status SUCCESS -ExitCode 0
Classes: IDOC_TYPE_NOT_FOUND, IDOC_MAPPING_INVALID, IDOC_WIRING_INCOMPLETE, RFC_LOGON_FAILED,
AUNIT_* (from the delegated test).
generate (metadata -> golden-template fill -> offline check -> gated deploy ->
ABAP Unit -> wiring instructions) and verify-wiring (read-only EDIFCT/TBD51/TEDE2/EDP21 check).sap_idoc_type_read.ps1 read MATMAS05 -> 28 segments,
7 mandatory (E1MARAM must/max1, E1MAKTM must/max99, ...) with an honest IDOC_TYPE_NOT_FOUND on a
fake type. sap_idoc_wiring_check.ps1 correctly returns UNWIRED for a fake FM (all MISSING) and
detects a real inbound FM's TBD51 registration — with the @($null).Count==1 trap fixed so an
errored read is COULD_NOT_CHECK, never a false PRESENT. (On S/4 1909, classic MATMAS inbound is
BAPI-ALE via BOR BUS1001006, so IDOC_INPUT_MATMAS01 is legitimately EDIFCT-MISSING there — the
checker reflects that honestly rather than inventing a match.) The golden handler + test templates
encode the packet loop + 53/51 protocol + BAL + RETURN_VARIABLES once, correctly.generate --outbound (v2); automated wire (v2 — needs a writable API for EDIFCT/TEDE2,
open question); CIMTYP extension test (needs a live extension type); end-to-end IDoc inject test via
/sap-idoc's v1.5 inbound leg (v1 verification = ABAP Unit). ECC 6 shares the identical read path (all
22 objects probed identical); EC2 was unavailable this session for the ECC re-confirm.README.md (opens in a new tab)references/idoc_inbound_handler_template.abap (opens in a new tab)references/idoc_inbound_test_template.abap (opens in a new tab)references/idoc_mapping_template.tsv (opens in a new tab)references/sap_idoc_type_read.ps1 (opens in a new tab)references/sap_idoc_wiring_check.ps1 (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sap-idoc, abap, function-module, idoc-processing, sap-integration
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.