Inferensys

Integration

AI Integration for SAP Manufacturing Integration and Intelligence

Inject AI workflows into SAP MII's integration layer to orchestrate intelligent decisions between ERP, MES, and plant floor systems. This guide covers practical use cases, BLS extensions, and implementation patterns.
Strategy consultant facilitating AI use case discovery workshop, sticky notes on glass wall, casual corporate meeting.
ARCHITECTING UNIFIED INTELLIGENCE

Where AI Fits in the SAP MII Integration Layer

SAP MII's Business Logic Services (BLS) and messaging framework provide the central nervous system for injecting AI between ERP, MES, and plant floor systems.

SAP Manufacturing Integration and Intelligence (MII) is designed as a real-time integration and intelligence hub, not a transactional system. Its value for AI lies in its Business Logic Services (BLS), Message Services, and Composite Applications. These components allow you to orchestrate AI workflows that consume data from SAP ECC/S4HANA, plant historians, PLCs, and quality systems, then return decisions and insights to the same surfaces. Key integration points include:

  • BLS Transactions: Embed AI model calls (REST/GraphQL) within BLS logic to enrich data queries or trigger actions.
  • Message Queues: Use JMS or XI messaging to asynchronously process high-volume sensor data through AI pipelines for anomaly detection.
  • Data Services: Connect AI-powered data cleansing and enrichment directly to MII's query templates before presenting data in dashboards or alerts.
  • Composite Apps: Build AI-enhanced Fiori-like applications within MII's framework, where operators interact with copilots or receive predictive alerts.

A typical production implementation wires an AI inference service as a secure microservice, called from MII BLS via REST API. For example, a BLS transaction could fetch the last 100 batches from SAP, send key parameters (temperatures, pressures, cycle times) to an AI model for yield prediction, and conditionally trigger a Message Service alert to a supervisor's MII dashboard if a low-yield batch is predicted. Governance is managed through MII's existing security roles and audit logs, ensuring every AI call is traced back to a user or automated job. Rollout focuses on augmenting specific, high-value MII queries or alerts first—like dynamic scheduling recommendations or real-time SPC violation analysis—before expanding to more complex, multi-system agent workflows.

This approach avoids rip-and-replace. You use MII's certified connectors to SAP and shop floor systems as the reliable data pipeline, while AI adds a layer of adaptive intelligence on top. The result is a unified manufacturing intelligence layer where decisions are informed by both historical rules (in MII/SAP) and predictive models, all surfaced through the existing MII portals and dashboards your teams already use.

ARCHITECTURAL ENTRY POINTS

Key SAP MII Surfaces for AI Integration

The Orchestration Engine for AI Workflows

SAP MII's Business Logic Services (BLS) provide the primary canvas for orchestrating multi-step AI workflows that bridge ERP, MES, and plant floor data. A BLS transaction can be configured to:

  • Retrieve and Prepare Data: Pull real-time production data from plant systems (via OPC, IDoc, RFC) and historical context from SAP ERP, structuring it as prompts or feature vectors for AI models.
  • Call External AI Services: Use BLS's HTTP/HTTPS actions to securely call Inference Systems' hosted models or APIs (OpenAI, Anthropic, open-source) for tasks like anomaly explanation, predictive quality scoring, or natural language query translation.
  • Execute Conditional Logic: Based on the AI model's output (e.g., "high scrap risk predicted"), the BLS can trigger downstream actions—creating a quality notification in SAP QM, adjusting a setpoint via an OPC write, or sending an alert to a supervisor dashboard.
  • Log and Audit: Every inference call, input data, and resulting action can be logged within the BLS transaction log or written to a dedicated audit table, providing full traceability for regulated environments.

This turns MII from a simple data integrator into an intelligent workflow orchestrator, where AI decisions are embedded directly into mission-critical manufacturing operations.

INTEGRATION PATTERNS

High-Value AI Use Cases for SAP MII

SAP MII's Business Logic Services (BLS) and messaging layer provide a powerful orchestration fabric for injecting AI into manufacturing workflows. These patterns show how to connect AI models to ERP, MES, and plant floor systems for unified intelligence without replacing core platforms.

01

Real-Time Production Anomaly Detection

