> ## Documentation Index
> Fetch the complete documentation index at: https://docs.industrialpmr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enterprise ERP Integration (SAP)

> Bidirectional bridge connecting SAP ERP Production Orders (POs) directly with shop-floor machinery.

The **Enterprise ERP Integration** module connects corporate SAP ERP systems directly with physical manufacturing machinery. It eliminates manual paper transcription, automates production order assignment, and provides real-time job fulfillment tracking.

> [!NOTE]
>
> The Enterprise ERP bridge is an advanced module available for enterprise deployments requiring automated scheduling synchronization with SAP Fiori / ERP environments.

***

## Architectural Workflow

```mermaid theme={null}
sequenceDiagram
    autonumber
    actor Supervisor as Shift Production Supervisor
    participant Dashboard as Industrial PMR Dashboard
    participant CloudProxy as Secure ERP Cloud Proxy
    participant Cache as Factory Operational Cache
    participant SAP as Enterprise SAP ERP Gateway
    participant IoT as Machine Edge Sensor Node

    Note over Supervisor,SAP: 1. Fetching Scheduled Production Orders
    Supervisor->>Dashboard: Open Assign Target Portal
    Dashboard->>Cache: Query cached orders for current shift window
    alt Cache Valid (< 24 Hours & Current Day)
        Cache-->>Dashboard: Return cached production orders
    else Cache Expired or Manual Force Refresh
        Dashboard->>CloudProxy: Request order list (date range)
        CloudProxy->>SAP: Secure RFC / REST Request
        SAP-->>CloudProxy: Return production order records
        CloudProxy->>Cache: Commit normalized order records
        Cache-->>Dashboard: Return updated orders
    end

    Note over Supervisor,Dashboard: 2. Assigning PO to Floor Machine
    Supervisor->>Dashboard: Select PO (e.g. #110100011769)
    Dashboard->>Dashboard: Auto-fill Part Number, Description, Planned Quota & Due Date
    Supervisor->>Dashboard: Confirm machine assignment
    Dashboard->>Cache: Lock active target on machine

    Note over IoT,Dashboard: 3. Real-Time Production Execution
    IoT->>Dashboard: Machine cycle sensor increments piece count
    Dashboard->>Dashboard: Track real-time progress vs. planned quota
```

***

## Key ERP Data Fields Mapped

Industrial PMR maps standard SAP manufacturing schema fields directly into operational dashboard parameters:

| SAP Schema Field | Field Label | Role in Industrial PMR |
| :- | :- | :- |
| **`AUFNR`** | Production Order Number | Unique corporate work order identifier (e.g., `110100011769`). |
| **`MATNR`** | Material Number | Component / part code manufactured by the tool. |
| **`MAKTX`** | Material Description | Human-readable part name displayed on operator cards. |
| **`PSMNG`** | Planned Order Quantity | Locked production piece quota for the job order. |
| **`LMNGA`** | Confirmed Quantity | Historical accepted pieces already verified in ERP records. |
| **`GLTRP`** | Basic Finish Date | Scheduled delivery deadline used for Estimated Time to Completion (ETC) forecasts. |

***

## Family Mold Support

In industrial injection molding, a single multi-cavity tool often manufactures complementary components simultaneously (e.g., Left and Right automotive mirror housings produced in one shot under a single PO).

* **Multi-Line Order Recognition**: Industrial PMR natively detects multi-item production orders sharing the same order ID.
* **Proportional Stroke Counting**: Each physical machine cycle pulse increments all family variants proportionally according to tooling cavity ratios.
* **Consolidated Yield Tracking**: Shift supervisors can track individual component completion alongside total order fulfillment without duplicating edge hardware bindings.

***

## SAP in the Dashboard

> [!NOTE]
>
> SAP features are **enabled per account** and are not visible to other accounts.

### Order Selector

In the **Add or update a target** form, the order selector lists orders as:

```
PO #number - description [Target: quantity]
```

An order can contain **several materials**. Choosing one fills the target quantity.

### Sync

* Orders come from a **cloud proxy** and are **cached**.
* A **manual refresh is limited to once every 10 seconds**.

### SAP Status Values

| Status | Meaning |
| :- | :- |
| **NEW** | Nothing produced yet. |
| **ON\_TRACK** | Production is progressing as planned. |
| **NEAR\_COMPLETION** | 85% or more complete. |
| **COMPLETED** | Target quantity reached. |
| **OVERPRODUCED** | Produced more than the order quantity. |
| **OVERDUE** | Past the finish date and incomplete. |

### Where SAP Appears

* **Targets page**: the **SAP** filter and the summary bar show how many targets are linked and when they last synced.
* **Target detail**: a SAP target summary on the Current Stats tab.
* **Machine page**: the Production Target card shows the linked **PO number**.

SAP assignment is done in the **Targets** form. See [Add or Update a Target](https://docs.industrialpmr.com/dashboard/raw-materials-targets.md#add-or-update-a-target).

***

## Order Selector Controls

The **Import from SAP Production Order** panel in the target form has these controls:

| Control | Description |
| :- | :- |
| **Select or search SAP Production Order...** | Search the loaded orders by number or description. |
| **Sync SAP** | Pulls the latest orders from the SAP gateway for the active date range. |
| **Adjust Date Range** / **Hide Date Filter** | Shows or hides the **SAP Query Date Range** controls. |
| **Presets** | **This Month**, **Last Month**, **Last 30 Days**, and **Next 30 Days**. |
| **Start Date / End Date** and **Fetch Range** | Query a custom range of orders. |
| **Change PO** | Pick a different order for the same target. |
| **Unlink SAP** | Detach the order and return to a manual target. |
| **Select Part to Run** | For an order with several parts (family mold), pick the part now running. The active part is marked **ACTIVE RUN**, and **SELECTED** marks your choice. |

A linked order is marked **LINKED**, and its target quantity is locked to SAP in the form.

***

## SAP Target Summary

On the target's **Current Stats** tab, the SAP card shows the order, its part description, the last sync time, and four tiles:

| Tile | Meaning |
| :- | :- |
| **SAP Target** | The planned quantity from SAP (`PSMNG`). Locked. |
| **SAP Confirmed** | The yield already confirmed in SAP (`LMNGA`). |
| **Live iPMR Count** | Pieces counted by the iPMR sensor. |
| **Pending Conf.** | Live count minus SAP confirmed. A positive value reads **iPMR ahead**, zero reads **Aligned**, and a negative value reads **Behind SAP**. |

Use **Sync SAP** on the card to pull the latest confirmed pieces for that order (limited to once every 10 seconds).

### Automatic Sync

* Opening the **Targets** page checks the active SAP targets once automatically.
* A SAP target's card refreshes itself once per day if it has not been synced yet that day. The summary bar shows **Not synced today** when the last sync is from an earlier day.
* If the SAP gateway cannot be reached, a **SAP Sync Failed** message is shown.

***

## Manual Completion

SAP targets do **not** auto-complete. Production continues to accumulate after the quantity is reached, until the target is completed manually.

* When the live count reaches the SAP target, a **Target Reached** banner appears with a **Complete Target** button.
* **Complete Target** asks for confirmation (**Complete SAP Target?**) and then ends the target.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.