SA

shrek-abaper/sap-functional-skill

Developer tools
13 stars Quality 58 Trend 28MIT

A growing collection of SAP business-domain AI skills — field-tested SAP expertise distilled into reusable SKILL packages (knowledge + execution) for AI agents.

Overview

Three skills today: a passive knowledge base spanning 14 modules that auto-triggers on any SAP topic; an active execution skill that creates STO transfer orders through the S/4HANA OData API — with a mandatory preview-before-create safety gate; and a read-only execution skill that queries book stock, MD04 supply/demand and goods movements through the REST2RFC gateway — whitelisted BAPIs plus a guarded table-read fallback. Standard SKILL format: Claude Code, OpenCode, and any compatible agent framework load them as-is. Years of SAP consulting work leaves behind something valuable: the hard-won judgment that accumulates from actual incidents on the ground — insights that live outside the standard documentation and only come from being there. Those notes have migrated through tools over the years: tree notes, then , then a more structured workspace. Each migration was a refinement. But static documents don't help when you're mid-conversation with an AI agent.

README


Background

Years of SAP consulting work leaves behind something valuable: the hard-won judgment that accumulates from actual incidents on the ground — insights that live outside the standard documentation and only come from being there.

Those notes have migrated through tools over the years: Mybase tree notes, then OneNote, then a more structured Notion workspace. Each migration was a refinement. But static documents don’t help when you’re mid-conversation with an AI agent.

Now that AI coding agents are a daily tool, it makes more sense to restructure this accumulated knowledge into the SKILL format — so every record can be loaded, indexed, and referenced at the right moment in the next conversation, and shared with others working in the same SAP trenches.

That’s the origin of SAP Functional Skill: starting from first-hand SAP field experience (sap-trench-skill), and expanding into a growing collection of skills covering SAP business domains.


What’s Inside

sap-functional-skill is a collection of SAP business-domain AI skill packages following the standard SKILL specification, compatible with any AI agent framework that supports the format (including Claude Code, OpenCode, and other compatible frameworks).

The collection currently contains three skills — one knowledge skill and two execution skills:

Skill Type Description
sap-trench-skill Knowledge Passive — auto-triggers on any SAP question. 14 reference files covering all major modules.
sap-sto-create Execution (write) Active — creates STO transfer orders via S/4HANA OData API. Python + Java/JCo. Preview-before-create gate.
sap-stock-availability Execution (read-only) Active — queries book stock, MD04 supply/demand and goods movements via the REST2RFC gateway. Whitelisted BAPIs plus a guarded table-read fallback. Python.

The repository also ships cross-project reference documentation under docs/, independent of any single skill:

Document Description
docs/authentication/ Authentication playbook for SAP↔AI integration (CLI / MCP / OData): decision tree, detailed pros/cons and step-by-step implementation for Basic, SPNEGO, X.509, OIDC/OAuth2, edge-gateway and client patterns.

sap-trench-skill

A reference knowledge base distilled from real SAP project delivery across all major modules. Auto-triggers in AI conversation whenever an SAP topic is detected — no manual invocation required.

Coverage

Module File Focus
ABAP Development references/abap.md Syntax, performance tuning, BAdI/Enhancement Spot, debug tools
MM (Procurement & Inventory) references/mm.md Purchase orders, STO plant-to-plant transfer, account determination, message control
SD (Sales & Distribution) references/sd.md Sales orders, pricing, delivery, billing, credit management, ATP/MTO
FI/CO (Finance) references/fico.md Document posting, exchange rates, document splitting, COPA, substitution, auto payment
PP (Production Planning) references/pp.md Production orders, BOM, routing, MRP, configurable BOM
WM (Warehouse Management) references/wm.md Transfer orders, transfer requirements, bin management, physical inventory
PM (Plant Maintenance) references/pm.md Equipment, functional location, maintenance orders, maintenance plans, serial numbers
QM (Quality Management) references/qm.md Inspection lots, usage decisions, quality notifications, inspection plans
VMS (Vehicle Management) references/vms.md IS-AUTO VELO objects, IDoc enhancements, SPRO configuration
System Integration references/integration.md PI/PO, IDoc, Proxy, OData, XML/JSON troubleshooting
Authorization references/auth.md AUTHORITY-CHECK, roles, SU53, authorization objects
Print references/print.md SmartForms, SAPscript, NACE message control
T-code Reference references/reference-tables.md Full-module T-code, key table, BAPI index
Troubleshooting Case Library references/troubleshooting.md CASE-001 ~ CASE-015, complete root-cause analysis

Typical Trigger Examples

  • “MIGO posting fails with ‘Serial number already exists’ — how to fix?”
  • “PR00 condition type missing in SD pricing procedure — root cause?”
  • “IDoc status 51 troubleshooting flow”
  • “ABAP BAdI implementation steps”

sap-sto-create

An execution skill that creates STO (Stock Transfer Order) transfer orders in S/4HANA via the standard OData service API_PURCHASEORDER_PROCESS_SRV. When the issuing plant is an after-sales plant, it automatically attempts to create an outbound delivery via SAP JCo (BAPI_OUTB_DELIVERY_CREATE_STO).

Key design: enforces a mandatory two-step gate — preview (dry run) before create — to prevent accidental order creation.

Tech Stack

  • Python — CLI entry point and OData orchestration
  • Java / SAP JCo — outbound delivery creation via RFC/BAPI
  • S/4HANA OData — API_PURCHASEORDER_PROCESS_SRV