Use MII's data services to stream real-time OEE, sensor, and quality data from PLCs and SCADA into AI models. Detect multivariate anomalies (e.g., temperature drift, pressure spikes correlated with yield drop) and use MII's Notification Services to trigger alerts in SAP ME or operator HMIs within seconds, not hours.

Batch -> Real-time
Alerting cadence
02

Intelligent Order Release & Sequencing

Augment MII's order management workflows with AI for constraint-based scheduling. Before converting SAP PP/DS planned orders to production orders in SAP ME, an AI agent evaluates real-time material availability, machine health scores, and operator certifications—using MII BLS transactions to hold, modify, or release orders adaptively.

1 sprint
Typical POC timeline
03

Automated Nonconformance Root Cause Suggestion

When a quality event is logged in SAP ME or a connected QMS, use MII's Query Templates to pull historical data (process parameters, material lots, equipment logs). An AI model correlates this data to suggest the top 3 probable root causes, which are appended to the NC record via MII's Integration Services, accelerating CAPA initiation.

Hours -> Minutes
Analysis time
04

Predictive Material Call-Off to Warehouse

Leverage MII's Message Services to monitor production order progress and machine consumption rates. An AI model predicts line-side stock-outs 2-4 hours in advance and triggers automated material call-offs to SAP EWM or a third-party WMS via MII's XML transactions, reducing unplanned downtime.

Same day
ROI visibility
05

Dynamic Digital Work Instruction Assembly

Use MII's Content Development Kit to build context-aware work instructions. An AI agent analyzes the operator's certification, current shift performance, and machine model, then assembles a personalized instruction set from a knowledge base. MII serves the adapted XML-based content to SAP ME or a mobile HMI, reducing errors and training time.

06

Unified Traceability & Recall Simulation

Orchestrate complex genealogy queries across SAP ECC, ME, and supplier systems using MII's Composite Applications. An AI model analyzes the resulting data graph to simulate recall impact, identify affected batches, and generate containment workflows—all executed through MII's Business Logic Services for audit-ready reporting.

Batch -> Real-time
Query speed
PRACTICAL INTEGRATION PATTERNS

Example AI-Enhanced MII Workflows

SAP MII's Business Logic Services (BLS) and messaging layer provide a powerful orchestration engine for AI. These workflows show how to inject intelligence between ERP, MES, and plant floor systems without disrupting core operations.

Trigger: A new production order is created in SAP ERP (PP) and sent to MII via IDoc or RFC.

Context Pulled: The MII BLS transaction queries real-time data from connected systems:

  • Machine availability and current utilization from MES/SCADA.
  • Material inventory levels from SAP EWM or a connected WMS.
  • Operator certifications and shift schedules from a time & attendance system.
  • Pending maintenance from a CMMS (e.g., SAP PM).

AI Agent Action: A lightweight model (or a call to a hosted LLM with a structured prompt) evaluates the aggregated constraints. It outputs a release_score (0-100) and a list of potential blocking issues (e.g., "Material XYZ is below safety stock," "Machine Line-5 has a high probability of failure in the next 8 hours").

System Update: Based on a configurable threshold:

  • Score > 80: Order is automatically released to the shop floor, and a detailed work packet is generated in MII for the MES.
  • Score 50-80: Order is placed in a "Review Required" queue in an MII composite app. An alert is sent to the production scheduler with the AI's reasoning.
  • Score < 50: Order is automatically put on hold in ERP. A notification is created with the specific constraints to resolve.

Human Review Point: The "Review Required" queue allows schedulers to override with manual justification, which is logged for model feedback.

ORCHESTRATING AI BETWEEN ERP, MES, AND THE SHOP FLOOR

Implementation Architecture: Data Flow and Guardrails

A production-ready AI integration for SAP MII leverages its Business Logic Services (BLS) and messaging layer as a secure, governed orchestration hub between enterprise systems and real-time plant data.

