ChatGPTSAP S/4HANA Agent view

How to connect ChatGPT to SAP S/4HANA

Short answer

There are two realistic routes: export or paste data into ChatGPT for one-off analysis, or give a custom GPT or app live access through a small API gateway in front of released S/4HANA OData services. The second needs authentication, read-only scoping and a decision about whether your data may leave your network.

People on S/4HANA usually start with ChatGPT in the simplest way: export an ALV list to Excel, paste it into a chat, and ask for a summary. That works for a quick look at an open-order list, and it is also where the first data policy question appears, because those rows contain customer names, prices and part numbers.

The more ambitious version is a custom GPT that can answer questions like 'which POs for this vendor are late' by calling your system. That requires an API the GPT can reach, an authentication scheme, and a clear view of what the model provider does with the data. Many S/4HANA systems sit behind a firewall, so this is as much a network design problem as an AI one.

This page walks through the options, what S/4HANA offers on the SAP side, and where a private model is the better answer. If your data is not sensitive and the questions are narrow, ChatGPT with a thin gateway is a sensible, cheap start.

What teams use it for

Explaining a blocked invoice

An AP clerk pastes the PO, goods receipt and invoice lines (after masking) and asks why the three-way match failed, getting a plain-language list of the variances.

Drafting supplier and customer emails

Given an exported list of late lines, ChatGPT drafts consistent chasers by vendor, which the buyer edits and sends.

Summarizing open sales orders by risk

A sales operations lead uploads a sales order export and asks which orders have credit blocks or delivery dates that conflict with stock.

Writing SQL-like logic and CDS view ideas

A developer asks for help drafting ABAP CDS view definitions or ABAP snippets, then reviews and tests them in a sandbox. No live data is needed.

Custom GPT for order status

A GPT with an action calls a gateway endpoint that wraps the sales order OData service, so customer service can ask for status by number without opening SAP GUI.

SAP S/4HANA integration surface

  • Exports: ALV grid export to spreadsheet, SAP Fiori 'Export to Excel', and scheduled list extracts. Fine for ad hoc work, stale by definition.
  • Released OData services (V2 and V4) from the SAP Business Accelerator Hub for sales orders, purchase orders, business partners, products and stock. Exact names vary by release.
  • On-prem exposure is through the SAP Gateway (/IWFND/MAINT_SERVICE) behind SAP Web Dispatcher or a reverse proxy; cloud editions use communication arrangements with OAuth 2.0 or basic authentication to a communication user.
  • A thin gateway or API management layer (SAP API Management, Azure API Management or your own) that adds a read-only allow list, throttling and logging before ChatGPT sees anything.
  • ChatGPT side: custom GPT actions defined by an OpenAPI schema, and ChatGPT apps or connectors for enterprise workspaces. Capabilities and plan names change often, so check current OpenAI documentation.

How it works

  1. 1

    Decide the data class

    Classify what the questions will touch. Pricing, customer lists and export-controlled part data usually rule out a public service, whereas generic master data may be acceptable.

  2. 2

    Pick a plan with the right data controls

    Business and enterprise offerings state that customer data is not used to train models by default and offer admin controls. Confirm the terms and retention for your plan in writing.

  3. 3

    Build the gateway

    Create endpoints such as GET /orders/{id}/status that call the released sales order service with a technical user and return only the fields needed. Do not expose raw OData to the model.

  4. 4

    Describe the endpoints as an OpenAPI schema

    Write short, precise descriptions. The model decides when to call an action based on them, so vague text causes wrong calls.

  5. 5

    Configure authentication

    Use OAuth with a per-user identity where possible, so SAP authorizations apply to each person. A single shared key is simple but means every user sees the same scope.

  6. 6

    Pilot with a small group and review logs

    Sample real conversations, check for wrong calls and sensitive fields, and tighten the gateway before widening access.

Example flows

Customer service order lookup

