SAPUse Case

SAP security + AI

SAP AI Security: How to Let an LLM Read SAP Data Without Breaking Your Authorisation Model

Short answer

SAP AI security comes down to three controls: the AI must act with the end user's SAP authorisations rather than a broad technical user, every query it runs must be logged and attributable, and any write-back must go through a human approval and normal SAP posting checks. Prompt injection from free-text fields and over-broad RFC or OData scope are the most common real risks.

ERP
SAP S/4HANA, SAP ECC 6.0, SAP BTP
Industries
Aerospace, Defense, Manufacturing, Pharmaceuticals
Written for
SAP Security Lead

The first question an SAP security team asks about any AI project is simple: which user does it log on as? Too often the honest answer is a single technical user with wide table access, created so the pilot could move fast. That one decision quietly bypasses years of PFCG role design, organisational level restrictions and segregation of duties work.

AI does not need new security principles in SAP. It needs the existing ones applied consistently: least privilege, attributable access, logging and controlled change. What is new is the interaction pattern. A language model composes queries on the fly, reads free text that users and suppliers wrote, and can be steered by that text. Those properties create risks that a classic report or interface never had.

SAP's own AI, including Joule and embedded features in cloud editions, runs inside SAP's security model and respects the user's roles, which is a real advantage. If you build or buy AI that sits beside SAP, you need to reproduce that discipline yourself, and you should be suspicious of any vendor who cannot explain exactly how.

This page sets out the concrete controls: identity and principal propagation, authorisation objects that matter, prompt injection defences, logging and audit evidence, and the line between read-only answers and write-back.

What usually gets in the way

The problems we hear most from sap security lead teams running SAP S/4HANA.

One technical user with SAP_ALL-like scope

Pilots often use a communication user with broad S_TABU_DIS or S_RFC authorisations. Every AI answer then reflects what the technical user can see, not what the person asking is allowed to see.

Organisational restrictions get lost

Your roles restrict by company code, plant, sales organisation and purchasing group. A generic database or extractor connection ignores all of them, so a plant user can suddenly ask about another division's margins.

Free text can carry instructions

Material long texts, PO header notes, service notifications and supplier emails are written by many people. A malicious or careless line in a text field can try to redirect an AI agent that reads it.

AI queries are invisible to audit

Security Audit Log and Read Access Logging were configured for dialog users and known interfaces. An AI layer that queries through a pooled connection leaves no trace of which person asked what.

Write-back skips SoD

An agent that can create purchase orders or post goods movements under a technical user can break segregation of duties that GRC Access Control was set up to enforce.

Where AI earns its place in SAP S/4HANA

Each use case names the ERP objects it reads or writes, so your ERP team can judge the integration effort before anyone commits budget.

Principal propagation for AI queries

The AI layer passes the signed-in user's identity to SAP so OData services and RFCs execute under that user's roles, rather than a shared account.

Touches: SAML or OAuth principal propagation, SAP Cloud Connector, SNC with X.509, PFCG roles

Outcome: AI answers respect existing authorisations, including organisational levels, without duplicating role logic.

Scoped technical users where propagation is impossible

For batch indexing or extraction, use a dedicated communication user with read-only access limited to the specific tables, views and function modules required.

Touches: S_TABU_NAM, S_RFC by function group, S_SERVICE for OData, user type System or Communication

Outcome: The blast radius of a compromised AI component is limited to named, reviewable objects.

Row-level filtering in the retrieval layer

Indexed documents and records carry company code, plant and sales org tags, and retrieval filters by the asking user's authorisations before the model sees anything.

Touches: Organisational levels from AGR_1251 and user assignments in AGR_USERS

Outcome: Users cannot retrieve indexed content from organisations they are not authorised for.

Prompt injection screening on SAP free text

Text pulled from long texts, notes and attachments is treated as data, screened for instruction-like content and never allowed to change the tools an agent may call.

Touches: STXH/STXL long texts, PO header texts, QM and PM notification texts, GOS attachments

Outcome: A line in a supplier note cannot trigger an action or widen what the agent retrieves.

Attributable query logging

Every question, the generated query, the SAP objects touched and the answer are logged with the real user, then forwarded to your SIEM next to SAP's own logs.