The core integration pattern uses SAP MII's BLS transactions as the primary execution engine. AI models are containerized and deployed as microservices, either on-premises or in a private cloud. MII BLS calls these services via REST APIs, passing filtered context—such as a production order ID, material lot, or equipment tag—pulled from connected SAP ERP (S/4HANA or ECC) and MES data sources. The AI service returns structured inferences (e.g., a predicted quality deviation score, a recommended maintenance action, or a dynamic scheduling adjustment), which the BLS transaction then uses to trigger downstream actions. These can include updating SAP Production Orders (CO01), creating Quality Notifications (QM01) in SAP QM, posting Goods Movements (MIGO), or sending alerts to Ignition or other SCADA HMIs via MII's Message Service or OPC UA.

Data flow governance is critical. All AI inferences are logged to a dedicated SAP MII Data Table or an external audit database, creating a traceable record linking the model version, input data snapshot, inference result, and any resulting system action. For high-risk actions—like automatically scrapping a batch or changing a recipe—the architecture can be configured to route the AI's recommendation through a manual approval step within a MII workflow or a connected SAP Business Workflow. This human-in-the-loop guardrail ensures operators or supervisors retain final authority, with the AI serving as a copilot that provides reasoning and supporting data for the decision.

Rollout follows a phased, use-case-driven approach. Start with a read-only diagnostic agent, such as an AI that analyzes real-time sensor data from MII's Plant Connectivity (PCo) layer to predict equipment failure and logs insights without taking action. After validating accuracy and building trust, progress to advisory agents that suggest actions to operators via MII dashboards. Finally, deploy autonomous agents for low-risk, high-volume decisions, like automated Statistical Process Control (SPC) chart interpretation or dynamic Kanban signal regeneration. Each phase incorporates a feedback loop where operator overrides and outcome data are sent back to retrain and improve the models, creating a continuous learning system anchored by SAP MII's integration fabric.

SAP MII INTEGRATION PATTERNS

Code and Payload Examples

Business Logic Service (BLS) Script for AI Orchestration

SAP MII's BLS is the primary engine for orchestrating workflows between ERP, MES, and AI services. A typical BLS script fetches production data, calls an external AI model via HTTP, processes the response, and updates systems or triggers alerts.

Example BLS Logic Flow:

  1. Query: Use a SQL Query activity to retrieve real-time OEE data, defect codes, and machine parameters from the MII Data Server.
  2. Transform: Use a Data Transform activity to structure the payload into JSON format expected by your AI inference endpoint.
  3. Call AI Service: Use an HTTP Request activity (POST) to send the payload to your hosted AI model (e.g., a predictive quality or anomaly detection service).
  4. Decision: Use a Condition activity to evaluate the AI response (e.g., Predicted_Defect_Probability > 0.85).
  5. Action: If the condition is met, use a Message Send activity to trigger an Andon alert in SAP DM or a Transaction activity to create a quality notification (QM01) in SAP ECC/S4.

This serverless-like execution within MII allows you to embed intelligent decision points directly into existing plant-floor integration flows without building separate middleware.

AI-ENHANCED MII WORKFLOWS

Realistic Time Savings and Operational Impact

This table shows how integrating AI with SAP MII's Business Logic Services (BLS) and messaging layer can accelerate key manufacturing intelligence workflows, turning batch-oriented processes into real-time, assisted operations.

Workflow / MetricBefore AI (Manual / Scheduled)After AI (Assisted / Event-Driven)Implementation Notes

Production Exception Triage

Manual review of MII alerts and dashboards; next-shift analysis

AI prioritizes and summarizes exceptions in real-time; routes to appropriate teams

Leverages MII's BLS to call AI models on event data; human review for major deviations

Batch Genealogy Traceability Query

Hours to manually trace components through multiple MES/ERP tables

Minutes via natural language query; AI assembles report from MII data services

Uses MII's Query Templates and messaging to unify data; AI generates narrative summary

OEE Root Cause Analysis

Daily or weekly meeting to review losses; manual correlation of downtime codes

AI correlates real-time sensor, downtime, and quality data to suggest primary causes at shift-end

MII aggregates IIoT and transactional data; AI model runs on BLS server; results pushed to Fiori

Quality Alert Generation

Threshold-based alerts from SPC charts; manual investigation of every violation

Predictive alerts based on multivariate trends; AI suggests likely defect before it occurs

AI model ingests MII historized process data; triggers MII notifications or SAP PM work orders

Cross-System Data Reconciliation

Nightly batch jobs to align MES, ERP, and plant floor counts; manual discrepancy resolution