Trigger: A rep asks the custom GPT for the status of a sales order.

  1. The GPT calls the gateway status endpoint with the order number.
  2. The gateway authenticates and calls the sales order OData service with the rep's scope.
  3. It adds delivery and billing status from related services and returns a compact JSON.
  4. The GPT replies with status, next milestone and the delivery date.

Result: Common questions are answered without a SAP GUI session.

Masked invoice variance explanation

Trigger: An AP clerk opens a blocked invoice and wants an explanation.

  1. The clerk exports the line comparison from the Fiori app.
  2. A masking script replaces vendor and part identifiers with tokens.
  3. The clerk pastes the masked data into ChatGPT and asks for the cause.
  4. The clerk applies the fix in SAP; no write-back occurs.

Result: A fast explanation with no live connection and limited exposure.

Keeping data on-prem

If data must stay inside your network, ChatGPT is the wrong place for it, because prompts and tool results travel to the provider. The alternative is a private model served on your own hardware and wired to the same gateway, with the same OpenAPI-style tool descriptions, so users get a chat experience without leaving the perimeter. A common compromise is two lanes: ChatGPT for generic work with no business data, and a private assistant for anything that touches orders, prices or drawings. For defense and aerospace programs that handle export-controlled data, the private lane is usually the only acceptable one.

Security checklist

  • Never expose the SAP Gateway directly to the internet. Put an API gateway with allow listing, rate limits and logging in front.
  • Prefer per-user OAuth so SAP roles still apply. If you use a shared technical user, scope it to read-only and the minimum fields.
  • Mask or tokenize customer, vendor and part identifiers before any manual paste into a public service.
  • Confirm the data retention, training and regional processing terms for your ChatGPT plan with your legal team.
  • Log which user triggered which action and what was returned, and review it regularly.

Ways to get it done

Manual export plus ChatGPT

Effort: Minutes, but it depends on user discipline.

Fine for non-sensitive analysis and drafting, no integration needed.

Custom GPT or app with a gateway

Effort: Days to a few weeks including security review.

Good for read-only lookups when policy allows a cloud model.

Private assistant built with a partner such as Netray

Effort: Weeks for a pilot, depending on how many services you expose.

Good when data cannot leave your network or you need an agent that does more than answer.

Pitfalls

  • !Pasting full exports with prices and customer names into a personal ChatGPT account.
  • !Exposing the whole OData service to the model. Wrap it and return only needed fields.
  • !Using one shared technical user so everyone sees the same data, regardless of their SAP role.
  • !Assuming the answer is right. Models can misread columns, so have the gateway return labeled fields, not raw tables.
  • !Forgetting that plan features, connectors and limits change. Recheck before building on them.

Frequently asked questions

Can ChatGPT connect directly to S/4HANA?

Not out of the box. It needs an API it can call, usually a gateway in front of released OData services, plus authentication. Without that, you are limited to exports and pasted data. The gateway is where you enforce read-only access and logging.

Is it safe to put SAP data into ChatGPT?

It depends on the data and the plan. Business and enterprise terms differ from personal accounts. For pricing, customer lists or export-controlled data, many companies decide on a private model instead. Get a written policy before rollout.

Does ChatGPT respect SAP authorizations?

Only if you build it that way. If the gateway uses per-user OAuth or filters by the user's scope, yes. If it uses a shared technical user, everyone sees what that user can see. Design this first.

Can it write back to SAP?

It can if you expose write endpoints, but we advise against it at the start. Have it create drafts or requests that a person approves in SAP, which also keeps your audit trail clean.

What is the alternative if we cannot use a public model?

Run an open-weight model on your own GPUs and connect it to the same gateway. Quality for structured lookups and summaries is usually adequate, and nothing leaves your network.

Want ChatGPT working on your SAP S/4HANA?

A free 30 minute assessment: we map the integration path for your version and setup, and where it should run.

Get a free assessment