Industry 4.0 · SAP DMC · OPC-UA · Smart Factory Labels
MES Integration: SAP DMC + OPC-UA Label Triggers
How to trigger enterprise label printing from production events in SAP Digital Manufacturing Cloud (DMC), OPC-UA machine signals, and MES production order completions — without a human touching a keyboard.
SAP DMCOPC-UAIDoc LABELS01S/4HANA CloudREST APIZPL Print
01Integration Architecture
Three trigger paths — all terminate at the same ZPL print output
🏭
PLC / Machine
OPC-UA signal
→
OPC-UA
🔗
OPC-UA Connector
node-opcua / SAP Edge
→
REST POST
☁️
SAP DMC
Production Order
→
Event / IDoc
⚙️
SAP S/4HANA
LABELS01 IDoc
→
TCP/IP
🖨️
Zebra Printer
ZPL label
🔴
Path A — OPC-UA Direct
Machine PLC fires OPC-UA event on production completion. Node.js OPC-UA listener intercepts, calls api.labelnex.in/print directly. Bypasses SAP entirely. Fastest path — sub-second latency.
☁️
Path B — SAP DMC Event
SAP DMC production order completion fires a business event. BTP Integration Suite routes event to S/4HANA. S/4HANA creates LABELS01 IDoc → BarTender/NiceLabel → Zebra. Full SAP governance.
📋
Path C — API Trigger
MES system (non-SAP) calls api.labelnex.in REST endpoint with material + quantity + lot. API fetches label data from SAP OData, constructs ZPL, sends TCP to printer. Middleware pattern.
02Path A — OPC-UA Connector (Node.js)
Listen for machine signals, trigger label print on production events
Deploy on: Raspberry Pi 4, factory edge PC, or SAP Edge Services Node — any device on the same network as the OPC-UA server (PLC). Run with pm2 start opcua-label-trigger.js for auto-restart.
Creates goods movement → triggers NACE output → LABELS01 IDoc
Key: SAP DMC is the cloud MES for S/4HANA RISE. If client is on RISE/Cloud (not on-premise ECC), this is the correct integration path. The IDoc trigger still fires from S/4HANA — DMC just initiates the production confirmation.
BTP Integration Suite iFlow — DMC Event → S/4HANA Label
// BTP Integration Suite Groovy script — transform DMC event to S/4HANA call// Used in iFlow: "DMC Production Complete → Label Trigger"import com.sap.gateway.ip.core.customdev.util.Message
def Message processData(Message message) {
def body = message.getBody(String)
def json = new groovy.json.JsonSlurper().parseText(body)
// Extract DMC event fieldsdef material = json.materialNumber // e.g. "CHEM-001-GHS"def batch = json.batch // lot numberdef plant = json.plant // e.g. "1000"def qty = json.quantity
// Build S/4HANA OData request body for label triggerdef s4Payload = """
{
"Material": "${material}",
"Batch": "${batch}",
"Plant": "${plant}",
"Quantity": "${qty}",
"LabelTriggerSource": "SAP_DMC"
}"""
message.setBody(s4Payload)
message.setHeader("Content-Type", "application/json")
message.setHeader("sap-client", "100")
return message
}
04Path C — REST API Trigger (Non-SAP MES)
Any MES, WMS, or production system can trigger labels via api.labelnex.in
API Specification
POST https://api.labelnex.in/v1/label/trigger
Authorization: Bearer {JWT_TOKEN}
Content-Type: application/json
{
"material": "CHEM-001-GHS", // SAP material number"batch": "LOT2026-001", // lot / batch"plant": "1000", // SAP plant"quantity": 100, // units to label"printerGroup": "LINE1_PRINTERS", // printer routing group"template": "GHS_LABEL_EU", // optional override"source": "CUSTOM_MES"// audit trail
}
// Response:
{
"jobId": "LN-JOB-20260601-0042",
"printed": 100,
"printer": "192.168.1.100",
"template": "GHS_LABEL_EU",
"status": "QUEUED"// or PRINTED / FAILED
}
SAP data fetch: When the API receives a material + batch, it calls SAP S/4HANA OData endpoint /sap/opu/odata/sap/API_MATERIAL_DOCUMENT_SRV to get current material master and classification data. The ZPL is built dynamically — no static templates needed for standard label types.