Claude Skill

sap-integration-wiki

Use when integrating external systems (Java, Python, .NET, Node.js, low-code) with SAP (ECC 6.0, S/4HANA On-Prem/Cloud): OData V2/V4, RFC/JCo, SOAP RFC, dynamic REST2RFC/JSON without JCo, IDoc/PI-PO, BAPI, RAP, BTP Integration Suite/iFlow, Event Mesh, Cloud Connector, Communicati

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download shrek-abaper-sap-watt-skills_sap-integration-wiki-d5ccd30.zip · 192 KB

Install

skills CLI npx skills add https://github.com/shrek-abaper/sap-watt/tree/main/skills/sap-integration-wiki
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install shrek-abaper-sap-watt@llmmart
Git git clone https://github.com/shrek-abaper/sap-watt.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole shrek-abaper/sap-watt collection as a plugin from our marketplace. Git is the plain clone.

README

SAP Integration Wiki

This skill needs no CLI — it works fully offline. Compatible legacy CLI range: >=1.5.0,<2.0.0. Preferred new entry: Watt (sap-watt), range >=1.6.7,<2.0.0. Existing sap-adt examples remain valid; use the installed entry consistently. Install/readiness guide: references/setup.md.

A skill that turns any AI assistant into a SAP integration specialist. Built for developers who need to connect external systems to SAP — without reading 10,000 pages of SAP documentation.

License: MIT Contributions Welcome SAP Versions

English | 中文

Important

This repository has been archived and is no longer updated. sap-integration-wiki is now maintained exclusively in the sap-watt monorepo at skills/sap-integration-wiki. Please go there for the latest version, issues, and improvements.


What Is This?

sap-integration-wiki is a composable skill — a structured knowledge base following the standard skill specification (SKILL.md). Once installed into your AI agent framework, any AI assistant can load the right reference documents and provide precise, actionable answers backed by real SAP API documentation.

Without this skill, an AI assistant gives generic, often-wrong answers about SAP:

"You can use the SAP RFC API to create a purchase order."

With this skill, the AI gives production-ready guidance:

"For S/4HANA On-Premise, use OData V2 API_PURCHASEORDER_PROCESS_SRV with a deep insert POST to create the PO header + items in one request. Here's the exact payload structure with account assignment, and here's the CSRF token flow you need to implement first..."


Covered Scenarios

Business Scenarios

Domain Scenarios
MM — Purchasing Create PO, read PO status, update quantity/price, supplier EDI acknowledgement
MM — Inventory Query stock by plant/storage location, post goods issue/receipt, create reservation
SD — Sales Create sales order, track delivery status, read billing documents
FI — Finance Post GL document, read FI documents, account determination
FI — AR / AP Query open items, payment terms, supplier invoice create, AP/AR posting, down payments, document parking
FI — Asset Accounting Read asset register, post acquisition / retirement / write-off / transfer, OData V4 for S/4HANA Cloud
FI — FSSC Financial Shared Service Center: Kingdee↔SAP patterns (Direct API / BTP-mediated / CFIN), API catalog, master data mapping
Master Data Material master read/create, Business Partner (Customer/Vendor), Cost Center
PP — Production Production orders, BOM read, goods movements (261/101), order confirmation, MRP

Integration Technologies

Technology Coverage
OData V2 / V4 CSRF flow, $expand/$filter/$batch, deep insert, error parsing
RFC / SAP JCo Connection pool, BAPI call pattern, RETURN table parsing, load balancing
SOAP over HTTP RFC Call any RFC-FM via HTTPS without JCo — Python/Node/curl examples, CSRF flow, response parsing
Dynamic REST2RFC Gateway Expose registered RFC/BAPIs as JSON through a pure-ABAP gateway — configuration-driven routing, transaction boundaries, security and limitations (public project)
IDoc / PI-PO Control record, key segments, status lifecycle, monitoring transactions
BAPI & RAP When to use which, key BAPIs by domain, RAP OData V4 services
Authentication Basic Auth, OAuth2 (on-premise SOAUTH2 + Cloud), SSL/TLS, ICF activation
BTP Integration Suite iFlow, Cloud Connector, API Management, Event Mesh, Communication Arrangements
Best Practices Idempotency, retry logic, connection management, security hardening, monitoring

Installation

This skill follows the standard skill specification with SKILL.md metadata. Installation steps vary by your AI agent framework:

Example: Claude Code

# Symlink into Claude Code skills directory
ln -s /path/to/sap-integration-wiki ~/.agents/skills/sap-integration-wiki

Example: OpenAI Custom Instructions / System Prompt

Add this to your agent context:

When answering SAP integration questions, load the knowledge base from:
- /path/to/sap-integration-wiki/SKILL.md (routing logic)
- /path/to/sap-integration-wiki/references/scenarios/*.md (business scenarios)
- /path/to/sap-integration-wiki/references/tech/*.md (technical guides)
- /path/to/sap-integration-wiki/references/troubleshoot/*.md (error solutions)

Example: LangChain / RAG Integration

from langchain.document_loaders import DirectoryLoader, UnstructuredMarkdownLoader

loader = DirectoryLoader(
    '/path/to/sap-integration-wiki',
    glob='**/*.md',
    loader_cls=UnstructuredMarkdownLoader,
    loader_kwargs={'mode': 'elements'}
)

documents = loader.load()
# Then build your vector store or retrieval chain

Verification

The skill should load automatically via SKILL.md metadata. Update your agent's skill scan paths to include this directory.


Quick Start

Once installed, ask your AI assistant about SAP integration:

Example prompts (language-agnostic):

How do I create a purchase order in SAP S/4HANA from Python?
I'm getting HTTP 403 CSRF token validation failed from SAP OData. What's wrong?
What's the difference between using BAPI_PO_CREATE1 and the OData API for ECC?
How do I read stock levels from SAP in real time?

The skill automatically:

  1. Identifies your SAP version and integration scenario
  2. Loads the relevant reference documents from references/
  3. Provides working code examples in your language (Java, Python, curl, etc.)
  4. Flags common pitfalls specific to your situation

Unusual requirement: "The skill loads automatically for all AI assistants — just asking works."


Directory Structure

