RAG over SAP Documents with the Generative AI Hub and Document Grounding
As of 2026-09-25
Walks one managed retrieval-augmented-generation pipeline end to end, for a shared-service-centre assistant that must cite its sources: creating a document-grounding pipeline over a supported repository (SharePoint, S3, SFTP, SAP Build Work Zone, SAP Document Management, ServiceNow, Google Drive, or help.sap.com via Elastic Search), calling it from orchestration through either Cloud SDK (PipelineAPIClient, GroundingModule/DocumentGroundingFilter/GroundingFilterSearch in Python; the equivalent searchConfiguration in JavaScript), tuning max_chunk_count and dataRepositories as a recall/precision/governance trade-off, masking grounding input with MaskingMethod.ANONYMIZATION and entity types such as ProfileEntity.SAP_IDS_INTERNAL, and running a groundedness evaluation that separates retrieval failures from generation failures. Closes by showing how this same pipeline becomes a tool an M350 agent can call through an M351 MCP server.
What you will learn
- Decide when a managed grounding pipeline is the right choice over hand-built HANA Cloud SQL retrieval (M330), and build one for a real document corpus
- Name the supported document-grounding data repositories and the one supported website source
- Call the grounding module from orchestration in Python (PipelineAPIClient, GroundingModule, DocumentGroundingFilter, GroundingFilterSearch) or JavaScript (@sap-ai-sdk/document-grounding), and insert its response via the {{?grounding_response}} template variable
- Tune max_chunk_count and dataRepositories deliberately, trading recall against precision and governance scope
- Configure mask_grounding_input with MaskingMethod.ANONYMIZATION and relevant entity types (including ProfileEntity.SAP_IDS_INTERNAL) for internal SAP documentation
- Build a groundedness evaluation that separates a retrieval failure from a generation failure
Who this is for. M325 toured the whole generative AI hub — orchestration, grounding, masking, filtering. M330 showed you how to build retrieval yourself in HANA Cloud SQL. This module does neither: it takes the managed grounding path and walks it end to end, once, for one real scenario — a shared-service centre assistant that answers from internal SAP process documentation and cites its sources. If M330 is "build retrieval," this is "configure the pipeline SAP already built for you," and knowing when each is the right choice is itself part of the module.
1. The scenario: a service desk that must cite its sources
Take the case M333 names as the textbook RAG use case: a finance shared-service centre needs an assistant that answers procurement-policy and month-end-close questions from a few hundred pages of internal documentation, revised every quarter, where every answer must be traceable to a real paragraph. This is a citable-knowledge problem, not a facts-that-never-change problem — which M333 already argued rules out fine-tuning. Everything below builds this one assistant.
Prerequisites
- M325 — SAP Generative AI Hub Hands-on: Orchestration, Grounding, Masking, Filtering
- M333 — AI & LLM Fundamentals for SAP Consultants (RAG, hallucination, evaluation)
- Comfort with Python or JavaScript and reading SDK reference documentation
- Recommended alongside M330 (build-your-own retrieval in HANA Cloud) for comparison, and M350/M351 if this pipeline will also serve an agent
Outcomes
- Stand up a working grounding pipeline over a real document repository and retrieve from it through orchestration.
- Justify a max_chunk_count and dataRepositories configuration against a written recall/precision/governance trade-off.
- Configure masking on grounding input with named entity types matched to the actual document corpus.
- Run a groundedness evaluation that diagnoses whether a bad answer came from retrieval or from generation.
Full module available to members. The full module adds: the decision framework · the end-to-end scenario walkthrough · the KPI scorecard · the anti-patterns · the code blocks · the knowledge check · the diagrams.