SAP HANA + AI
AI on SAP HANA Data: HANA Cloud Vector Engine, PAL, or a Private RAG Beside HANA
Short answer
There are three ways to put AI on SAP HANA data: use SAP HANA Cloud's vector engine for embeddings and similarity search inside HANA, use the Predictive Analysis Library for classical machine learning in the database, or run a private RAG system beside HANA that reads released views. Licence type, deployment and whether you need non-SAP data decide which fits.
- ERP
- SAP HANA, SAP HANA Cloud, SAP S/4HANA, SAP BW/4HANA
- Industries
- Manufacturing, Aerospace, Electronics, Defense
- Written for
- SAP Data Architect
SAP HANA sits under S/4HANA, BW/4HANA and many custom applications, so it holds a large share of the data that manufacturers want to ask questions about. Naturally, data teams ask whether they can build AI directly on HANA rather than copying data elsewhere.
SAP has added AI capabilities to HANA. SAP HANA Cloud includes a vector engine for storing embeddings and running similarity search, which is what retrieval-augmented generation needs, along with a knowledge graph engine. HANA has long included the Predictive Analysis Library and Automated Predictive Library for classical machine learning such as regression, classification, clustering and time series forecasting. These are real tools, well suited to teams already invested in HANA Cloud and BTP.
Two practical constraints shape the decision. First, licensing: many SAP customers run HANA under a runtime licence bundled with SAP applications, which typically restricts direct access by non-SAP applications and custom development. Reading data through released CDS views and APIs, or holding a full-use licence, is usually required. Second, scope: manufacturing questions often need MES, PLM and document data that does not live in HANA.
This page explains the options, where each fits, and how to design retrieval over HANA-based data without breaking licences or authorisations.
What usually gets in the way
The problems we hear most from sap data architect teams running SAP HANA.
Licence restrictions
Runtime HANA licences commonly prohibit direct access by third-party tools, so a quick SQL connection for an AI pilot can create a compliance problem.
Semantic complexity
Raw HANA tables under S/4HANA are hard to use directly; meaning lives in CDS views, calculation views and application logic.
On-prem versus cloud features
The vector engine is a HANA Cloud capability; on-prem HANA customers need to check what their release supports before planning around it.
Data outside HANA
Documents, PLM data and plant systems needed for many answers are not in HANA, so in-database AI covers only part of the question.
Authorisations
Analytic privileges and application authorisations must still apply when AI retrieves data; direct database users often bypass them.
Where AI earns its place in SAP HANA
Each use case names the ERP objects it reads or writes, so your ERP team can judge the integration effort before anyone commits budget.
Vector search in HANA Cloud
Store embeddings of product texts, documents or notifications in HANA Cloud and run similarity search for retrieval, near the business data.
Touches: HANA Cloud vector engine (REAL_VECTOR type, similarity functions), document tables
Outcome: Retrieval inside the SAP data platform with SAP-managed operations.
Classical ML with PAL
Run forecasting, classification or anomaly detection inside HANA using the Predictive Analysis Library.
Touches: PAL procedures, calculation views as input, result tables
Outcome: Numeric predictions computed where the data lives, without data movement.
Private RAG over released views
Extract data through CDS views or OData into a private retrieval index alongside documents, used by an on-prem model.
Touches: Released CDS views, OData APIs, BW/4HANA queries, document stores
Outcome: Answers combining SAP and non-SAP data with licence-safe access.
Text-to-query over curated views
The model generates queries only against a curated set of views with documented semantics, never raw tables.
Touches: Curated CDS or calculation views, view documentation
Outcome: More reliable answers because the model works with business-meaningful structures.
Similar notification search
Find similar past quality or maintenance notifications using embeddings of their text and attributes.
Touches: QM and PM notification texts, codes, equipment
Outcome: Faster investigations using prior resolutions.
BW/4HANA analytics questions
Ask questions over BW/4HANA models in plain language, with the model calling defined queries.
Touches: BW/4HANA CompositeProviders, queries
Outcome: Business users get answers from existing analytic models without building reports.
Anomaly detection on postings
Use PAL or external models to flag unusual postings or movements for review.
Touches: ACDOCA through CDS views, MATDOC through CDS views
Outcome: Early identification of errors and unusual activity for finance and inventory teams.
Reference architecture
Choose between in-HANA AI (HANA Cloud vector engine and PAL) and a private RAG layer beside HANA that reads released views. Many landscapes use both: PAL for numeric models and private RAG for language-based answers across systems.
- 1
HANA data
S/4HANA, BW/4HANA or custom schemas, accessed through CDS views, calculation views and APIs.
- 2
In-database AI
HANA Cloud vector engine and PAL for embeddings, similarity search and classical ML where licensed.
- 3
Extraction layer
For private RAG: scheduled extraction through released views or OData into an external index such as pgvector or Qdrant.
- 4
Private model
An open-weight model on your GPUs using retrieval from HANA-based data and other sources.
- 5
Authorisation
Analytic privileges and application roles enforced either by HANA or by retrieval filters in the private layer.
Integration notes for your ERP team
- Confirm whether your HANA licence is runtime or full use before connecting any non-SAP tool directly.
- Prefer released CDS views (I_ and C_ prefixes) or OData APIs for S/4HANA data extraction.
- Vector engine availability differs between HANA Cloud and on-prem HANA releases; check your release.
- Keep embeddings refreshed incrementally using change timestamps on source views.
- Apply analytic privileges or equivalent retrieval filters so users only see authorised data.
- Document the semantics of each curated view; the model's accuracy depends on it.
Deployment options
HANA Cloud native
Companies already using HANA Cloud and BTP.
Use the vector engine and SAP's generative AI hub; keep data inside SAP's platform.
Private RAG beside on-prem HANA
On-prem S/4HANA customers, runtime licence holders, restricted environments.
Read through released views, index externally, run models on-prem.
Hybrid
Companies with HANA Cloud for analytics and on-prem operational systems.
PAL or vector engine for SAP-centric models; private layer for cross-system language questions.
Compliance and data control
How the architecture supports your obligations. Certification and accountability stay with your organisation; the design keeps the evidence straightforward.
SAP licensing
Confirm HANA licence type before any direct access; use released views and APIs under runtime licences.
ITAR / EAR
Controlled data extracted for retrieval stays on-prem with the private model.
SOX
AI is read-only on financial data; anomaly flags feed existing review processes.
GDPR
Personal data in embeddings follows the same retention and deletion rules as source data.
How an engagement runs
Phase 1 . 1 week
Landscape and licence review
- -HANA licence assessment
- -Data source inventory
- -Use case shortlist
Phase 2 . 2 weeks
Design
- -In-HANA vs private RAG decision
- -Curated view list
- -Authorisation design
Phase 3 . 4-6 weeks
Pilot
- -Retrieval pipeline
- -Model endpoint
- -Evaluation set
Phase 4 . 3-4 weeks
Production
- -Incremental refresh
- -Monitoring
- -Governance
Questions to ask any vendor, including us
A short list that separates real SAP HANA AI work from a chatbot demo.
- Do we hold a runtime or full-use HANA licence, and what access does it permit?
- Does our HANA release support the vector engine?
- Which curated views will the AI use, and who maintains them?
- How are analytic privileges enforced in retrieval?
- What non-SAP data does the use case need?
- Where are embeddings stored and how are they refreshed?
Frequently asked questions
Does SAP HANA have a vector database?
SAP HANA Cloud includes a vector engine that stores embeddings in a vector data type and supports similarity search functions, which is the core of retrieval-augmented generation. Availability for on-prem HANA depends on release, so check SAP's documentation for your version. For many teams already on HANA Cloud, keeping vectors next to business data is attractive.
Can we connect an AI tool directly to HANA with SQL?
Technically yes, but licensing often says no. Many customers license HANA as a runtime database bundled with SAP applications, which typically restricts direct access by non-SAP applications. Check your contract. Under runtime licences, use released CDS views, OData APIs or SAP-approved extraction methods instead.
What is PAL in SAP HANA?
The Predictive Analysis Library is a set of machine learning algorithms that run inside HANA, covering regression, classification, clustering, time series and more. It suits numeric prediction tasks close to the data. It is not a language model and does not answer questions in plain language, but it pairs well with a language model layer.
Should we use HANA Cloud vector engine or an external vector store?
Use HANA Cloud if you are already on it, your data is mostly SAP, and SAP's platform meets your deployment needs. Use an external store such as pgvector or Qdrant with a private model when you need on-prem deployment, mix SAP with many non-SAP sources, or face licence restrictions on HANA access.
Why not let the model query raw S/4HANA tables?
Raw tables are large, technical and change between releases, and their meaning depends on application logic. Models produce far more reliable results against curated, documented CDS or calculation views. Released views are also the access path SAP supports, which matters for licensing and upgrades.
How do we enforce authorisations in a RAG system?
Either let HANA enforce analytic privileges by querying as the end user, or tag indexed content with organisational attributes and filter retrieval by the user's authorisations before the model sees anything. The second approach is common for private RAG and must be designed and tested explicitly.
Can BW/4HANA data be used for AI?
Yes. BW/4HANA models and queries already encode business meaning, so a model calling defined queries can answer analytic questions reliably. This often delivers value faster than building new views on S/4HANA, especially for historical analysis.
Related guides
SAP 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 S/4HANA + private AIAI 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 Business AI guideSAP Business AI Capabilities Explained: What You Get, What It Needs, and Where the Gaps Are
What SAP Business AI includes: Joule, embedded AI, agents, AI Core and Document AI. Which editions get what, how AI units work, when private AI fills gaps.
SAP security + AISAP AI Security: How to Let an LLM Read SAP Data Without Breaking Your Authorisation Model
SAP AI security: technical users, PFCG roles, S_RFC and OData scope, prompt injection from long texts, audit logging and SoD when AI reads SAP data.
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 HANA Memory Sizing Calculator
First-pass SAP HANA memory and disk estimate from source database size, compression ratio, growth and work space, with a growth-by-year chart.
Free ToolRAG Infrastructure Sizing Calculator
Estimate vector storage, node RAM, generation GPUs, and monthly infrastructure cost for a retrieval-augmented generation deployment over your document corpus.
Free ToolSAP BW and BW/4HANA Private AI Layer Blueprint Generator
Fill in your version, database, hosting and use cases to get an architecture plan for adding a private, on-prem AI assistant to SAP BW/4HANA, with components, security controls and a three-phase rollout.
GuideEnterprise RAG Architecture: The Full 2026 Blueprint
A practitioner's blueprint for enterprise RAG in 2026: ingestion, chunking, embedding, retrieval, rerank, generation, and the eval loop that keeps it honest.
GuideChoosing a Vector Database for On-Prem RAG
Compare vector databases for on-prem RAG: Qdrant, Weaviate, Milvus, and pgvector on performance, filtering, security, and ops burden for enterprise AI.
GuideRAG Chunking Strategies: Fixed, Semantic, Structural, and Late
Compare RAG chunking strategies, fixed-size, semantic, structural, and late chunking, with concrete guidance on chunk size, overlap, and when each wins.
Talk it through with an engineer who knows SAP HANA
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 HANA SQL Error Codes Reference
Searchable table of common SAP HANA 2.0 SQL error codes with the error text, typical cause, the view or trace to check first and the fix.
New to SAP HANA and Basis? Start with the SAP HANA and Basis guide and toolkit.
Keep exploring
Free tools
- SAP HANA SQL Error Codes ReferenceSearchable table of common SAP HANA 2.0 SQL error codes with the error text, typical cause, the view or trace to check first and the fix.
- SAP HANA Monitoring Views Reference (M_ System Views)One row per SAP HANA monitoring view with the key columns to select and the question it answers: memory, table size, disk, backups, locks, sessions and SQL.
- S/4HANA HANA Memory Sizing EstimatorRough-size the HANA database memory and persistence you will need from your current database footprint.
ERP fixes and how-tos
- SAP S/4HANA API Guide: Business Hub, OData, Public Cloud and Business PartnerA guide to SAP S/4HANA APIs: the Business Accelerator Hub, A2X OData, the Business Partner API, public cloud communication arrangements, PI/PO and Digital Manufacturing.
- Private AI for SAP Business One: Service Layer, a read replica and a local modelAdd a private AI assistant to SAP Business One: Service Layer reads, SQL Server or HANA replica, document index, local LLM, permissions and approvals.
- SAP S/4HANA API Documentation: Where It Is and How to Use ItWhere to find S/4HANA API documentation (SAP Business Accelerator Hub), OData vs SOAP, authentication on cloud and on-prem, and key manufacturing APIs.
Guides
- 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.
- Choosing a Vector Database for On-Prem RAG: Qdrant vs Weaviate vs Milvus vs pgvectorCompare vector databases for on-prem RAG: Qdrant, Weaviate, Milvus, and pgvector on performance, filtering, security, and ops burden for enterprise AI.
- Techniques to Reduce RAG Cost: Where the Money Actually GoesTechniques to reduce cost in a RAG architecture: rerank to send fewer chunks, cache prompts, route queries, shrink embeddings, quantize, or self-host at volume.
AI on your ERP
- A Private LLM Grounded on Your ERP DataHow a private LLM answers questions on your ERP data: RAG plus text-to-SQL, role-based permissions inherited from the ERP, and where each fits.
- SAP Joule or a Private LLM Beside SAP: An Honest ComparisonAn 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.
Integrations
- How to connect Power BI to SAP S/4HANAConnect Power BI to SAP S/4HANA using the HANA connector, OData or a warehouse, set up the on-prem gateway, and build manufacturing dashboards with AI Q&A.
- How to connect Power BI to SAP Business OneConnect Power BI to SAP Business One: SQL Server or HANA direct, Service Layer OData, gateway setup, key manufacturing dashboards and natural-language Q&A.
Troubleshooting
- Why your vector database throws connection errors under load, and how to fix itVector database connection errors under load usually mean pool exhaustion, not a network outage. Size your pool correctly and add retry logic with backoff.
- Why your vector index uses far more memory than the raw embeddings, and how to fix itHNSW indexes use several times more RAM than raw embeddings because of graph overhead. Here is the real memory math and how to fit large vector indexes in RAM.