sap-integration-wiki/
├── SKILL.md                          ← AI routing logic and decision tree
├── README.md                         ← This file (English)
├── README.zh-CN.md                   ← Chinese version
├── CONTRIBUTING.md                   ← Contribution guide
│
├── references/
│   ├── scenarios/                    ← What to do (business-oriented)
│   │   ├── mm-po.md                  Purchase Order integration
│   │   ├── mm-stock.md               Inventory/Stock integration
│   │   ├── sd-order.md               Sales Order integration
│   │   ├── fi-doc.md                 Financial Document integration (GL posting)
│   │   ├── fi-ar-ap.md               AR/AP open items, invoices, payments
│   │   ├── fi-asset.md               Fixed Asset accounting (acquisition, retirement, transfer)
│   │   ├── fi-fssc.md                Financial Shared Service Center (Kingdee↔SAP, CFIN)
│   │   ├── master-data.md            Material Master, Business Partner
│   │   └── pp-production.md          Production Orders, BOM, Goods Movements, MRP
│   │
│   ├── tech/                         ← How to do it (technology-oriented)
│   │   ├── odata.md                  OData V2/V4 protocol guide
│   │   ├── rfc-jco.md                RFC/JCo connection and BAPI guide
│   │   ├── soap-rfc-http.md          SOAP over HTTP RFC — no JCo required
│   │   ├── rest2rfc-gateway.md       Dynamic RFC/BAPI to HTTP/JSON gateway
│   │   ├── idoc-pi.md                IDoc and SAP PI/PO guide
│   │   ├── bapi-rap.md               BAPI vs RAP decision guide
│   │   ├── auth.md                   Authentication setup guide
│   │   ├── btp-cloud-integration.md  BTP Integration Suite guide
│   │   └── best-practices.md         Security, retry, monitoring, testing
│   │
│   ├── setup.md                      ← Generated CLI guide (informational; this skill needs no CLI)
│   ├── runtime-compatibility.json    ← Generated compatibility snapshot (no CLI required)
│   └── troubleshoot/                 ← Fix it
│       ├── odata-errors.md           HTTP 4xx/5xx error solutions
│       ├── auth-errors.md            Auth and CSRF error solutions
│       ├── idoc-errors.md            IDoc stuck / status 51 solutions
│       └── version-diff.md           ECC vs S/4HANA behavior differences
│
├── LICENSE                           ← MIT License
├── scripts/                          ← Runnable tools
│   ├── gen-odata-postman.js          Generate Postman collection for any OData service
│   ├── gen-jco-config.py             Generate JCo .jcoDestination config file
│   └── gen-idoc-template.py          Generate IDoc XML skeleton
│
└── assets/                           ← Example payloads and config templates
    ├── payloads/
    │   ├── po-create.json            OData V2 PO deep-insert POST body
    │   ├── po-update.json            OData V2 PO item PATCH body
    │   └── idoc-orders05.xml         ORDERS05 IDoc XML example
    └── configs/
        ├── oauth-template.json       OAuth2 config for S/4HANA On-Premise
        └── jco-props.md                JCo properties reference; copy the code block to .jcoDestination

Using the Scripts

Generate Postman Collection

Creates a ready-to-import Postman collection for any SAP OData V2 service:

cd scripts
node gen-odata-postman.js \
  --service API_PURCHASEORDER_PROCESS_SRV \
  --host s4hana.example.com \
  --client 100 \
  --output po-collection.json

Generate JCo Config

Creates a .jcoDestination properties file with all options documented:

python3 gen-jco-config.py \
  --name SAP_PRD \
  --host s4hana.example.com \
  --sysnr 00 \
  --client 100 \
  --user RFC_USER \
  --output SAP_PRD.jcoDestination

Generate IDoc XML Skeleton

Creates a skeleton IDoc XML for a given message type:

python3 gen-idoc-template.py \
  --msgtype ORDERS \
  --idoctype ORDERS05 \
  --sender-partner SAP_PROD \
  --receiver-partner EXT_SUPPLIER_001 \
  --output orders05-skeleton.xml

SAP Versions Supported

SAP Version OData RFC/BAPI IDoc BTP
ECC 6.0 Custom only Full Full Via Cloud Connector
S/4HANA On-Prem 1909–2022 OData V2 (standard APIs) Full Full Via Cloud Connector
S/4HANA On-Prem 2023+ OData V2 + V4 (partial) Full Full Via Cloud Connector
S/4HANA Cloud Public Edition OData V4 primary Not available externally Limited Native
S/4HANA Cloud Private Edition OData V2/V4 Via RFC but restricted Via BTP Native

Contributing

We welcome contributions from SAP integration professionals worldwide. There are many ways to help:

  • Add a new scenario — missing HR, WM/EWM, PM, QM, or other modules
  • Improve existing content — fix errors, add examples, clarify explanations
  • Add code snippets — examples in .NET, Go, JavaScript, Ruby, etc.
  • Report issues — wrong API names, outdated information, broken examples
  • Translate content — we currently have English and Chinese; other languages welcome

See CONTRIBUTING.md for detailed guidelines.


License

MIT License — see LICENSE for details.


Acknowledgements

Content is based on publicly available SAP documentation from:


Disclaimer

This is a community project and is not affiliated with, endorsed by, or officially supported by SAP SE. SAP, S/4HANA, ECC, BTP, and related product names are trademarks of SAP SE. Always verify API behavior against the official SAP documentation for your specific release and system configuration.

Skill manifest

SAP Integration Wiki

Runtime requirement: none. This is a knowledge base — never check for, install, or require the sap-adt CLI. (references/runtime-compatibility.json declares not-required; references/setup.md is informational only.)

This skill routes integration questions to the right reference based on your context. Before loading any reference file, ask the following if not already clear from the user's message:

Trigger examples

User phrases that should activate this skill (non-exhaustive): "connect to SAP", "get data from SAP", "SAP keeps returning 401", "how do I call BAPI from Java", "how do I call SAP RFC from Python", "call SAP without JCo", "SAP SOAP endpoint", "expose an existing BAPI as JSON", "dynamic REST2RFC", "SAP OData not working".

Object/endpoint names that signal this skill: BAPI_PO_CREATE1, API_PURCHASEORDER_PROCESS_SRV, BAPI_FIXEDASSET_GETLIST, BAPI_ASSET_ACQUISITION_POST, CFIN OData V4, API_CFinRpldSupplierInvoice, JCo connection, RFC destination, BTP iFlow, Cloud Connector, SAP Event Mesh, Communication Arrangement, /sap/bc/rest2rfc.

Clarifying questions (ask only what is unknown)

  1. SAP version: ECC 6.0 / S/4HANA On-Premise / S/4HANA Cloud Public Edition / S/4HANA Cloud Private Edition?
  2. Integration direction: External → SAP (write/trigger) / SAP → External (event/push) / Bidirectional / Read-only query?
  3. Latency requirement: Synchronous (real-time response needed) / Asynchronous (fire-and-forget or queue)?
  4. Business object: Purchase Order / Sales Order / Inventory/Stock / Financial Document / Material Master / Business Partner / Production Order / BOM / Other?
  5. Consumer technology: Java/JVM / Python / .NET / Node.js / Low-code (Zapier, Power Automate) / Other?

Routing logic

After clarifying, follow this decision tree to pick the right reference files:

Step 1: Pick the scenario file

