---
name: iblai-connect-sap-s4hana
description: "Read and write SAP S/4HANA data through the SAP S/4HANA OData APIs (SAP Business Accelerator Hub) and expose it to an ibl.ai agent as an MCP tool. Use when the user asks an agent to work with SAP S/4HANA data, or to set up a SAP S/4HANA MCP connection on ibl.ai."
metadata:
  kind: guide
---

# SAP S/4HANA connector for AI agents

> A starting point maintained on ibl.ai at https://ibl.ai/developer/connectors/sap-s4hana — not part of the iblai/vibe repository. Checked against SAP SE's documentation on October 20, 2026; test it against your own SAP S/4HANA setup before you rely on it.

SAP S/4HANA is an ERP suite (Cloud Public Edition, Private Edition and on-premise). It stores finance, procurement, sales, inventory and manufacturing data such as business partners, sales orders and purchase orders.

## Auth & conventions

- **API:** SAP S/4HANA OData APIs (SAP Business Accelerator Hub) (Mixed). Mostly OData V2/V4 services, plus SOAP and IDoc, published on SAP Business Accelerator Hub. Examples: Sales Order (API_SALES_ORDER_SRV) for create, read, update, delete of orders; Business Partner APIs for customer and supplier data.
- **Base URL:** https://{host}/sap/opu/odata/sap/{SERVICE_NAME}/
- **Access:** Issued by your administrator. A customer admin creates a communication arrangement for the API's communication scenario (e.g. SAP_COM_0109 for sales orders), with a communication system and communication user; the arrangement shows the service URL.
- **Auth:** Basic authentication (communication user); OAuth 2.0; x509 client certificate; SAML bearer / single sign-on. Each API supports different methods. The communication arrangement's inbound user sets the method: basic, x509, OAuth 2.0, OAuth 2.0 mTLS or principal propagation. ETags give optimistic concurrency on updates.
- Keep SAP S/4HANA credentials in environment variables or the ibl.ai credential store. Never print a token in chat and never commit one to a file.
- Destructive or outward-facing calls are marked **Confirm with the user first** — do.

## Reads

- **Sales orders** — API_SALES_ORDER_SRV entities such as A_SalesOrder and A_SalesOrderItem; metadata at /sap/opu/odata/SAP/API_SALES_ORDER_SRV/$metadata.
- **Business partners** — Business partner, customer and supplier master data via the Business Partner OData APIs.
- **Service metadata** — Append $metadata to any service URL to read its entity model.
- **Purchasing and finance** — Other OData services listed on SAP Business Accelerator Hub, each tied to a communication scenario.

## Writes

- **Create or update sales orders** — Sales Order (A2X, OData V2) supports create and update of orders and items.
- **Business partner changes** — Create or update business partner, customer and supplier records.
- **Delete sales orders** — The OData V2 Sales Order API also supports delete. **Confirm with the user first.**

## Expose it to an ibl.ai agent (MCP)

SAP SE did not publish an MCP server of its own when this skill was checked. Host a small MCP server that wraps the calls above, then register it below.

First install the ibl.ai platform skills and connect your organization (writes `IBLAI_ORG`, `IBLAI_USERNAME` and `IBLAI_API_KEY` to `.env`):

```bash
npx skills add iblai/vibe --all
# then, in your coding agent:
/iblai-api-login
```

Every call below sends `Authorization: Api-Token $IBLAI_API_KEY`.

1. **Register the server** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-servers/` with `name`, `url`, `transport` (`sse` | `websocket` | `streamable_http`) and `auth_type` (`none` | `token` | `oauth2`). Capture the returned `id`.
   - For an API key or service credential use `auth_type=token` with `auth_scope=platform` for one key across the organization, or scope it to a single agent for one key per agent.
2. **Create the connection** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-server-connections/` with `server`, `scope` (`platform` | `mentor` | `user`), `auth_type`, and either `credentials` + `authorization_scheme` or a `connected_service` id for OAuth. Credentials are masked on read; never send a masked value back.
3. **Enable it on the agent** — `GET https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/{agent_id}/settings/`, add `mcp-tool` to `tool_slugs` and the server id to `mcp_servers`, then `PATCH` the full lists back. They are replaced, not merged.

Full reference: https://ibl.ai/developer/platform/mcp/mcp-connections and the `/iblai-api-agent-mcp` skill.

## Example prompts

- "Show open sales orders for customer 10100001 created this month"
- "What is the delivery status of sales order 4500012345?"
- "Look up the payment terms and address for supplier 17300001"
- "Create a sales order for 20 units of material TG11 for customer 10100001"

## Guardrails

- Holds financial records, customer and supplier master data (names, addresses, bank details) and pricing. Treat as confidential financial and personal data; scope access per communication arrangement.
- Request the narrowest SAP S/4HANA scopes or role the task needs, and prefer a read-only credential for agents that only answer questions.
- Return the fields the user asked for, not whole records; do not paste personal data into chat that the user did not request.
- Before any write, show the user exactly what will change and wait for a yes.
- Page through large result sets and back off on rate-limit responses instead of retrying in a loop.

## References

- APIs on SAP Business Accelerator Hub: https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/1e60f14bdc224c2c975c8fa8bcfd7f3f.html
- Creating a communication arrangement: https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/7855f3f364974887ad93d8647fbf0ee2.html
- Sales Order (A2X, OData V2): https://help.sap.com/docs/SAP_S4HANA_CLOUD/03c04db2a7434731b7fe21dca77440da/00d244581efca007e10000000a441470.html
- This connector on ibl.ai: https://ibl.ai/developer/connectors/sap-s4hana
- ibl.ai MCP server connections: https://ibl.ai/developer/platform/mcp/mcp-connections
