Skip to content
Development
Skill

/sap-gen-idoc-handler

Generates a CORRECT inbound IDoc processing function module from two machine-readable inputs — the IDoc type's segment metadata (IDOCTYPE_READ_COMPLETE) and a field-mapping spec — plus a golden template that encodes the trap-rich protocol once: the fixed

From plugin
sap-dev
8123 skills3 agents
Install
$ npx -y skills add sapdev-ai/sap-dev --skill sap-gen-idoc-handler --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/sap-gen-idoc-handler

Context preview

The summary Claude sees to decide when to auto-load this skill.

Generates a CORRECT inbound IDoc processing function module from two machine-readable inputs — the IDoc type's segment metadata (IDOCTYPE_READ_COMPLETE) and a field-mapping spec — plus a golden template that encodes the trap-rich protocol once: the fixed

SKILL.md

sap-gen-idoc-handler.SKILL.md
name: sap-gen-idoc-handler
description: |
  Generates a CORRECT inbound IDoc processing function module from two machine-readable inputs — the
  IDoc type's segment metadata (IDOCTYPE_READ_COMPLETE) and a field-mapping spec — plus a golden
  template that encodes the trap-rich protocol once: the fixed EDIDC/EDIDD/BDIDOCSTAT/BDWFRETVAR
  signature WE57 demands, the per-DOCNUM packet loop (the classic mass-processing junior trap), typed
  segment decode, the 53(ok)/51(error) status-record-per-IDoc protocol, RETURN_VARIABLES, and BAL
  application-log hooks — with a seeded ABAP Unit test that proves status 53 on the happy path BEFORE
  anything is wired. generate is read-only through generation (metadata read + offline template fill +
  offline /sap-check-abap) then a Rule-2-gated deploy delegated to /sap-function-group + /sap-se37 +
  /sap-se38, verified by /sap-run-abap-unit; the WE57/BD51/WE42/WE20 wiring is emitted as numbered
  operator instructions (NEVER auto-written — those are SAP-standard config tables). verify-wiring is a
  read-only RFC check of EDIFCT/TBD51/TEDE2/EDP21 that reports PRESENT/MISSING/COULD_NOT_CHECK per
  expected row + a WIRED/PARTIAL/UNWIRED verdict. One golden template serves ECC 6 and S/4 (release ABAP
  level from the customer brief). No new Z helper objects (the generated FM is the deliverable).
  Prerequisites: pinned RFC profile via /sap-login; NCo 3.1 (32-bit); a GUI session only for deploy.
argument-hint: "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]"

SAP Generate IDoc Handler Skill

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.

---

Shared Resources

| 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 |

---

Step 0 — Resolve Work Directory

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))"

Step 0.5 — Start Logging

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 "{}"

Step 1 — Parse Arguments + Validate Spec

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).

Step 2 — verify-wiring (read-only)

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.

Step 3 — generate: metadata

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).

Step 4 — Resolve structures + BAPI signature

`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).

Step 5 — Generate (offline, you)

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).

Step 6 — Offline gate

`/sap-check-abap` on both sources; loop fixes until clean.

Step 7 — Deploy (Rule-2 confirm gate)

`--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` (e

Read more
Ships withsap-dev

SAP development automation skills for AI coding assistants. Windows-only — the skills drive SAP GUI for Windows via GUI Scripting (plus optional RFC via SAP NCo); there is no macOS/Linux path.

Get the whole plugin

Other skills on sap-dev.