Read the relevant file from references/scenarios/ based on the business object:

Business Object File
Purchase Order (create, read, change, approve) references/scenarios/mm-po.md
Inventory / Stock query or reservation references/scenarios/mm-stock.md
Sales Order (create, track, confirm) references/scenarios/sd-order.md
Financial Document (post GL, read FI docs) references/scenarios/fi-doc.md
AR / AP open items, supplier invoice, payment, down payment references/scenarios/fi-ar-ap.md
Fixed Asset (read register, acquisition, retirement, transfer) references/scenarios/fi-asset.md
Financial Shared Service Center (FSSC) — Kingdee↔SAP, CFIN references/scenarios/fi-fssc.md
Material Master / Business Partner / Org Data (cost center, plant) references/scenarios/master-data.md
Production Order / BOM / Goods Movement (261/101) / MRP references/scenarios/pp-production.md

Always read the scenario file first before reading any tech file. The scenario file specifies which integration technology to recommend per version.

Step 2: Pick the technology file

Read the relevant file from references/tech/ based on the recommended approach from Step 1:

Technology File Use when
OData REST V2/V4 references/tech/odata.md S/4HANA On-Prem or Cloud, standard scenario, HTTP-native client
RFC / JCo (Java remote function call) references/tech/rfc-jco.md ECC (primary), S/4 when no OData exists, bulk operations, Java-only
SOAP over HTTP RFC (no JCo) references/tech/soap-rfc-http.md Call any RFC-FM from non-JVM runtime via HTTPS — Python, Node.js, Go, curl; ECC or S/4 On-Prem
Dynamic REST2RFC Gateway (JSON, no JCo) references/tech/rest2rfc-gateway.md Reuse registered RFC/BAPIs through JSON without per-interface mapping code; custom ABAP deployment is acceptable; no suitable standard OData
IDoc / SAP PI-PO references/tech/idoc-pi.md Async integration, EDI, partner/supplier message exchange
BAPI or RAP references/tech/bapi-rap.md ECC BAPIs, S/4HANA RAP OData V4 services, decision on which to use
Authentication (any technology) references/tech/auth.md Auth failures, first-time setup, OAuth2, SSL/TLS, ICF activation
BTP Integration Suite / iFlow / Cloud Connector / Event Mesh references/tech/btp-cloud-integration.md BTP-mediated integration, S/4HANA Cloud + BTP, Event Mesh consumers, Communication Arrangements
Retry / idempotency / security / monitoring / testing references/tech/best-practices.md Production hardening, error classification, structured logging, connection pooling, CI patterns

Step 3: If there is an error or failure

Read references/troubleshoot/ based on symptom:

Symptom File
HTTP 4xx / 5xx from OData endpoint references/troubleshoot/odata-errors.md
Login failures / token issues / CSRF errors references/troubleshoot/auth-errors.md
IDoc stuck / status 51 / port not configured references/troubleshoot/idoc-errors.md
Behavior differs between SAP versions references/troubleshoot/version-diff.md

Quick technology decision matrix

Use this when the user has not specified a technology preference:

SAP Version Scenario Recommended Fallback
S/4HANA On-Prem 2020+ Create/Read PO OData V2 API_PURCHASEORDER_PROCESS_SRV JCo + BAPI_PO_CREATE1
S/4HANA On-Prem 2023+ Create/Read PO OData V4 API_PURCHASEORDER (if released) OData V2
ECC 6.0 Create/Read PO JCo + BAPI_PO_CREATE1 IDoc ORDERS
ECC 6.0 (non-JVM client, JSON preferred) Reuse registered RFC-FM without per-interface wrappers Dynamic REST2RFC Gateway SOAP over HTTP; Java JCo microservice
ECC 6.0 (non-JVM client, no custom ABAP) Call any RFC-FM without JCo SOAP over HTTP (/sap/bc/soap/rfc) Java JCo microservice proxy
S/4HANA Cloud Public Any OData V4 / RAP None (RFC unavailable externally)
Any version Stock query (real-time) OData API_MATERIAL_STOCK_SRV BAPI_MATERIAL_STOCK_REQ_LIST
Any version FI posting JCo + BAPI_ACC_DOCUMENT_POST (no standard OData for posting)
S/4HANA On-Prem 1809+ Query AR/AP open items OData V2 API_OPLACCTGDOCITEMCUBE_SRV JCo BAPI_AR_ACC_GETOPENITEMS / BAPI_AP_ACC_GETOPENITEMS
ECC 6.0 Query AR/AP open items JCo BAPI_AR_ACC_GETOPENITEMS / BAPI_AP_ACC_GETOPENITEMS —
S/4HANA On-Prem 1809+ Create supplier invoice OData V2 API_SUPPLIERINVOICE_PROCESS_SRV JCo BAPI_INCOMINGINVOICE_CREATE
Any version Read fixed asset list/values JCo BAPI_FIXEDASSET_GETLIST —
Any version Post asset acquisition/retirement/transfer JCo BAPI_ASSET_ACQUISITION_POST / _RETIREMENT_POST / _TRANSFER_POST (always CHECK first) —
S/4HANA Cloud Fixed asset operations OData V4 CE_FIXEDASSET_0001 / OP_FIXEDASSETACQUISITION_0001 (Comm. Arr. SAP_COM_0510) —
S/4HANA CFIN Post from non-SAP (Kingdee) to Central Finance OData V4 API_CFinRpldSupplierInvoice / API_CFinRpldBillingDocument (Comm. Arr. SAP_COM_0453) BTP iFlow + CFIN
Any version Async supplier EDI IDoc via PI/PO File-based integration
S/4HANA On-Prem Read Material Master OData V2 API_PRODUCT_SRV JCo + BAPI_MATERIAL_GET_DETAIL
S/4HANA On-Prem Create/Change Material JCo + BAPI_MATERIAL_SAVEDATA IDoc MATMAS05
S/4HANA On-Prem 2020+ Business Partner (Customer/Vendor) OData V2 API_BUSINESS_PARTNER JCo + BAPI_BUPA_CREATE_FROM_DATA
ECC 6.0 Business Partner / Customer / Vendor JCo + BAPI_CUSTOMER_CREATEFROMDATA1 / BAPI_VENDOR_CREATE IDoc DEBMAS/CREMAS
S/4HANA On-Prem Production Order (create/change) OData V2 API_PP_ORDERS_SRV JCo + BAPI_PRODORD_CREATE
Any version Goods Movement (261/101/etc.) JCo + BAPI_GOODSMVT_CREATE OData API_MATERIAL_DOCUMENT_SRV (S/4)
Any version Production Order Confirmation JCo + BAPI_PRODORDCONF_CREATE_TT IDoc LOIPRO
Any BTP-mediated integration to S/4HANA Cloud BTP Integration Suite iFlow + Communication Arrangement N/A
Any Event-driven / decoupled async SAP Event Mesh (BTP) IDoc via PI/PO