Touches: Security Audit Log (SM20 / RSAU_READ_LOG), Read Access Logging, SIEM integration

Outcome: Auditors can trace any AI answer back to a person, a time and the records it used.

Approval gate for write-back

Any transaction proposed by an agent is created as a draft or parked document and posted only by a user who holds the authorisation, under normal SAP checks.

Touches: Parked documents, purchase requisitions with release strategy, workflow approvals

Outcome: Segregation of duties and release strategies remain intact even with agents in the loop.

AI access review alongside role reviews

Include AI technical users, OData services exposed to AI and agent tool lists in the periodic access recertification run for SAP roles.

Touches: GRC Access Control risk analysis, SUIM reports, user access reviews

Outcome: AI access is reviewed with the same rigour as human access, not left as a forgotten exception.

Reference architecture

The AI layer sits outside SAP but authenticates per user, filters retrieval by authorisation, treats SAP text as untrusted input and logs every action. Write operations are proposals that SAP itself validates and a human posts.

  1. 1

    Identity

    Single sign-on through your identity provider with principal propagation to SAP, so each request carries the real user. Shared technical users are limited to indexing jobs with narrow scope.

  2. 2

    SAP access layer

    Released OData services and CDS views in S/4HANA, or whitelisted BAPIs and function modules over RFC in ECC. No direct database access for interactive queries.

  3. 3

    Retrieval with authorisation filters

    Index entries carry organisational tags; the retriever applies the user's allowed values before ranking so unauthorised content never reaches the prompt.

  4. 4

    Model and guardrails

    A private model with a fixed system policy, tool allow-lists per role and content screening on retrieved text. Instructions found inside data are ignored by design.

  5. 5

    Audit and monitoring

    Structured logs of prompts, queries, records and outputs, forwarded to the SIEM, with alerts on unusual volumes or out-of-scope requests.

Integration notes for your ERP team

  • Prefer principal propagation through SAP Cloud Connector or SNC so the SAP user is the real user; avoid pooled dialog users entirely.
  • Grant S_RFC by function group or function module name, never by wildcard, for any RFC-based AI integration.
  • Use S_TABU_NAM for table-level read access instead of broad S_TABU_DIS authorisation groups when a technical user must read tables.
  • Activate only the specific OData services the AI needs in /IWFND/MAINT_SERVICE and assign S_SERVICE accordingly.
  • Configure Security Audit Log filters to capture the AI technical users and RFC calls, and forward logs to the SIEM.
  • Treat SAP long texts, notes and attachments as untrusted input in the agent design; they may inform an answer but never select tools.
  • Run GRC Access Control risk analysis on any role assigned to an AI component before go-live.

Deployment options

On-prem, inside the SAP security zone

Defense, aerospace and regulated manufacturers with strict network segmentation.

Model, index and logs sit in the same controlled network as SAP. Nothing leaves the boundary.

Private cloud next to RISE or self-managed SAP

Companies running SAP in a hyperscaler account they control.

Private connectivity to the SAP landscape, customer-managed keys, and no use of shared public inference endpoints.

SAP-native AI with external governance

Cloud edition customers using Joule and embedded AI.

SAP's AI respects roles natively; add your own review of AI feature enablement, data processing terms and logging requirements.

Compliance and data control

How the architecture supports your obligations. Certification and accountability stay with your organisation; the design keeps the evidence straightforward.

SOX and internal controls

AI write-back is restricted to drafts that a properly authorised user posts. AI technical users enter access reviews, and logs support evidence of who did what.

NIST SP 800-171 / CMMC

Per-user authentication, least privilege, audit logging and boundary protection map directly onto access control, audit and system protection families, supporting the customer's own assessment.

ITAR / EAR

Controlled technical data in SAP stays within the customer's environment when the model runs on-prem; access filters keep it to authorised persons as defined by the customer.

GDPR

Read Access Logging and authorisation filters limit personal data exposure; retention rules for prompts and logs are set to match the customer's data protection policy.

FDA 21 CFR Part 11

Where SAP holds GxP records, AI stays read-only and does not create or alter electronic records; any record change follows validated SAP processes.

How an engagement runs

Phase 1 . 1-2 weeks

Security design review

  • -Threat model for the AI use case
  • -Identity and propagation design
  • -Authorisation object list for AI access

