
Book tip
Generative AI with SAP
Developing Custom AI Applications

The basic methodological idea is strikingly simple: Since pre-trained language models operate purely probabilistically, remain limited to the scope of their training dataset, and by nature have no knowledge of internal, proprietary business processes, their isolated use in operations inevitably leads to structural errors and hallucinations. Instead of investing immense financial and technical resources to train or continuously improve its own base model with billions of parameters from scratch, RAG incorporates an information retrieval step upstream of the generative process.
Formally, this two-step process can be described as y = G(x, R(x)): In response to a user query x, the system searches an external knowledge database for relevant facts R(x) and passes these, together with the original question, as enriched context (grounding) to the language model G to generate a fact-based response y. What theoretically appears to be a coherent symbiosis of information retrieval and text generation reveals fundamental architectural hurdles, hidden cost risks, and methodological limitations for existing SAP customers.
In conventional implementations, information retrieval is based on a purely mathematical and statistical process: Unstructured documents (such as PDFs, manuals, service tickets, or guidelines) are broken down into predefined text fragments. Each text fragment is translated via an embedding model into a high-dimensional numerical vector (see also Vector Engine on the HANA database platform), which maps the semantic meaning in the coordinate space. These vectors are stored together with metadata in a vector database (HANA).
This is precisely where the dilemma begins for SAP users. A vector space merely measures statistical correlations and text similarities—but it has no understanding whatsoever of business hierarchies, process dependencies, or relational logic. Breaking documents down into arbitrary chunks tears coherent business processes apart. A classic vector RAG consistently fails at so-called multi-hop queries, in which an answer requires the logical linking of multiple, isolated tables, authorization structures, or document chains (such as from the purchase requisition through the purchase order and goods receipt to invoice verification). Anyone who applies a pure vector RAG to complex ERP structures often receives, instead of reliable facts, seemingly precise answers that are, however, based on fragmented half-truths.
Starting with version 2024, HANA Cloud features a native vector engine that stores vectors directly in relational table columns. In AI Core and AI Launchpad, SAP provides the Generative AI Hub—an orchestration layer that uses programming interfaces to manage access to external base models (including Azure OpenAI, Anthropic, and Google Cloud) and offers standardized embedding endpoints. The Document Grounding service acts as a preconfigured RAG pipeline that automatically parses and indexes documents from sources such as Microsoft SharePoint, object stores, or SAP DMS and makes them available to the AI copilot Joule. The native HANA Vector Engine and the Generative AI Hub are available exclusively in the cloud on the Business Technology Platform (SAP BTP). Those who operate their systems on-premises are systematically cut off from these integrated RAG services. And every vectorization, every similarity search, and every generation request consumes usage-based BTP Capacity Units or AI tokens. Since SAP relies on upfront payments with strict year-end expiration rules for contracts such as the Cloud Platform Enterprise Agreement (CPEA), the RAG system risks becoming an unpredictable cost driver, while peak loads are immediately billed at full list prices.
Because the flat vector-based RAG falls short when it comes to the relational realities of complex industrial landscapes, a further development has gained traction in the international data science and SAP communities: GraphRAG (Graph-enhanced RAG).
GraphRAG replaces isolated vector matching with a two-stage, hybrid architecture: Instead of simply reducing text to sequences of numbers, entities (customers, products, plants, CDS views, company codes) and their explicit relationships are modeled as nodes and edges in a knowledge graph (based on W3C standards such as RDF, SPARQL, and OWL). When a query is made, the vector search first identifies the appropriate entry nodes in the graph. The system then traverses the graph along the defined semantic edges (multi-hop reasoning), gathers the complete business rule context, and passes this fully documented path to the language model. Scientific studies and practical tests impressively demonstrate this qualitative leap: In complex enterprise environments, GraphRAG has been proven to be more than three times as accurate as conventional vector RAG. For structured queries aimed at identifying database dependencies, a pure language model often achieves hit rates of only around 30 percent—with massive hallucinations—while the effective combination of vector search and knowledge graph generates over 70 percent error-free and verifiable answers.