Scripts and assets

Point users to these runnable artifacts when they need working code or templates:

Need Resource
Generate Postman Collection for any OData service scripts/gen-odata-postman.js
Generate JCo .jcoDestination properties file scripts/gen-jco-config.py
Generate IDoc XML skeleton for any message type scripts/gen-idoc-template.py
PO creation payload (OData V2 POST body) assets/payloads/po-create.json
PO item quantity update (PATCH body) assets/payloads/po-update.json
IDoc ORDERS05 XML example assets/payloads/idoc-orders05.xml
OAuth2 config template for S/4HANA On-Premise assets/configs/oauth-template.json
JCo connection properties reference (copy the properties block to a .jcoDestination file) assets/configs/jco-props.md

Response format

When answering an integration question, always structure the response as:

  1. Recommended approach — one sentence naming the technology and why it fits the user's version and scenario
  2. Prerequisites — what must be configured on the SAP side first (user roles, service activation, RFC destination, partner profile, etc.)
  3. Implementation steps — numbered list with working code snippets (curl, Java, Python as appropriate to the user's tech stack)
  4. Common pitfalls — 2–3 things that typically go wrong and exactly how to avoid or fix them
  5. Reference — link to SAP API Business Hub or SAP Help Portal page when available

Important SAP concepts for non-SAP developers

  • CSRF token: SAP OData services require a two-step process for mutating operations (POST/PATCH/DELETE). First GET to fetch the token, then include it in all write calls. Token is tied to a session cookie.
  • BAPI_TRANSACTION_COMMIT: Every write BAPI call in SAP must be followed by an explicit BAPI_TRANSACTION_COMMIT call, or the changes will be rolled back. This is a hard requirement, not optional.
  • OData $batch: SAP OData supports $batch for grouping multiple operations, but has strict ordering and boundary requirements.
  • SAP system number (SYSNR): A two-digit instance number (e.g., 00), not the host port. Do not confuse with port 3300+SYSNR.
  • Client: SAP is multi-tenanted within a single system. Always specify the client (e.g., 100, 800) in every connection.
  • ICF node: SAP Internet Communication Framework. OData services are only reachable if the corresponding ICF node is activated. Transaction: SICF.
  • SOAP over HTTP RFC: SAP exposes all RFC-enabled function modules via a standard SOAP endpoint at /sap/bc/soap/rfc. No SAP-specific client library is required — any HTTP library works. The ICF node for this path must be activated in SICF. Use this when JCo is not practical (non-JVM runtimes, containerised workloads, rapid prototyping). Does not support IDoc, tRFC, or qRFC.
  • Dynamic REST2RFC Gateway: A community pure-ABAP option for exposing registered RFC/BAPIs as JSON through /sap/bc/rest2rfc. Use it on supported ECC/S/4HANA On-Premise systems when no standard OData fits and configuration-driven exposure is preferable to per-interface wrappers. It requires an initial gateway deployment and is not for S/4HANA Cloud Public Edition. Read references/tech/rest2rfc-gateway.md before giving setup, transaction, or security guidance.
Files (sap-watt)
  • assets
    • configs
      • jco-props.md 11 KB
        Loading…
      • oauth-template.json 5.5 KB
        Loading…
    • payloads
      • idoc-orders05.xml 10.5 KB · in bundle
      • po-create.json 2 KB
        Loading…
      • po-update.json 2 KB
        Loading…
  • references
    • scenarios
      • fi-ar-ap.md 53.3 KB
        Loading…
      • fi-asset.md 31.7 KB
        Loading…
      • fi-doc.md 11.4 KB
        Loading…
      • fi-fssc.md 45.6 KB
        Loading…
      • master-data.md 14.8 KB
        Loading…
      • mm-po.md 15.7 KB
        Loading…
      • mm-stock.md 9.5 KB
        Loading…
      • pp-production.md 15.8 KB
        Loading…
      • sd-order.md 11.1 KB
        Loading…
    • tech
      • auth.md 13.5 KB
        Loading…
      • bapi-rap.md 12.2 KB
        Loading…
      • best-practices.md 20.1 KB
        Loading…
      • btp-cloud-integration.md 14.8 KB
        Loading…
      • idoc-pi.md 14.2 KB
        Loading…
      • odata.md 15.7 KB
        Loading…
      • rest2rfc-gateway.md 10.9 KB
        Loading…
      • rfc-jco.md 20.1 KB
        Loading…
      • soap-rfc-http.md 19 KB
        Loading…
    • troubleshoot
      • auth-errors.md 11 KB
        Loading…
      • idoc-errors.md 9.9 KB
        Loading…
      • odata-errors.md 12.6 KB
        Loading…
      • version-diff.md 10 KB
        Loading…
    • runtime-compatibility.json 1.1 KB
      Loading…
    • setup.md 18 KB
      Loading…
  • scripts
    • gen-idoc-template.py 21.6 KB
      Loading…
    • gen-jco-config.py 16 KB
      Loading…
    • gen-odata-postman.js 18.5 KB
      Loading…
  • CONTRIBUTING.md 12.7 KB
    Loading…
  • README.md 12.7 KB
    # SAP Integration Wiki
    
    <!-- BEGIN GENERATED cli-setup -->
    <!-- GENERATED from docs/installation/runtime-setup.md + compatibility.json by tools/sync_skill_runtime_docs.py — do not edit; run the tool to refresh -->
    
    This skill needs **no CLI** — it works fully offline. Compatible legacy CLI range: `>=1.5.0,<2.0.0`.
    Preferred new entry: **Watt** (`sap-watt`), range `>=1.6.7,<2.0.0`. Existing `sap-adt` examples remain valid; use the installed entry consistently.
    Install/readiness guide: [`references/setup.md`](references/setup.md).
    <!-- END GENERATED cli-setup -->
    
    > A skill that turns any AI assistant into a SAP integration specialist.
    > Built for developers who need to connect external systems to SAP — without reading 10,000 pages of SAP documentation.
    
    [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
    [![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)
    [![SAP Versions](https://img.shields.io/badge/SAP-ECC%20%7C%20S%2F4HANA%20%7C%20Cloud-blue.svg)](references/troubleshoot/version-diff.md)
    
    [English](README.md) | [中文](README.zh-CN.md)
    
    > [!IMPORTANT]
    > **This repository has been archived and is no longer updated.** `sap-integration-wiki` is now maintained exclusively in the [sap-watt](https://github.com/shrek-abaper/sap-watt) monorepo at [`skills/sap-integration-wiki`](https://github.com/shrek-abaper/sap-watt/tree/main/skills/sap-integration-wiki). Please go there for the latest version, issues, and improvements.
    
    ---
    
    ## What Is This?
    
    `sap-integration-wiki` is a **composable skill** — a structured knowledge base following the standard skill specification (`SKILL.md`). Once installed into your AI agent framework, any AI assistant can load the right reference documents and provide precise, actionable answers backed by real SAP API documentation.
    
    **Without this skill**, an AI assistant gives generic, often-wrong answers about SAP:
    > "You can use the SAP RFC API to create a purchase order."
    
    **With this skill**, the AI gives production-ready guidance:
    > "For S/4HANA On-Premise, use OData V2 `API_PURCHASEORDER_PROCESS_SRV` with a deep insert POST to create the PO header + items in one request. Here's the exact payload structure with account assignment, and here's the CSRF token flow you need to implement first..."
    
    ---
    
    ## Covered Scenarios
    
    ### Business Scenarios
    
    | Domain | Scenarios |
    |---|---|
    | **MM — Purchasing** | Create PO, read PO status, update quantity/price, supplier EDI acknowledgement |
    | **MM — Inventory** | Query stock by plant/storage location, post goods issue/receipt, create reservation |
    | **SD — Sales** | Create sales order, track delivery status, read billing documents |
    | **FI — Finance** | Post GL document, read FI documents, account determination |
    | **FI — AR / AP** | Query open items, payment terms, supplier invoice create, AP/AR posting, down payments, document parking |
    | **FI — Asset Accounting** | Read asset register, post acquisition / retirement / write-off / transfer, OData V4 for S/4HANA Cloud |
    | **FI — FSSC** | Financial Shared Service Center: Kingdee↔SAP patterns (Direct API / BTP-mediated / CFIN), API catalog, master data mapping |
    | **Master Data** | Material master read/create, Business Partner (Customer/Vendor), Cost Center |
    | **PP — Production** | Production orders, BOM read, goods movements (261/101), order confirmation, MRP |
    
    ### Integration Technologies
    
    | Technology | Coverage |
    |---|---|
    | **OData V2 / V4** | CSRF flow, `$expand`/`$filter`/`$batch`, deep insert, error parsing |
    | **RFC / SAP JCo** | Connection pool, BAPI call pattern, RETURN table parsing, load balancing |
    | **SOAP over HTTP RFC** | Call any RFC-FM via HTTPS without JCo — Python/Node/curl examples, CSRF flow, response parsing |
    | **Dynamic REST2RFC Gateway** | Expose registered RFC/BAPIs as JSON through a pure-ABAP gateway — configuration-driven routing, transaction boundaries, security and limitations ([public project](https://github.com/shrek-abaper/sap-rest2rfc-gateway)) |
    | **IDoc / PI-PO** | Control record, key segments, status lifecycle, monitoring transactions |
    | **BAPI & RAP** | When to use which, key BAPIs by domain, RAP OData V4 services |
    | **Authentication** | Basic Auth, OAuth2 (on-premise SOAUTH2 + Cloud), SSL/TLS, ICF activation |
    | **BTP Integration Suite** | iFlow, Cloud Connector, API Management, Event Mesh, Communication Arrangements |
    | **Best Practices** | Idempotency, retry logic, connection management, security hardening, monitoring |
    
    ---
    
    ## Installation
    
    This skill follows the standard skill specification with `SKILL.md` metadata. Installation steps vary by your AI agent framework:
    
    ### Example: Claude Code
    
    ```bash
    # Symlink into Claude Code skills directory
    ln -s /path/to/sap-integration-wiki ~/.agents/skills/sap-integration-wiki
    ```
    
    ### Example: OpenAI Custom Instructions / System Prompt
    
    Add this to your agent context:
    
    ```
    When answering SAP integration questions, load the knowledge base from:
    - /path/to/sap-integration-wiki/SKILL.md (routing logic)
    - /path/to/sap-integration-wiki/references/scenarios/*.md (business scenarios)
    - /path/to/sap-integration-wiki/references/tech/*.md (technical guides)
    - /path/to/sap-integration-wiki/references/troubleshoot/*.md (error solutions)
    ```
    
    ### Example: LangChain / RAG Integration
    
    ```python
    from langchain.document_loaders import DirectoryLoader, UnstructuredMarkdownLoader
    
    loader = DirectoryLoader(
        '/path/to/sap-integration-wiki',
        glob='**/*.md',
        loader_cls=UnstructuredMarkdownLoader,
        loader_kwargs={'mode': 'elements'}
    )
    
    documents = loader.load()
    # Then build your vector store or retrieval chain
    ```
    
    ### Verification
    
    The skill should load automatically via `SKILL.md` metadata. Update your agent's skill scan paths to include this directory.
    
    ---
    
    ## Quick Start
    
    Once installed, ask your AI assistant about SAP integration:
    
    **Example prompts (language-agnostic):**
    
    ```
    How do I create a purchase order in SAP S/4HANA from Python?
    ```
    
    ```
    I'm getting HTTP 403 CSRF token validation failed from SAP OData. What's wrong?
    ```
    
    ```
    What's the difference between using BAPI_PO_CREATE1 and the OData API for ECC?
    ```
    
    ```
    How do I read stock levels from SAP in real time?
    ```
    
    The skill automatically:
    1. Identifies your SAP version and integration scenario
    2. Loads the relevant reference documents from `references/`
    3. Provides working code examples in your language (Java, Python, curl, etc.)
    4. Flags common pitfalls specific to your situation
    
    **Unusual requirement**: "The skill loads automatically for all AI assistants — just asking works."
    
    ---
    
    ## Directory Structure
    
    ```
    sap-integration-wiki/
    ├── SKILL.md                          ← AI routing logic and decision tree
    ├── README.md                         ← This file (English)
    ├── README.zh-CN.md                   ← Chinese version
    ├── CONTRIBUTING.md                   ← Contribution guide
    │
    ├── references/
    │   ├── scenarios/                    ← What to do (business-oriented)
    │   │   ├── mm-po.md                  Purchase Order integration
    │   │   ├── mm-stock.md               Inventory/Stock integration
    │   │   ├── sd-order.md               Sales Order integration
    │   │   ├── fi-doc.md                 Financial Document integration (GL posting)
    │   │   ├── fi-ar-ap.md               AR/AP open items, invoices, payments
    │   │   ├── fi-asset.md               Fixed Asset accounting (acquisition, retirement, transfer)
    │   │   ├── fi-fssc.md                Financial Shared Service Center (Kingdee↔SAP, CFIN)
    │   │   ├── master-data.md            Material Master, Business Partner
    │   │   └── pp-production.md          Production Orders, BOM, Goods Movements, MRP
    │   │
    │   ├── tech/                         ← How to do it (technology-oriented)
    │   │   ├── odata.md                  OData V2/V4 protocol guide
    │   │   ├── rfc-jco.md                RFC/JCo connection and BAPI guide
    │   │   ├── soap-rfc-http.md          SOAP over HTTP RFC — no JCo required
    │   │   ├── rest2rfc-gateway.md       Dynamic RFC/BAPI to HTTP/JSON gateway
    │   │   ├── idoc-pi.md                IDoc and SAP PI/PO guide
    │   │   ├── bapi-rap.md               BAPI vs RAP decision guide
    │   │   ├── auth.md                   Authentication setup guide
    │   │   ├── btp-cloud-integration.md  BTP Integration Suite guide
    │   │   └── best-practices.md         Security, retry, monitoring, testing
    │   │
    │   ├── setup.md                      ← Generated CLI guide (informational; this skill needs no CLI)
    │   ├── runtime-compatibility.json    ← Generated compatibility snapshot (no CLI required)
    │   └── troubleshoot/                 ← Fix it
    │       ├── odata-errors.md           HTTP 4xx/5xx error solutions
    │       ├── auth-errors.md            Auth and CSRF error solutions
    │       ├── idoc-errors.md            IDoc stuck / status 51 solutions
    │       └── version-diff.md           ECC vs S/4HANA behavior differences
    │
    ├── LICENSE                           ← MIT License
    ├── scripts/                          ← Runnable tools
    │   ├── gen-odata-postman.js          Generate Postman collection for any OData service
    │   ├── gen-jco-config.py             Generate JCo .jcoDestination config file
    │   └── gen-idoc-template.py          Generate IDoc XML skeleton
    │
    └── assets/                           ← Example payloads and config templates
        ├── payloads/
        │   ├── po-create.json            OData V2 PO deep-insert POST body
        │   ├── po-update.json            OData V2 PO item PATCH body
        │   └── idoc-orders05.xml         ORDERS05 IDoc XML example
        └── configs/
            ├── oauth-template.json       OAuth2 config for S/4HANA On-Premise
            └── jco-props.md                JCo properties reference; copy the code block to .jcoDestination
    ```
    
    ---
    
    ## Using the Scripts
    
    ### Generate Postman Collection
    
    Creates a ready-to-import Postman collection for any SAP OData V2 service:
    
    ```bash
    cd scripts
    node gen-odata-postman.js \
      --service API_PURCHASEORDER_PROCESS_SRV \
      --host s4hana.example.com \
      --client 100 \
      --output po-collection.json
    ```
    
    ### Generate JCo Config
    
    Creates a `.jcoDestination` properties file with all options documented:
    
    ```bash
    python3 gen-jco-config.py \
      --name SAP_PRD \
      --host s4hana.example.com \
      --sysnr 00 \
      --client 100 \
      --user RFC_USER \
      --output SAP_PRD.jcoDestination
    ```
    
    ### Generate IDoc XML Skeleton
    
    Creates a skeleton IDoc XML for a given message type:
    
    ```bash
    python3 gen-idoc-template.py \
      --msgtype ORDERS \
      --idoctype ORDERS05 \
      --sender-partner SAP_PROD \
      --receiver-partner EXT_SUPPLIER_001 \
      --output orders05-skeleton.xml
    ```
    
    ---
    
    ## SAP Versions Supported
    
    | SAP Version | OData | RFC/BAPI | IDoc | BTP |
    |---|---|---|---|---|
    | ECC 6.0 | Custom only | Full | Full | Via Cloud Connector |
    | S/4HANA On-Prem 1909–2022 | OData V2 (standard APIs) | Full | Full | Via Cloud Connector |
    | S/4HANA On-Prem 2023+ | OData V2 + V4 (partial) | Full | Full | Via Cloud Connector |
    | S/4HANA Cloud Public Edition | OData V4 primary | Not available externally | Limited | Native |
    | S/4HANA Cloud Private Edition | OData V2/V4 | Via RFC but restricted | Via BTP | Native |
    
    ---
    
    ## Contributing
    
    We welcome contributions from SAP integration professionals worldwide. There are many ways to help:
    
    - **Add a new scenario** — missing HR, WM/EWM, PM, QM, or other modules
    - **Improve existing content** — fix errors, add examples, clarify explanations
    - **Add code snippets** — examples in .NET, Go, JavaScript, Ruby, etc.
    - **Report issues** — wrong API names, outdated information, broken examples
    - **Translate content** — we currently have English and Chinese; other languages welcome
    
    See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
    
    ---
    
    ## License
    
    MIT License — see [LICENSE](https://github.com/shrek-abaper/sap-watt/blob/main/LICENSE) for details.
    
    ---
    
    ## Acknowledgements
    
    Content is based on publicly available SAP documentation from:
    - [SAP Business Accelerator Hub](https://api.sap.com)
    - [SAP Help Portal](https://help.sap.com)
    - [SAP Community](https://community.sap.com)
    - Real-world SAP integration project experience
    
    ---
    
    ## Disclaimer
    
    This is a community project and is not affiliated with, endorsed by, or officially supported by SAP SE. SAP, S/4HANA, ECC, BTP, and related product names are trademarks of SAP SE. Always verify API behavior against the official SAP documentation for your specific release and system configuration.
    
  • README.zh-CN.md 11.4 KB
    Loading…
  • SKILL.md 12.5 KB
    ---
    name: sap-integration-wiki
    description: >
      Use when integrating external systems (Java, Python, .NET, Node.js,
      low-code) with SAP (ECC 6.0, S/4HANA On-Prem/Cloud): OData V2/V4, RFC/JCo,
      SOAP RFC, dynamic REST2RFC/JSON without JCo, IDoc/PI-PO, BAPI, RAP,
      BTP Integration Suite/iFlow, Event Mesh, Cloud Connector, Communication Arrangements,
      FI-AA, AR/AP, Central Finance (CFIN), FSSC / 财务共享中心 (Kingdee/金蝶, 用友 to SAP).
      Use whenever asked to connect to SAP, call a SAP API/BAPI/RFC, read or
      create SAP data from outside (purchase/sales/production orders, inventory, financial
      documents, AR/AP, assets, material master, business partner), configure JCo
      destinations, call or expose RFC/BAPI as JSON from Python/Java/Node/Go without SAP libraries,
      handle IDocs, set up S/4HANA Cloud Communication Arrangements, implement retry/idempotency,
      or troubleshoot SAP HTTP 400/401/403, "CSRF token validation failed", "IDoc status 51",
      "/sap/bc/soap/rfc", "/sap/bc/rest2rfc", JCo/RFC destination errors — even when the user never says "SAP"
      and only describes symptoms.
    ---
    
    # SAP Integration Wiki
    
    **Runtime requirement: none.** This is a knowledge base — never check for,
    install, or require the `sap-adt` CLI. (`references/runtime-compatibility.json`
    declares `not-required`; `references/setup.md` is informational only.)
    
    This skill routes integration questions to the right reference based on your context.
    Before loading any reference file, ask the following if not already clear from the
    user's message:
    
    ## Trigger examples
    
    User phrases that should activate this skill (non-exhaustive): "connect to SAP",
    "get data from SAP", "SAP keeps returning 401", "how do I call BAPI from Java",
    "how do I call SAP RFC from Python", "call SAP without JCo", "SAP SOAP endpoint",
    "expose an existing BAPI as JSON", "dynamic REST2RFC", "SAP OData not working".
    
    Object/endpoint names that signal this skill: `BAPI_PO_CREATE1`,
    `API_PURCHASEORDER_PROCESS_SRV`, `BAPI_FIXEDASSET_GETLIST`,
    `BAPI_ASSET_ACQUISITION_POST`, `CFIN OData V4`, `API_CFinRpldSupplierInvoice`,
    `JCo connection`, `RFC destination`, `BTP iFlow`, `Cloud Connector`,
    `SAP Event Mesh`, `Communication Arrangement`, `/sap/bc/rest2rfc`.
    
    ## Clarifying questions (ask only what is unknown)
    
    1. **SAP version**: ECC 6.0 / S/4HANA On-Premise / S/4HANA Cloud Public Edition / S/4HANA Cloud Private Edition?
    2. **Integration direction**: External → SAP (write/trigger) / SAP → External (event/push) / Bidirectional / Read-only query?
    3. **Latency requirement**: Synchronous (real-time response needed) / Asynchronous (fire-and-forget or queue)?
    4. **Business object**: Purchase Order / Sales Order / Inventory/Stock / Financial Document / Material Master / Business Partner / Production Order / BOM / Other?
    5. **Consumer technology**: Java/JVM / Python / .NET / Node.js / Low-code (Zapier, Power Automate) / Other?
    
    ---
    
    ## Routing logic
    
    After clarifying, follow this decision tree to pick the right reference files:
    
    ### Step 1: Pick the scenario file
    
    Read the relevant file from `references/scenarios/` based on the business object:
    
    | Business Object | File |
    |---|---|
    | Purchase Order (create, read, change, approve) | `references/scenarios/mm-po.md` |
    | Inventory / Stock query or reservation | `references/scenarios/mm-stock.md` |
    | Sales Order (create, track, confirm) | `references/scenarios/sd-order.md` |
    | Financial Document (post GL, read FI docs) | `references/scenarios/fi-doc.md` |
    | AR / AP open items, supplier invoice, payment, down payment | `references/scenarios/fi-ar-ap.md` |
    | Fixed Asset (read register, acquisition, retirement, transfer) | `references/scenarios/fi-asset.md` |
    | Financial Shared Service Center (FSSC) — Kingdee↔SAP, CFIN | `references/scenarios/fi-fssc.md` |
    | Material Master / Business Partner / Org Data (cost center, plant) | `references/scenarios/master-data.md` |
    | Production Order / BOM / Goods Movement (261/101) / MRP | `references/scenarios/pp-production.md` |
    
    **Always read the scenario file first** before reading any tech file.
    The scenario file specifies which integration technology to recommend per version.
    
    ### Step 2: Pick the technology file
    
    Read the relevant file from `references/tech/` based on the recommended approach from Step 1:
    
    | Technology | File | Use when |
    |---|---|---|
    | OData REST V2/V4 | `references/tech/odata.md` | S/4HANA On-Prem or Cloud, standard scenario, HTTP-native client |
    | RFC / JCo (Java remote function call) | `references/tech/rfc-jco.md` | ECC (primary), S/4 when no OData exists, bulk operations, Java-only |
    | SOAP over HTTP RFC (no JCo) | `references/tech/soap-rfc-http.md` | Call any RFC-FM from non-JVM runtime via HTTPS — Python, Node.js, Go, curl; ECC or S/4 On-Prem |
    | Dynamic REST2RFC Gateway (JSON, no JCo) | `references/tech/rest2rfc-gateway.md` | Reuse registered RFC/BAPIs through JSON without per-interface mapping code; custom ABAP deployment is acceptable; no suitable standard OData |
    | IDoc / SAP PI-PO | `references/tech/idoc-pi.md` | Async integration, EDI, partner/supplier message exchange |
    | BAPI or RAP | `references/tech/bapi-rap.md` | ECC BAPIs, S/4HANA RAP OData V4 services, decision on which to use |
    | Authentication (any technology) | `references/tech/auth.md` | Auth failures, first-time setup, OAuth2, SSL/TLS, ICF activation |
    | BTP Integration Suite / iFlow / Cloud Connector / Event Mesh | `references/tech/btp-cloud-integration.md` | BTP-mediated integration, S/4HANA Cloud + BTP, Event Mesh consumers, Communication Arrangements |
    | Retry / idempotency / security / monitoring / testing | `references/tech/best-practices.md` | Production hardening, error classification, structured logging, connection pooling, CI patterns |
    
    ### Step 3: If there is an error or failure
    
    Read `references/troubleshoot/` based on symptom:
    
    | Symptom | File |
    |---|---|
    | HTTP 4xx / 5xx from OData endpoint | `references/troubleshoot/odata-errors.md` |
    | Login failures / token issues / CSRF errors | `references/troubleshoot/auth-errors.md` |
    | IDoc stuck / status 51 / port not configured | `references/troubleshoot/idoc-errors.md` |
    | Behavior differs between SAP versions | `references/troubleshoot/version-diff.md` |
    
    ---
    
    ## Quick technology decision matrix
    
    Use this when the user has not specified a technology preference:
    
    | SAP Version | Scenario | Recommended | Fallback |
    |---|---|---|---|
    | S/4HANA On-Prem 2020+ | Create/Read PO | OData V2 `API_PURCHASEORDER_PROCESS_SRV` | JCo + `BAPI_PO_CREATE1` |
    | S/4HANA On-Prem 2023+ | Create/Read PO | OData V4 `API_PURCHASEORDER` (if released) | OData V2 |
    | ECC 6.0 | Create/Read PO | JCo + `BAPI_PO_CREATE1` | IDoc `ORDERS` |
    | ECC 6.0 (non-JVM client, JSON preferred) | Reuse registered RFC-FM without per-interface wrappers | Dynamic REST2RFC Gateway | SOAP over HTTP; Java JCo microservice |
    | ECC 6.0 (non-JVM client, no custom ABAP) | Call any RFC-FM without JCo | SOAP over HTTP (`/sap/bc/soap/rfc`) | Java JCo microservice proxy |
    | S/4HANA Cloud Public | Any | OData V4 / RAP | None (RFC unavailable externally) |
    | Any version | Stock query (real-time) | OData `API_MATERIAL_STOCK_SRV` | `BAPI_MATERIAL_STOCK_REQ_LIST` |
    | Any version | FI posting | JCo + `BAPI_ACC_DOCUMENT_POST` | (no standard OData for posting) |
    | S/4HANA On-Prem 1809+ | Query AR/AP open items | OData V2 `API_OPLACCTGDOCITEMCUBE_SRV` | JCo `BAPI_AR_ACC_GETOPENITEMS` / `BAPI_AP_ACC_GETOPENITEMS` |
    | ECC 6.0 | Query AR/AP open items | JCo `BAPI_AR_ACC_GETOPENITEMS` / `BAPI_AP_ACC_GETOPENITEMS` | — |
    | S/4HANA On-Prem 1809+ | Create supplier invoice | OData V2 `API_SUPPLIERINVOICE_PROCESS_SRV` | JCo `BAPI_INCOMINGINVOICE_CREATE` |
    | Any version | Read fixed asset list/values | JCo `BAPI_FIXEDASSET_GETLIST` | — |
    | Any version | Post asset acquisition/retirement/transfer | JCo `BAPI_ASSET_ACQUISITION_POST` / `_RETIREMENT_POST` / `_TRANSFER_POST` (always CHECK first) | — |
    | S/4HANA Cloud | Fixed asset operations | OData V4 `CE_FIXEDASSET_0001` / `OP_FIXEDASSETACQUISITION_0001` (Comm. Arr. SAP_COM_0510) | — |
    | S/4HANA CFIN | Post from non-SAP (Kingdee) to Central Finance | OData V4 `API_CFinRpldSupplierInvoice` / `API_CFinRpldBillingDocument` (Comm. Arr. SAP_COM_0453) | BTP iFlow + CFIN |
    | Any version | Async supplier EDI | IDoc via PI/PO | File-based integration |
    | S/4HANA On-Prem | Read Material Master | OData V2 `API_PRODUCT_SRV` | JCo + `BAPI_MATERIAL_GET_DETAIL` |
    | S/4HANA On-Prem | Create/Change Material | JCo + `BAPI_MATERIAL_SAVEDATA` | IDoc `MATMAS05` |
    | S/4HANA On-Prem 2020+ | Business Partner (Customer/Vendor) | OData V2 `API_BUSINESS_PARTNER` | JCo + `BAPI_BUPA_CREATE_FROM_DATA` |
    | ECC 6.0 | Business Partner / Customer / Vendor | JCo + `BAPI_CUSTOMER_CREATEFROMDATA1` / `BAPI_VENDOR_CREATE` | IDoc `DEBMAS`/`CREMAS` |
    | S/4HANA On-Prem | Production Order (create/change) | OData V2 `API_PP_ORDERS_SRV` | JCo + `BAPI_PRODORD_CREATE` |
    | Any version | Goods Movement (261/101/etc.) | JCo + `BAPI_GOODSMVT_CREATE` | OData `API_MATERIAL_DOCUMENT_SRV` (S/4) |
    | Any version | Production Order Confirmation | JCo + `BAPI_PRODORDCONF_CREATE_TT` | IDoc `LOIPRO` |
    | Any | BTP-mediated integration to S/4HANA Cloud | BTP Integration Suite iFlow + Communication Arrangement | N/A |
    | Any | Event-driven / decoupled async | SAP Event Mesh (BTP) | IDoc via PI/PO |
    
    ---
    
    ## Scripts and assets
    
    Point users to these runnable artifacts when they need working code or templates:
    
    | Need | Resource |
    |---|---|
    | Generate Postman Collection for any OData service | `scripts/gen-odata-postman.js` |
    | Generate JCo `.jcoDestination` properties file | `scripts/gen-jco-config.py` |
    | Generate IDoc XML skeleton for any message type | `scripts/gen-idoc-template.py` |
    | PO creation payload (OData V2 POST body) | `assets/payloads/po-create.json` |
    | PO item quantity update (PATCH body) | `assets/payloads/po-update.json` |
    | IDoc ORDERS05 XML example | `assets/payloads/idoc-orders05.xml` |
    | OAuth2 config template for S/4HANA On-Premise | `assets/configs/oauth-template.json` |
    | JCo connection properties reference (copy the properties block to a .jcoDestination file) | `assets/configs/jco-props.md` |
    
    ---
    
    ## Response format
    
    When answering an integration question, always structure the response as:
    
    1. **Recommended approach** — one sentence naming the technology and why it fits the user's version and scenario
    2. **Prerequisites** — what must be configured on the SAP side first (user roles, service activation, RFC destination, partner profile, etc.)
    3. **Implementation steps** — numbered list with working code snippets (curl, Java, Python as appropriate to the user's tech stack)
    4. **Common pitfalls** — 2–3 things that typically go wrong and exactly how to avoid or fix them
    5. **Reference** — link to SAP API Business Hub or SAP Help Portal page when available
    
    ---
    
    ## Important SAP concepts for non-SAP developers
    
    - **CSRF token**: SAP OData services require a two-step process for mutating operations (POST/PATCH/DELETE). First GET to fetch the token, then include it in all write calls. Token is tied to a session cookie.
    - **BAPI_TRANSACTION_COMMIT**: Every write BAPI call in SAP must be followed by an explicit `BAPI_TRANSACTION_COMMIT` call, or the changes will be rolled back. This is a hard requirement, not optional.
    - **OData $batch**: SAP OData supports `$batch` for grouping multiple operations, but has strict ordering and boundary requirements.
    - **SAP system number (SYSNR)**: A two-digit instance number (e.g., `00`), not the host port. Do not confuse with port 3300+SYSNR.
    - **Client**: SAP is multi-tenanted within a single system. Always specify the client (e.g., `100`, `800`) in every connection.
    - **ICF node**: SAP Internet Communication Framework. OData services are only reachable if the corresponding ICF node is activated. Transaction: `SICF`.
    - **SOAP over HTTP RFC**: SAP exposes all RFC-enabled function modules via a standard SOAP endpoint at `/sap/bc/soap/rfc`. No SAP-specific client library is required — any HTTP library works. The ICF node for this path must be activated in `SICF`. Use this when JCo is not practical (non-JVM runtimes, containerised workloads, rapid prototyping). Does not support IDoc, tRFC, or qRFC.
    - **Dynamic REST2RFC Gateway**: A community pure-ABAP option for exposing registered RFC/BAPIs as JSON through `/sap/bc/rest2rfc`. Use it on supported ECC/S/4HANA On-Premise systems when no standard OData fits and configuration-driven exposure is preferable to per-interface wrappers. It requires an initial gateway deployment and is not for S/4HANA Cloud Public Edition. Read `references/tech/rest2rfc-gateway.md` before giving setup, transaction, or security guidance.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.