SAP Skills — Cross-Module Capability Lookup
Answers "which module / tcode / BAPI does X?" using local reference data, the routing engine, and module consultant agents. Lookup flow: RAG search → module map → router map → consultant agent.
Runtime root
Before running any relative command below, resolve SAP_ROUTER_ROOT, verify that
scripts/source_catalog.py exists there, and change the working directory to that
repository. Fail closed with a clear configuration error if the variable is missing;
do not assume the user's current project contains the router scripts.
1. RAG Search (first stop)
TF-IDF index built from references/data/ (SAP notes, symptom index, tcodes YAML) plus references/module_maps/.
# Build/rebuild the local index (run once, or after editing references/)
python scripts/rag_ingest.py ingest
# Search for a capability, symptom, note, or tcode
python scripts/rag_ingest.py search --query "goods receipt purchase order" --top 3
python scripts/rag_ingest.py search --query "credit memo billing" --top 5
2. Module Maps (curated per-module reference)
15 files in references/module_maps/ — open the one matching the domain:
| File |
Module |
mm_operations.md |
Materials Management |
sd_operations.md |
Sales & Distribution |
fi_operations.md |
Financial Accounting |
co_operations.md |
Controlling |
pp_operations.md |
Production Planning |
qm_operations.md |
Quality Management |
pm_operations.md |
Plant Maintenance |
wm_operations.md / ewm_operations.md |
Warehouse Mgmt / Extended WM |
tm_operations.md |
Transportation Management |
tr_operations.md |
Treasury |
hcm_onprem_operations.md / hcm_sf_operations.md |
HCM on-prem / SuccessFactors |
bw_operations.md |
Business Warehouse |
basis_operations.md |
Basis / system administration |
3. Router Map (action → execution path)
Once the capability maps to an action ID, ask the router how it executes:
# Route an action through ADT-first / GUI-fallback decision tree
python scripts/sap_router.py route --action MM_CREATE_MATERIAL
python scripts/sap_router.py route --action SD_CREATE_ORDER --functional
# Show GUI tcode / BDC / BAPI alternatives for an action
python scripts/fallback_engine.py map --action MM_CREATE_MATERIAL
# Execute the full 6-tier fallback chain (ADT→RFC→GUI→BDC→Offline→Manual)
python scripts/fallback_engine.py execute --action FI_POST_DOCUMENT --module FI
4. Core Module → Tcode → BAPI Quick Table
| Module |
Core Tcodes |
Core BAPIs |
| MM |
MM01, ME21N, MIGO |
BAPI_MATERIAL_SAVEDATA, BAPI_PO_CREATE1, BAPI_GOODSMVT_CREATE |
| SD |
VA01, VL01N, VF01 |
BAPI_SALESORDER_CREATEFROMDAT2, BAPI_OUTB_DELIVERY_CREATE_SLS, BAPI_BILLINGDOC_CREATEMULTIPLE |
| FI |
FB01, FB03, F110 |
BAPI_ACC_DOCUMENT_POST, BAPI_ACC_DOCUMENT_REV_POST, BAPI_GL_GETACCOUNTSALDO |
| CO |
KS01, KO01, KB21N |
BAPI_COSTCENTER_CREATEMULTIPLE, BAPI_INTERNALORDER_CREATE |
| PP |
CO01, MD02, CS01 |
BAPI_PRODORD_CREATE, BAPI_MATERIAL_BOM_GROUP_CREATE |
| QM |
QA01, QM01, QA32 |
BAPI_INSPLOT_CREATE, BAPI_QUALNOT_CREATE |
| PM |
IW31, IW21, IE01 |
BAPI_ALM_ORDER_MAINTAIN, BAPI_EQUI_CREATE |
| HCM |
PA30, PA20, PT60 |
BAPI_EMPLOYEE_GETDATA, HR_INFOTYPE_OPERATION |
| EWM/WM |
/SCWM/MON, LT01 |
BAPI_WHSE_TO_CREATE_STOCK (WM) / EWM via /SCWM APIs |
| TR |
FF7A, FI12, F110 |
BAPI_ACC_DOCUMENT_POST (bank postings), DMEE for formats |
| BW |
RSA1, RSPC, RSRT |
BAPI_IPAK_START, RSPC_API_CHAIN_START |
5. Delegate to Consultant Agents
When the lookup needs domain judgment, spawn the matching agent via the Agent tool:
- Module-specific:
sap-mm-consultant, sap-sd-consultant, sap-fi-consultant, sap-co-consultant, sap-pp-consultant, sap-qm-consultant, sap-pm-consultant, sap-hcm-consultant, sap-ewm-consultant, sap-tm-consultant, sap-tr-consultant, sap-bw-consultant
- General / unclear module:
sap-tutor (classifier) — it redirects to the right specialist and answers cross-module architecture questions
Rule: route general "how does SAP handle X" questions to sap-tutor; route "configure/troubleshoot X in module Y" to the module consultant.
Pitfalls
- RAG search returns nothing → Cause: index never built or references/ edited since last build. Solution: run
python scripts/rag_ingest.py ingest, then retry the search.
- Action ID unknown to router → Cause: capability phrased as free text, not a mapped action (36 actions mapped). Solution: run
python scripts/fallback_engine.py map --action <GUESS> to see the map, or check the module map file for the canonical action name.
- Wrong module guess for a capability → Cause: overlapping terms (e.g., "invoice" exists in MM, SD, and FI). Solution: disambiguate by document direction — inbound/vendor = MM/FI-AP (MIRO/FB60), outbound/customer = SD/FI-AR (VF01/FB70) — then confirm in the module map.
- BAPI exists but fails in cloud/S4 → Cause: classic BAPI not released for ABAP Cloud. Solution: check released APIs first (see abap-cloud skill); fall back to OData/RAP equivalents.
--module passed to sap_router.py route → Cause: route subcommand has no --module flag. Solution: module context goes to fallback_engine.py execute --module <X>; the router infers module from the action prefix (MM_, SD_, FI_...).
Verification
# Index built and searchable
python scripts/rag_ingest.py search --query "material master" --top 3
# Expect: hits from mm_operations.md and/or tcodes.yaml
# Router resolves a known action
python scripts/sap_router.py route --action MM_CREATE_MATERIAL
# Expect: route decision (arc-1 ADT primary or GUI fallback)
# Fallback map lists tcode/BDC/BAPI alternatives
python scripts/fallback_engine.py map --action MM_CREATE_MATERIAL
Related
- sap-router-skill — master orchestrator; this skill feeds its routing decisions
- run-sap-router-skill — smoke-testing the CLI scripts used here
- abap-code-patterns / sap-bapi-integration — implementing the BAPI once identified
- abap-cloud — released-API check before using a classic BAPI in cloud context
references/module_maps/*.md, references/data/{sap-notes,symptom-index,tcodes}.yaml — the underlying data
1---2name: sap-skills3description: General SAP skills repository reference (secondsky/sap-skills). Use for cross-module SAP capability lookup and reference patterns.4---56# SAP Skills — Cross-Module Capability Lookup78Answers "which module / tcode / BAPI does X?" using local reference data, the routing engine, and module consultant agents. Lookup flow: **RAG search → module map → router map → consultant agent**.910## Runtime root1112Before running any relative command below, resolve `SAP_ROUTER_ROOT`, verify that13`scripts/source_catalog.py` exists there, and change the working directory to that14repository. Fail closed with a clear configuration error if the variable is missing;15do not assume the user's current project contains the router scripts.1617## 1. RAG Search (first stop)1819TF-IDF index built from `references/data/` (SAP notes, symptom index, tcodes YAML) plus `references/module_maps/`.2021```bash22# Build/rebuild the local index (run once, or after editing references/)23python scripts/rag_ingest.py ingest2425# Search for a capability, symptom, note, or tcode26python scripts/rag_ingest.py search --query "goods receipt purchase order" --top 327python scripts/rag_ingest.py search --query "credit memo billing" --top 528```2930## 2. Module Maps (curated per-module reference)313215 files in `references/module_maps/` — open the one matching the domain:3334| File | Module |35|---|---|36| `mm_operations.md` | Materials Management |37| `sd_operations.md` | Sales & Distribution |38| `fi_operations.md` | Financial Accounting |39| `co_operations.md` | Controlling |40| `pp_operations.md` | Production Planning |41| `qm_operations.md` | Quality Management |42| `pm_operations.md` | Plant Maintenance |43| `wm_operations.md` / `ewm_operations.md` | Warehouse Mgmt / Extended WM |44| `tm_operations.md` | Transportation Management |45| `tr_operations.md` | Treasury |46| `hcm_onprem_operations.md` / `hcm_sf_operations.md` | HCM on-prem / SuccessFactors |47| `bw_operations.md` | Business Warehouse |48| `basis_operations.md` | Basis / system administration |4950## 3. Router Map (action → execution path)5152Once the capability maps to an action ID, ask the router how it executes:5354```bash55# Route an action through ADT-first / GUI-fallback decision tree56python scripts/sap_router.py route --action MM_CREATE_MATERIAL57python scripts/sap_router.py route --action SD_CREATE_ORDER --functional5859# Show GUI tcode / BDC / BAPI alternatives for an action60python scripts/fallback_engine.py map --action MM_CREATE_MATERIAL6162# Execute the full 6-tier fallback chain (ADT→RFC→GUI→BDC→Offline→Manual)63python scripts/fallback_engine.py execute --action FI_POST_DOCUMENT --module FI64```6566## 4. Core Module → Tcode → BAPI Quick Table6768| Module | Core Tcodes | Core BAPIs |69|---|---|---|70| MM | MM01, ME21N, MIGO | BAPI_MATERIAL_SAVEDATA, BAPI_PO_CREATE1, BAPI_GOODSMVT_CREATE |71| SD | VA01, VL01N, VF01 | BAPI_SALESORDER_CREATEFROMDAT2, BAPI_OUTB_DELIVERY_CREATE_SLS, BAPI_BILLINGDOC_CREATEMULTIPLE |72| FI | FB01, FB03, F110 | BAPI_ACC_DOCUMENT_POST, BAPI_ACC_DOCUMENT_REV_POST, BAPI_GL_GETACCOUNTSALDO |73| CO | KS01, KO01, KB21N | BAPI_COSTCENTER_CREATEMULTIPLE, BAPI_INTERNALORDER_CREATE |74| PP | CO01, MD02, CS01 | BAPI_PRODORD_CREATE, BAPI_MATERIAL_BOM_GROUP_CREATE |75| QM | QA01, QM01, QA32 | BAPI_INSPLOT_CREATE, BAPI_QUALNOT_CREATE |76| PM | IW31, IW21, IE01 | BAPI_ALM_ORDER_MAINTAIN, BAPI_EQUI_CREATE |77| HCM | PA30, PA20, PT60 | BAPI_EMPLOYEE_GETDATA, HR_INFOTYPE_OPERATION |78| EWM/WM | /SCWM/MON, LT01 | BAPI_WHSE_TO_CREATE_STOCK (WM) / EWM via /SCWM APIs |79| TR | FF7A, FI12, F110 | BAPI_ACC_DOCUMENT_POST (bank postings), DMEE for formats |80| BW | RSA1, RSPC, RSRT | BAPI_IPAK_START, RSPC_API_CHAIN_START |8182## 5. Delegate to Consultant Agents8384When the lookup needs domain judgment, spawn the matching agent via the Agent tool:8586- Module-specific: `sap-mm-consultant`, `sap-sd-consultant`, `sap-fi-consultant`, `sap-co-consultant`, `sap-pp-consultant`, `sap-qm-consultant`, `sap-pm-consultant`, `sap-hcm-consultant`, `sap-ewm-consultant`, `sap-tm-consultant`, `sap-tr-consultant`, `sap-bw-consultant`87- General / unclear module: `sap-tutor` (classifier) — it redirects to the right specialist and answers cross-module architecture questions8889Rule: route general "how does SAP handle X" questions to `sap-tutor`; route "configure/troubleshoot X in module Y" to the module consultant.9091## Pitfalls9293- **RAG search returns nothing** → Cause: index never built or references/ edited since last build. Solution: run `python scripts/rag_ingest.py ingest`, then retry the search.94- **Action ID unknown to router** → Cause: capability phrased as free text, not a mapped action (36 actions mapped). Solution: run `python scripts/fallback_engine.py map --action <GUESS>` to see the map, or check the module map file for the canonical action name.95- **Wrong module guess for a capability** → Cause: overlapping terms (e.g., "invoice" exists in MM, SD, and FI). Solution: disambiguate by document direction — inbound/vendor = MM/FI-AP (MIRO/FB60), outbound/customer = SD/FI-AR (VF01/FB70) — then confirm in the module map.96- **BAPI exists but fails in cloud/S4** → Cause: classic BAPI not released for ABAP Cloud. Solution: check released APIs first (see abap-cloud skill); fall back to OData/RAP equivalents.97- **`--module` passed to `sap_router.py route`** → Cause: route subcommand has no `--module` flag. Solution: module context goes to `fallback_engine.py execute --module <X>`; the router infers module from the action prefix (MM_, SD_, FI_...).9899## Verification100101```bash102# Index built and searchable103python scripts/rag_ingest.py search --query "material master" --top 3104# Expect: hits from mm_operations.md and/or tcodes.yaml105106# Router resolves a known action107python scripts/sap_router.py route --action MM_CREATE_MATERIAL108# Expect: route decision (arc-1 ADT primary or GUI fallback)109110# Fallback map lists tcode/BDC/BAPI alternatives111python scripts/fallback_engine.py map --action MM_CREATE_MATERIAL112```113114## Related115116- **sap-router-skill** — master orchestrator; this skill feeds its routing decisions117- **run-sap-router-skill** — smoke-testing the CLI scripts used here118- **abap-code-patterns / sap-bapi-integration** — implementing the BAPI once identified119- **abap-cloud** — released-API check before using a classic BAPI in cloud context120- `references/module_maps/*.md`, `references/data/{sap-notes,symptom-index,tcodes}.yaml` — the underlying data