DEV Community

Cover image for The Clean Core & SAP Business AI Architecture Playbook: Decision Frameworks, Vector Grounding, and Production Scenarios
Andrea Antonio Perrelli
Andrea Antonio Perrelli

Posted on Originally published at Medium

The Clean Core & SAP Business AI Architecture Playbook: Decision Frameworks, Vector Grounding, and Production Scenarios

Transitioning enterprise SAP landscapes to modern S/4HANA Cloud and adopting SAP Business AI requires a fundamental shift in architectural mindset. The era of treating extensibility as merely "writing custom code in Eclipse ADT" is over.

In production environments, the challenge is rarely just syntax—it is architectural governance under Clean Core:

When does a requirement belong on Client 100 (Key-User Extensibility) versus Client 080 (Developer Extensibility)?
How do you orchestrate LLMs via SAP Generative AI Hub while guaranteeing Zero Data Retention?
How do you semantically ground enterprise prompts using SAP HANA Cloud Vector Engine without leaking cross-tenant or unauthorized business data?

As a practicing SAP Solution Architect (10× SAP Certified, actively delivering modern S/4HANA Cloud and BTP architectures), I put together this field guide to bridge the gap between official, high-level documentation and the concrete architectural patterns required to deliver upgrade-stable cloud architectures.

  1. The Core Architectural Pillars: 3-Tier Enterprise AI

To design production-grade Business AI architectures on SAP BTP, your mental model must span three interconnected layers:

Tier 1 — Consumption & Copilot Execution (Joule): Pre-built conversational AI embedded directly across SAP SuccessFactors, S/4HANA Cloud, and BTP. Architectural decisions center on what Joule handles out-of-the-box (standard business object actions, navigational triggers) versus when you must build custom skills via SAP AI Agent Hub.
Tier 2 — Enterprise Foundation Model Orchestration (Generative AI Hub): How prompt engineering, model switching (GPT-4o, Claude 3.5 Sonnet, Gemini Pro), and zero data retention compliance are governed on BTP without managing direct hyperscaler API contracts.
Tier 3 — Semantic Grounding (HANA Cloud Vector Engine): Storing high-dimensional embeddings using the native REAL_VECTOR data type, performing cosine similarity hybrid searches, and combining semantic similarity with structured SQL metadata filters.

  1. Real-World Architecture Deep Dive: Clean Core Governance

A critical discipline in modern S/4HANA Cloud delivery is Clean Core Extensibility. A common anti-pattern across delivery teams is the instinct to immediately open Eclipse ADT on Client 080 for logic that belongs in Tier 1.

Scenario: Header-Level Custom Field with Cross-Document Flow

The Requirement: A customer requires a custom "ESG Compliance Code" on the Sales Order Header. This field must automatically propagate to the Outbound Delivery and Billing Document without manual re-entry. It also requires validation logic to prevent delivery creation if the compliance code is empty for specific material groups.

The Anti-Pattern (Developer Extensibility Reflex): Opening Eclipse ADT on Client 080, creating custom RAP CDS View Entities extending standard tables (VBAK, LIKP, VBRK), and writing unmanaged save implementations in ABAP Cloud.

Why it fails Clean Core Governance: It introduces custom transport packages, software component lifecycles, and ongoing maintenance overhead for functionality that SAP standard handles natively under Tier 1 extensibility.

The Correct Production Design (Tier 1 Key-User Extensibility):

Step 1: Navigate to the Custom Fields app on Client 100.

Step 2: Create the field under the Business Context Sales: Sales Document.

Step 3: In the Business Scenario tab, enable propagation (Sales to Delivery, Delivery to Billing, and Sales to Billing).

Step 4: Enable OData exposure and CDS view usage with a single click.

Step 5: In the Custom Logic app, implement the validation check using the released Key-User BAdI BD_SD_SLS_CHECK_HEADER in Restricted ABAP (C1 release contract).

Architectural Rule: In S/4HANA Cloud (Public or Private), always exhaust Client 100 Key-User Extensibility before escalating to Developer Extensibility (ADT Client 080) or Side-by-Side CAP on BTP.

  1. Grounding LLMs with SAP HANA Cloud Vector Engine

Directly passing company data into public LLM endpoints is an immediate architectural violation. For enterprise RAG (Retrieval-Augmented Generation), production designs rely on hybrid vector search.

Key Technical Concepts:
Table Definition: Creating vector columns using REAL_VECTOR(1536) (for OpenAI text-embedding-3-small) or REAL_VECTOR(3072).
Hybrid Search Strategy: A pure semantic search is insufficient for enterprise applications because it lacks organizational context. You must combine cosine distance with strict relational predicates:
sql
SELECT TOP 5
DocumentID,
DocumentChunk,
COSINE_SIMILARITY(VectorEmbedding, TO_REAL_VECTOR(:query_embedding)) AS SimilarityScore
FROM EnterpriseKnowledgeBase
WHERE CompanyCode = :user_company_code
AND AuthorizationGroup = :user_auth_group
ORDER BY SimilarityScore DESC;

This ensures that multi-tenant isolation and SAP authorization boundaries are strictly respected before prompt tokens are generated and sent to the Generative AI Hub.

  1. The 30-Day Architectural Sprint Roadmap

For teams and architects looking to systematically master these patterns, here is a structured 4-week architectural upskilling roadmap:

Week 1: Clean Core & Extensibility Governance — Master Client 100 vs Client 080 decision trees, Custom Fields business scenarios, Restricted ABAP vs ABAP Cloud, and C1/C2 release contracts.
Week 2: Generative AI Hub & BTP SDK — Deep dive into @sap-ai-sdk/foundation-models, prompt templating, Zero Data Retention enterprise agreements, and multi-model routing.
Week 3: HANA Cloud Vector Engine & Enterprise RAG — Vector tables, cosine similarity search, chunking strategies, hybrid search metadata filtering, and Principal Propagation via IAS/IPS.
Week 4: Production Scenario Drills & Governance — 45 scenario trade-off analyses, Clean Core violation reviews, real-world case studies, and transport governance (ATO vs CTS+).
The Complete Architectural Field Guide

To help architects, developers, and consultants save weeks of trial-and-error, I consolidated my complete project documentation, code templates, and field notes into a comprehensive playbook:

The SAP BTP & Business AI Architecture Companion

The SAP BTP & Business AI Architecture Companion A Field Guide, Decision Frameworks & 45 Enterprise Scenarios for Solution Architects The Reality of SAP...

favicon andreaperrelli.gumroad.com

What’s Inside the Package:
45 Real-World Enterprise Scenarios: Detailed scenario breakdowns across Clean Core extensibility, AI grounding, BTP side-by-side CAP, and integration governance—each with explicit "Clean Core Violation Alerts".
Interactive Notion Workspace: Duplicate to your private Notion workspace in one click. Fully searchable, with interactive progress checklists and collapsible solution toggles.
Master PDF Reference: Formatted offline A4 guide for desktop and tablet reading.
Production Code Snippets: Complete implementations for RAP view entities, CAP GenAI Hub SDK calls, Cloud BAdIs, and HANA Vector search SQL.
Full 30-Day Architectural Sprint Plan.

(For readers of this article, use the code EARLYBIRD at checkout or use the direct link above to get the €35 launch rate instead of the standard €49).

Join the Discussion

What is the biggest challenge your team faces when aligning legacy ABAP systems with modern Clean Core and BTP architectures? Connect with me in the comments below!

Top comments (0)