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
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
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
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
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
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.
Where Netray fits
ERPray
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
Where you need specific principal propagation, SIEM integration or agent approval flows wired into your SAP workflow, we build them to your security design.
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.
- 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?
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.
Related guides
AI for SAP S/4HANA, Running On-Prem or in Your Private Cloud
Run AI on SAP S/4HANA without sending ERP data to a public API. On-prem and private-cloud architecture, CDS views, OData, and honest deployment trade-offs.
SAP Joule + on-prem alternativeSAP Joule or a Private LLM Beside SAP: An Honest Comparison
An honest comparison of SAP Joule and Business AI against a private, self-hosted LLM beside SAP: what each covers, where they overlap, and where CIOs run both.
DFARS 7012 + NIST 800-171Mapping DFARS 7012 and NIST 800-171 Controls to AI on Your ERP
Map DFARS 252.204-7012 and NIST SP 800-171 control families to an AI system layered on your ERP, with evidence a Compliance Manager can defend.
SAP BTP + self-hosted AISAP BTP and a Private LLM: Where the Generative AI Hub Fits and Where It Doesn't
Where SAP BTP's Generative AI Hub fits and where a self-hosted LLM belongs instead. CAP, Integration Suite, and an architecture decision framework.
SAP AI Buyer GuideSAP AI Consulting for On-Prem and Private Deployments
What to demand from an SAP AI consulting partner when data must stay on-prem or private: OData/BAPI mechanics, Joule vs. private LLM, and buyer questions.
SAP ECC 6.0 + AIGet AI Value From SAP ECC Now, and Use It to De-Risk the Move to S/4HANA
SAP ECC 6.0 mainstream maintenance ends in 2027. Add AI value on ECC now, using its existing BAPIs and IDocs, and use it to de-risk the S/4HANA migration.
Plan it with numbers
SAP Critical Authorization Objects Reference
A searchable table of sensitive SAP authorization objects with their key fields and the risk each one carries, useful for audits and role reviews.
Free ToolSAP Basis Security Hardening Assessment
Answer ten questions about your SAP system security basics and get a score with the gaps to close first.
Free ToolMCP Server Security Checklist
Work through authentication, authorization, input handling, prompt injection, secrets, logging and deployment before an MCP server touches ERP data.
GuideSecurity Hardening for On-Prem AI Stacks
Security hardening for on-prem AI stacks: container isolation, model supply chain, prompt injection defenses, and audit logging for defense contractors.
GuideSecurity Review for AI Agents in the Enterprise
A security review checklist for enterprise AI agents: data residency, identity and access, prompt injection defense, logging, and vendor risk for manufacturers.
GuideA Data Governance Framework for Private AI
A practical data governance framework for private AI: classification, access controls, retention, and audit patterns that satisfy CMMC 2.0 and ITAR.
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
Record SoD conflicts between SAP functions, score them by likelihood and impact, and log the mitigating control and owner for each.
Keep exploring
Free tools
- SAP Segregation of Duties Conflict Matrix WorksheetRecord SoD conflicts between SAP functions, score them by likelihood and impact, and log the mitigating control and owner for each.
- SAP Security Profile Parameters ReferenceA searchable reference of the profile parameters that control SAP logon, passwords, authorization checks, RFC, gateway and audit logging.
- MCP Server Security ChecklistWork through authentication, authorization, input handling, prompt injection, secrets, logging and deployment before an MCP server touches ERP data.
ERP fixes and how-tos
- How to add AI to SAP ECC 6.0 on-prem without moving data to a cloudReference architecture for a private on-prem AI assistant on SAP ECC 6.0: RFC and BAPI reads, SLT replica, retrieval index, local LLM, permission mirroring.
- How to Securely Give an LLM Access to ERP DataHow a CTO can give an LLM access to ERP data safely: read-only roles, per-user permissions, prompt injection defenses, logging, and where the model runs.
- How to Run an ERP User Access Review (Quarterly Checklist)How an IT manager runs an ERP user access review: pull the user and role list, get owner sign-off, test segregation of duties, and keep audit evidence.
Runs with your ERP
- SAP Joule in S/4HANA Cloud Public Edition: what it does for manufacturersWhat SAP Joule does in S/4HANA Cloud Public Edition for manufacturers: natural-language navigation and supply chain insights, limits, setup and trade-offs.
- delaware Production Scheduling Board with SAP S/4HANAHow delaware's Production Scheduling Board on SAP BTP gives planners a visual schedule for rush orders and resequencing in S/4HANA: setup and pitfalls.
Guides
- Security Review Checklist for Enterprise AI AgentsA security review checklist for enterprise AI agents: data residency, identity and access, prompt injection defense, logging, and vendor risk for manufacturers.
- RAG Security: Access Control, Data Isolation, and Injection DefenseSecuring enterprise RAG: row-level access control in retrieval, preventing cross-tenant leakage, prompt injection through documents, and audit logging.
- Security Hardening for On-Prem AI Stacks: A Defense Contractor's GuideSecurity hardening for on-prem AI stacks: container isolation, model supply chain, prompt injection defenses, and audit logging for defense contractors.
AI on your ERP
- SAP AI Consulting for On-Prem and Private DeploymentsWhat to demand from an SAP AI consulting partner when data must stay on-prem or private: OData/BAPI mechanics, Joule vs. private LLM, and buyer questions.
- AI on SAP ECC vs S/4HANA: What Each Platform Can Actually RunAI on SAP ECC vs S/4HANA: Joule and embedded AI, data model and API differences, and what a private model can run on ECC today before you migrate.
Integrations
- How to add AI agents to SAP ECC 6.0How to add AI agents to SAP ECC 6.0: a tool layer over BAPIs, RFC and IDocs, human approval before any posting, and an on-prem model that never leaves your network.
- How to build an MCP server for SAP ECC 6.0How to build a Model Context Protocol server for SAP ECC 6.0: which BAPI-backed tools to expose, RFC auth, stdio vs HTTP, permission scoping and audit logging.