Quick Start

# List available plant combinations
python3 scripts/sap_sto_cli.py plants

# Preview (dry run — always run this first)
python3 scripts/sap_sto_cli.py preview \
  --supply-plant P002 \
  --receiving-plant A002 \
  --material MAT-001:3 \
  --delivery-date 2026-05-30 \
  --batch-number BATCH001

# Create (requires --confirmed safety flag)
python3 scripts/sap_sto_cli.py create \
  --supply-plant P002 \
  --receiving-plant A002 \
  --material MAT-001:3 \
  --delivery-date 2026-05-30 \
  --batch-number BATCH001 \
  --confirmed

See skills/sap-sto-create/README.md for full setup, environment configuration, and JCo library placement.


sap-stock-availability

A read-only execution skill for stock and material availability queries through the REST2RFC dynamic gateway — no local server, no resident process, no MCP server. It answers: book stock per storage location / batch, MD04 supply-demand snapshot, recent goods movement details, and material-number disambiguation. Every call is read-only.

Key design:

  • Four-layer read-only gate — gateway registry (ZTIF_GENERAL_CON), personal SAP account with read authorizations, CLI contracts (mandatory filters, row caps, stable exit codes), and a local function whitelist (catalog.json).
  • Guarded fallback — when no whitelisted BAPI can answer, RFC_READ_TABLE is allowed only against a fixed stock-domain table allowlist (MARD/MCHB/MARC/MARM/MSKA/MKOL/MSKU), with explicit FIELDS, mandatory key filters (MATNR/WERKS), a 100-row cap, and 72-char WHERE lines.
  • Zero credential footprint — gateway host/client/user live in connection.json (git-ignored; template shipped as connection.example.json); the password is stored only in the OS keystore via getpass.

Quick Start

cd skills/sap-stock-availability
cp connection.example.json connection.json   # fill host / client / user
python3 scripts/sap_stock.py credentials set  # password goes to the OS keystore
python3 scripts/sap_stock.py doctor

See skills/sap-stock-availability/README.md and references/direct-table-reads.md for the fallback contract and S/4HANA material-number formatting pitfalls.


Installation

git clone https://github.com/shrek-abaper/sap-functional-skill.git

# Install the knowledge skill
cp -r sap-functional-skill/skills/sap-trench-skill ~/.agents/skills/

# Install the STO creation skill
cp -r sap-functional-skill/skills/sap-sto-create ~/.agents/skills/

# Install the read-only stock query skill
cp -r sap-functional-skill/skills/sap-stock-availability ~/.agents/skills/

Claude Code discovers and loads skills automatically at conversation startup.


Project Structure

sap-functional-skill/
├── docs/
│   └── authentication/          # Cross-project auth playbook (README + 7 guides)
└── skills/
    ├── sap-trench-skill/          # Knowledge skill — SAP field troubleshooting
    │   ├── SKILL.md               # Trigger layer (routing table + keywords)
    │   ├── README.md
    │   ├── CONTRIBUTING.md
    │   ├── evals/
    │   │   └── golden-set.yaml    # 7 Q&A eval cases
    │   └── references/            # 14 knowledge files
    │       ├── abap.md
    │       ├── auth.md
    │       ├── fico.md
    │       ├── integration.md
    │       ├── mm.md
    │       ├── pm.md
    │       ├── pp.md
    │       ├── print.md
    │       ├── qm.md
    │       ├── reference-tables.md
    │       ├── sd.md
    │       ├── troubleshooting.md
    │       ├── vms.md
    │       └── wm.md
    ├── sap-sto-create/            # Execution skill (write) — STO creation via OData
    │   ├── SKILL.md               # Trigger layer + tool routing
    │   ├── README.md
    │   ├── .env.example           # Environment config template
    │   ├── evals/
    │   │   └── evals.json
    │   └── scripts/
    │       ├── sap_sto_cli.py     # CLI entry point
    │       ├── requirements.txt
    │       └── lib/
    │           ├── create_sto_odata.py   # Core OData logic
    │           └── java/
    │               ├── SapDeliveryCreator.java
    │               ├── sapjco3.jar
    │               └── lib/              # Platform-specific JCo native libs
    │                   ├── linux/
    │                   ├── macos/
    │                   └── windows/
    └── sap-stock-availability/    # Execution skill (read-only) — stock & ATP queries
        ├── SKILL.md               # Trigger layer + scenario routing
        ├── README.md
        ├── catalog.json           # Function whitelist + fallback table allowlist
        ├── connection.example.json # Connection template (real one is git-ignored)
        ├── scripts/
        │   ├── sap_stock.py       # CLI: doctor / credentials / describe / call
        │   ├── sap_credentials.py # OS keystore layer
        │   └── rest2rfc_meta.py   # Vendored gateway metadata client
        └── references/
            ├── direct-table-reads.md
            └── payloads/          # Verified request/response examples

Contributing

Contributions of real SAP field experience are welcome. See CONTRIBUTING.md for the knowledge card format.

Every knowledge card follows a fixed structure: Phenomenon → Root Cause → Solution → Experience Summary — ensuring AI agents can accurately parse and reference the content.


Compatible Platforms

All skills follow the standard SKILL specification and are compatible with any supporting framework:


License

MIT — Knowledge should flow, not sleep.

View the full README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add shrek-abaper/sap-functional-skill
New to MCP? Start with the mcpskill.org guide →