Continuous, AI-assisted reconciliation; flags and suggests corrections for high-probability mismatches

MII acts as orchestration hub; AI reviews transaction logs and suggests corrective postings via BLS

Shift Handover Report Creation

Supervisor spends 30-60 minutes compiling data from multiple screens into a summary

AI auto-generates a narrative shift report with key metrics, exceptions, and recommendations in 5 minutes

Report pulls from MII Display and Query services; AI structures insights; final human review and edit

Regulatory Compliance Data Pull

Days to manually extract, validate, and format data from MES/ERP for audit submissions

AI automates data extraction and validation against rules; drafts submission packages in hours

Uses MII's connectivity to source systems; AI checks for completeness and flags anomalies for review

ARCHITECTING CONTROLLED AI OPERATIONS FOR SAP MII

Governance, Security, and Phased Rollout

Implementing AI within SAP MII requires a strategy that prioritizes system integrity, data security, and measurable, low-risk adoption.

Governance starts at the integration layer. AI workflows orchestrated through SAP MII's Business Logic Services (BLS) and messaging must operate within strict RBAC and audit trail boundaries. This means defining clear service accounts for AI agents, logging all BLS script executions and data queries triggered by AI, and ensuring any write-back actions to SAP ERP or MES systems follow existing change management and approval workflows. For retrieval-augmented generation (RAG) use cases, vector stores must be populated from authorized data sources only, such as specific iDocs, RFC modules, or Plant Connectivity (PCo) streams, with access controls mirroring the source system's permissions.

A phased rollout is critical for managing risk and proving value. A typical implementation follows this pattern:

  1. Phase 1: Read-Only Intelligence. Deploy AI agents that consume data via MII's OData or Query Templates to generate insights—like predicting equipment failure from PCo sensor data or summarizing quality deviations—presented in MII's Xcelsius dashboards or via a secure copilot interface. No system writes occur.
  2. Phase 2: Assisted Workflow. Introduce AI that suggests actions within human-in-the-loop workflows. For example, an agent analyzes production order delays and drafts a rescheduling recommendation or a material substitution request. A human reviews and triggers the final BLS transaction to execute in SAP ECC or S/4HANA.
  3. Phase 3: Conditional Automation. For high-confidence, low-risk scenarios, enable automated execution. This requires robust guardrails, such as allowing an AI agent to automatically create a maintenance notification in SAP PM only if the predictive model's confidence score exceeds a defined threshold and the affected work center is in a planned downtime window.

Security is non-negotiable. All AI model inferences should be served through a dedicated API gateway, with MII acting as the secure orchestrator. This architecture keeps sensitive plant floor and business data within the SAP landscape, passing only necessary context to external AI services. Credentials for connecting to SAP backend systems (ERP, MES) must never be exposed to the AI layer. Furthermore, a rollback plan is essential for every phase, ensuring you can disable AI-driven BLS scripts and revert to manual or rule-based processes without disrupting production.

SAP MII AI INTEGRATION

Frequently Asked Questions

Practical questions about embedding AI into SAP Manufacturing Integration and Intelligence (MII) workflows, covering architecture, use cases, and implementation patterns for connecting ERP, MES, and plant floor systems.

SAP MII's BLS provides the primary integration point for AI workflows. The typical pattern involves:

  1. Trigger: A BLS transaction is initiated by a shop floor event (e.g., production order confirmation, quality data submission, equipment alarm).
  2. Context Fetch: The BLS transaction retrieves relevant context from SAP ERP (e.g., material master, BOM), MES (e.g., sensor readings, operator input), and historical logs.
  3. AI Action: The enriched payload is sent via a secure HTTP call to an external AI inference endpoint (e.g., a model for anomaly detection, a language model for generating work instructions).
  4. System Update: The AI response is processed within the BLS transaction, which then updates MII Data Services, triggers alerts via MII Notifications, or posts updates back to SAP ERP via IDocs/RFC.
  5. Example: A BLS transaction triggered by a machine downtime event calls an AI model to analyze recent sensor data and maintenance logs. The model returns the top 3 probable root causes. The BLS transaction then creates a non-conformance record in SAP QM and dispatches a prioritized work order to the maintenance team via MII's messaging services.
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.