Phase 2 . 2-4 weeks

Controls build

  • -Scoped technical users and roles
  • -Retrieval authorisation filters
  • -Prompt injection screening rules

Phase 3 . 2-3 weeks

Logging and testing

  • -SIEM integration and alerting
  • -Red-team tests with injected text
  • -Authorisation boundary test cases

Phase 4 . 1-2 weeks

Audit readiness

  • -Control documentation
  • -Access review procedure for AI
  • -Evidence pack for internal audit

Questions to ask any vendor, including us

A short list that separates real SAP S/4HANA AI work from a chatbot demo.

  1. Which SAP user does each AI request run as, and can you show it in the Security Audit Log?
  2. How do you enforce company code, plant and sales organisation restrictions in retrieval?
  3. What exactly happens if a supplier note contains instructions aimed at the AI?
  4. Which authorisation objects does your technical user need, and can we review them?
  5. Can the AI write to SAP, and if so what stops it posting without approval?
  6. Where are prompts and answers stored, for how long, and who can read them?
  7. How does your access fit our GRC Access Control rule set?

Frequently asked questions

Is it safe to connect an LLM to SAP?

It can be, if the integration respects SAP's authorisation model. The safe pattern authenticates each user, uses released APIs rather than raw database access, filters retrieved content by the user's organisational authorisations, logs every request and keeps write-back behind human approval. The unsafe pattern, common in quick pilots, uses one broad technical user and sends everything to a public model. The risk is in the integration design, not in the idea of AI reading SAP.

Does SAP Joule respect user authorisations?

Yes. Joule runs within SAP's cloud applications and works with the signed-in user's roles, so it only surfaces data and actions that user is authorised for. That is one of the stronger arguments for SAP's own AI where it is available. Third-party AI beside SAP has to reproduce the same behaviour deliberately, usually through principal propagation and authorisation-aware retrieval.

What is prompt injection in an SAP context?

It is text inside data the AI reads that tries to change the AI's behaviour, for example a sentence in a PO note telling the assistant to ignore restrictions or to email a report externally. In SAP, sources include long texts, notification descriptions, supplier documents and email attachments. Defences are to treat data as data, keep tool choice fixed by role, screen retrieved text for instruction patterns and never let an agent act without approval.

Can we use a technical user at all?

For background indexing or extraction, often yes, provided it is a System or Communication user type with narrowly scoped read authorisations on named tables, views or function modules. For interactive questions, the request should run as the real user wherever possible. If a technical user must serve interactive queries, the AI layer must apply authorisation filtering itself and log the real user identity alongside every request.

How do auditors see what the AI did?

By combining SAP's own logs with the AI layer's logs. SAP Security Audit Log and Read Access Logging show which user called which service or read which fields. The AI layer logs the question, the generated query, the records returned and the answer, tagged with the same user. Forwarding both to your SIEM gives a single trail an auditor can follow.

Should AI ever post transactions in SAP?

Rarely without a human. The pattern that works is for the agent to prepare a draft, such as a purchase requisition subject to release strategy or a parked invoice, and for an authorised user to review and post. That keeps segregation of duties, release strategies and SAP's own validations in force. Fully autonomous posting should be limited to low-risk, reversible actions with explicit sign-off from process owners and audit.

Does running the model on-prem solve security?

It solves data residency and third-party exposure, which matters for ITAR, CUI and trade secrets. It does not solve authorisation, injection or audit; a private model with a broad technical user is still a security problem. On-prem hosting is one control among several, and the integration design matters as much as where the GPUs sit.

Talk it through with an engineer who knows SAP S/4HANA

Bring one real question your team cannot answer from the ERP today. We will map the data path, the model, and where it runs, and tell you honestly if AI is the wrong tool for it.

Try it here, free

SAP Segregation of Duties Conflict Matrix Worksheet

Open full tool

Record SoD conflicts between SAP functions, score them by likelihood and impact, and log the mitigating control and owner for each.

Get ERP alerts and new tools

Support deadlines, release changes and new free tools for the ERP you run. A couple of emails a month at most.

Free. Unsubscribe with one click from any email.

ArchRay builder
Design the on-prem AI stack: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Runs with your ERP

Guides

AI on your ERP

Integrations