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

> Source: https://netray.co/erp-ai/sap-ai-security-authorization-governance
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: AI for ERP

## 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.

## Kind

use-case

## Erp Family

sap

## Erp Products

- SAP S/4HANA
- SAP ECC 6.0
- SAP BTP

## Industries

- Aerospace
- Defense
- Manufacturing
- Pharmaceuticals

## Region

Global

## Persona

SAP Security Lead

## Eyebrow

SAP security + AI

## Intro

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.

## Pain Points

### One technical user with SAP_ALL-like scope

**Detail:** 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

**Detail:** 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

**Detail:** 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

**Detail:** 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

**Detail:** 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.

## Use Cases

### Principal propagation for AI queries

**Description:** 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.

**Erp Objects:** 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

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

**Erp Objects:** 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

**Description:** 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.

**Erp Objects:** 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

**Description:** 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.

**Erp Objects:** 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

**Description:** 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.

**Erp Objects:** 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

**Description:** 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.

**Erp Objects:** 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

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

**Erp Objects:** 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.

## Architecture

**Overview:** 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.

**Layers:**

#### Identity

**Detail:** 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.

#### SAP access layer

**Detail:** 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.

#### Retrieval with authorisation filters

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

#### Model and guardrails

**Detail:** 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.

#### Audit and monitoring

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

## Deployment Options

### On-prem, inside the SAP security zone

**Fit:** Defense, aerospace and regulated manufacturers with strict network segmentation.

**Detail:** 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

**Fit:** Companies running SAP in a hyperscaler account they control.

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

### SAP-native AI with external governance

**Fit:** Cloud edition customers using Joule and embedded AI.

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

## Compliance

### 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.

**Framework:** SOX and internal controls

### 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.

**Framework:** NIST SP 800-171 / CMMC

### 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.

**Framework:** ITAR / EAR

### 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.

**Framework:** GDPR

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

**Framework:** FDA 21 CFR Part 11

## Integration Notes

- 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.

## Product Fit

### ERPray

**Why:** Read-only by default, shows the query behind each answer, respects ERP roles and logs every request, which matches the controls on this page.

### Custom build

**Why:** Where you need specific principal propagation, SIEM integration or agent approval flows wired into your SAP workflow, we build them to your security design.

## Engagement

### Security design review

**Duration:** 1-2 weeks

**Deliverables:**

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

### Controls build

**Duration:** 2-4 weeks

**Deliverables:**

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

### Logging and testing

**Duration:** 2-3 weeks

**Deliverables:**

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

### Audit readiness

**Duration:** 1-2 weeks

**Deliverables:**

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

## Buyer Questions

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

## Faq

### Is it safe to connect an LLM to SAP?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

sap ai security, sap llm security, sap ai governance, prompt injection sap, sap ai authorization, secure ai access to sap data, sap principal propagation ai, sap ai audit logging, joule security authorizations, sap ai segregation of duties, private ai sap data, sap genai risk

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
