Knowledge · Manufacturing IT

What is a Manufacturing Execution System (MES)? Functions, MES vs. ERP, and Interfaces

A manufacturing execution system (MES) is the software layer between business planning and the machine. It takes orders from the ERP system, breaks them down into operations, dispatches them to equipment, tracks batches and reports back what was actually produced. Its time horizon ranges from a shift to a day.

Beyond what an MES does, this article covers a question that belongs early in a selection project: which interfaces does an MES need to work, and what happens when one of them fails? Along the way it draws the line between MES and ERP, a line that can lead to debate in projects.

Last updated: September 22, 2026·approx. 24 min read
Fact sheet
MES at a glance
Term
Manufacturing execution system (MES)
Level
ISA-95 Level 3, manufacturing operations management
Functions
Six areas, detailed scheduling to labor time tracking
Horizon
Shift to day
Distinction
ERP plans against the market, MES against the equipment
Exchange
Orders and master data down, confirmations up
SAP
IDoc, RFC / BAPI, REST / SOAP
01

What does MES stand for?

MES stands for manufacturing execution system. In projects, people usually just say “MES”, and that is the term used here.

An MES typically covers six areas: detailed scheduling of orders across equipment and shifts, production and machine data acquisition, quality assurance with inspection plans and hold decisions, traceability across batches and serial numbers, maintenance with maintenance schedules, and labor time tracking at the line. Not every plant needs all six, and products set different priorities.

What an MES does and how to choose one is covered in detail in What is an MES? on manubes. This article is about the step after that: how it exchanges data with the rest of the company.

02

Which level does an MES work on?

In ISA-95, the MES sits on Level 3, manufacturing operations management; in the German automation pyramid, this is the operations level. Above it, both models place the ERP system (Level 4, or the enterprise level). Below it, the two models count differently: the pyramid has a supervisory level, a control level and a field level, ISA-95 has Levels 2 to 0.

This order describes responsibilities. The data paths no longer follow it all the way: where there is no MES, the ERP system reads values one level down, in practice often at the pyramid’s supervisory level. When a plant can do without an MES is covered below under “Does every plant need an MES?”.

More on this: What is ISA-95?

03

Is SAP an MES?

No, but SAP can do parts of the job.

At its core, SAP is an ERP system. It plans against the market: orders, delivery dates, materials, capacities, costs. For the shop floor there are extensions and separate products that take on MES tasks. A standard SAP system without them is not an MES, though, and above all it lacks the cadence.

An ERP system works in orders and days, an MES in operations and minutes.

In practice you therefore find three setups: SAP plans and an MES executes; SAP does both with add-on modules; or there is no MES and SAP is fed directly from production. Which one fits depends on who in the company owns the production schedule.

04

What is the difference between MES and ERP?

Both plan, but over different time frames and at a different resolution.

ERP MES
Plans against the market the equipment
Unit the order the operation
Horizon days to months (planning) shift to day
Typical figure 5,000 units have to be finished by Friday line 3 has been down for eleven minutes
Key question What does it cost and when do we ship? What is running right now, and at what quality?

Confirmations flow the other way: the MES reports to the ERP system what was actually produced. In many plants, data gets entered twice at this confirmation, once at the machine and once by hand in the ERP system. Where that happens, the problem often lies in the interface in between rather than in the MES itself.

05

Does every plant need an MES?

No. Whether a plant needs one is worth settling before the selection starts.

For this level, the ISA-95 standard describes functions: breaking down orders, tracking batches, sending confirmations. It does not prescribe a product that does all of it.

Whether an off-the-shelf MES fits depends on how much of it a plant really needs. If it brings features that are never used and demands processes that do not fit the company in return, the effort does not end with the rollout; it continues with every adaptation.

Three routes are common at this level:

Route What happens at this level
Full MES A standard system covers all functions. Fits when your processes fit the system.
Build your own Only the functions you actually need: order confirmation, batch tracking, a dashboard. This used to be a programming project and can now be a configuration task.
No MES The level disappears as a separate system. An integration layer (middleware) collects values from production, translates them and delivers them to the ERP system.
The three routes on the operations level between ERP and production: a full MES covering all six functions, self-built individual functions on manubes, or no MES, in which case an integration layer takes over only the data path

The middle route has changed the most. These functions used to require developers. Today, process and operations teams can build them themselves on a no-code platform with drag and drop. At inray, that platform is manubes: dashboards, workflows and reporting are put together by the people who know the process, without a detour through IT.

On the third route, the middleware takes over the data path that the MES would otherwise serve. It reads the values at the machine, converts them into the form the ERP system expects and reports back. MES functions such as detailed scheduling, traceability or quality decisions are not part of it. What this route means for resilience when something fails is covered below under “A message can wait, a question cannot”.

The three routes are not mutually exclusive. A plant can run an MES for production and build its own maintenance application. Which of these functions a plant actually needs determines the setup. The trade-off in detail is covered in MES: Make or Buy?

06

Which interfaces does an MES need to connect to the ERP system?

Data flows between the ERP system and production in two directions. Orders and master data, such as material masters and formulations, go down. Confirmations with produced quantities, material consumption and scrap come back up.

Regardless of the ERP product, four channels are common: web services via REST or SOAP; databases and staging tables that both sides access via SQL or ODBC; files, for example in CSV format, that one system writes and another reads in; and the ERP vendor’s own interfaces.

Taking SAP, a common ERP system in manufacturing, as an example, three methods are typical. They differ mainly in their timing behavior.

Method How it works What it fits
IDoc asynchronous, as a message in a queue order data, confirmations, anything with volume
RFC / BAPI synchronous (sRFC), as a function call with a response queries that need an answer right away
REST / SOAP via web services when services are already available on the SAP side

IDoc or RFC: when to use which?

IDoc is asynchronous. SAP places the message, a receiver picks it up, and processing reports back later with a status code. That is the route that fits production orders and quantity confirmations: the sender does not have to wait, and if the receiver is briefly unavailable, the message stays in the queue. What this secures is delivery, not processing.

A synchronous RFC call (sRFC) waits for the response. The call goes out, the response comes back, and only then does the caller continue. That fits when information is needed immediately, such as a material check at the line. It does not fit bulk data, because every delay on one side blocks the other. RFC also comes in asynchronous and transactional variants; the IDocs themselves are handed over via transactional RFC.

Feedback belongs in both directions. A transfer that fails without a message goes unnoticed longer than one that aborts with an error. A clean setup therefore reports whether the handoff worked, with three distinct states: successful, aborted and failed. An abort is not an error but an orderly decision, for example when a query returns no data. If the two are lumped together, troubleshooting later starts in the wrong place.

More on this: SAP connection in industrial production · SAP interfaces overview

07

What problems come up when connecting to the ERP system?

The typical failures at this boundary depend less on the product used than on how the connection works: whether it transfers asynchronously or synchronously, where it holds messages, and with which rights it accesses the ERP system. The examples come from the SAP connection; with other ERP systems, the same patterns appear under different object names. The OPC Router has its own plug-ins for the channels listed above: REST, SOAP web services, ODBC and databases such as SQL Server or Oracle, plus file and CSV objects. The SAP connection is a separate plug-in and requires a license. The setup details are in the checklist at the end of this section.

An acknowledgment confirms delivery, not processing

When SAP sends an IDoc to a connected system, the triggering call is acknowledged immediately, before processing has even started. In the ERP system, the message then counts as delivered. Whether it was also processed is only visible there if a second, separate confirmation has been set up.

The cause: Delivery and processing are two separate operations, and only the first is covered by the protocol. A resend after a restart is therefore based on which messages are not acknowledged, not on which ones were not processed.

In operation: An order arrives twice in the receiving system, always after a restart or a connection loss on the return path. Or the reverse: the message shows as sent, but nothing ever arrived in production.

On your side: Whether a repeated message posts a second time is decided by processing in the receiving system. A message that arrives again must be recognizable there as a repeat, through a business key and a duplicate check. And a status that is reported back has to be evaluated on the sending side.

In the OPC Router: It can write the processing result back to SAP as a status record of its own, over a separate RFC connection rather than over the triggering call. The resend at startup then depends on this acknowledgment rather than on delivery. When an IDoc goes to SAP, SAP keeps the processing status itself, and the OPC Router can query it.

A message can wait, a question cannot

Holding data and sending it later is considered the answer to “what if the connection drops?” Where the connection also sends queries, it covers only part of the problem.

The cause: A buffer moves an operation in time. That works for a message that only has to arrive, but not for a question whose answer is needed within the same flow: the answer would arrive after the decision. An ERP connection that both reports and queries therefore splits into two halves. Confirming produced quantities can wait; a material check at the line cannot. The two halves need different failure strategies, so it pays to separate them early when planning an integration.

On your side: First, every record needs its own timestamp from the source. If a record is delivered late while new ones keep flowing, it does not necessarily arrive in the order it was captured, and no software can invent that timestamp after the fact. Second, the split: which flow may wait. Third, sizing: the longest planned maintenance window of the target system should be covered, by retention time and storage capacity for Store & Forward and by the number of retries and the retry delay for the transfer status trigger (see the checklist); only your own plant knows how long that window is. Fourth, what applies in the synchronous half when no answer comes: a substitute value, a stop or a hold. That is for production to decide.

In the OPC Router: In the reporting half, the Store & Forward add-on buffers the data. As a rule, it can be used on any transfer object at the end of a flow, including the SAP transfer objects; whether it applies to a specific transfer object is shown by the Store & Forward icon once the feature is enabled. The add-on’s product page limits it to channels “which do not expect any responses to be processed”. That rules out, for example, an RFC call whose return values the flow evaluates: it belongs to the synchronous half.

A call can also be retried without Store & Forward, with a Try/Catch transfer object: one to four additional attempts, with a constant, linearly or exponentially increasing wait time. This bridges short interruptions: the flow waits at the object until all attempts are complete, and the flow timeout caps the sum of attempts and wait times. The manual warns to use retry only for flows that can safely run more than once; otherwise there is a risk of duplicate write operations. For the synchronous half, which has no holding area, this is also the defined behavior on failure: if the call finally fails, the flow continues with a default value per output, and two dedicated outputs signal to the following steps that it was a substitute.

A green connection test proves little

If the technical user is missing authorizations, it is not the connection that fails, but access to individual functions and tables. This shows up in live operation, on a specific transaction, often weeks after commissioning.

The cause: Authorizations are checked at the point of access, not at logon: S_RFC per function group, the authorizations for tables and postings only inside the function that is called. A connection test therefore only checks the logon.

In operation: The connection runs in the test system but not in production, because the role there is more restrictive. The error appears with the first order that needs a function nobody has used before.

On your side: This is where software takes on the least. The role for the technical user is built in the SAP system, and it has to be defined identically in test and production. Custom function modules, the SAP libraries, secure communication via SNC and open ports come on top (see the checklist).

In the OPC Router: The check itself stays in the SAP system. The OPC Router takes the searching off your hands: the required authorization objects are listed by name in the manual, so they can be requested before the project instead of being added in operation. One step checks more than the connection test: starting every reading flow manually once after publishing, which needs no trigger, exercises its function group before the first order needs it. Posting flows really post when started this way; for them, a reading call to the same function group checks S_RFC, but not the authorizations for the posting itself.

The details behind the three patterns above, to tick off before the project. The information on the OPC Router comes from its manual.

In the SAP system

  • Objects for receiving IDocs: the logical system (BD54), the destination as a registered server program (SM59), the port as transactional RFC (WE21) and the partner agreement with the output mode “Transfer IDoc Immediately” (WE20). They have to be in place before anything can be acknowledged at all.
  • Status codes: Which SAP status code the OPC Router sets for success and for failure is yours to choose; what a code means is defined in SAP.
  • Role for the technical user, defined identically in test and production. For the plain connection, S_RFC on the function groups SYST and RFC1; for tables and table metadata, SDTX, SDIFRUNTIME and S_TABU_DIS; for custom modules, their respective function group; for SAP Query, AQRC; plus read access to the table USR01. Which authorization group belongs to a table is recorded in table TDDAT; if it is missing there, &NC& applies. The function groups of custom modules are on no vendor list and come on top.
  • Custom function modules marked as “Remote-Enabled Module” and active; otherwise they cannot be called via RFC at all. The function name is matched character for character and therefore has to be registered in upper case.
  • Program ID exactly as the entry in SM59: it is matched case-sensitively; upper case is common and recommended there, but not required.
  • SNC: With secure communication, almost all of the work lies with SAP Basis, from the profile parameters to the certificate exchange to enabling the SNC names.
  • Ports: besides 33<system number>, also the inbound port of the IDoc trigger.
  • SAP libraries come from the customer: the vendor may not ship them, and obtaining them requires a valid SAP account.

In the OPC Router

  • IDoc acknowledgment: enable it in the advanced settings of the IDoc trigger and select one SAP status code for success and one for failure; the manual gives status 12 for a successful transfer and status 11 for a failed one as examples. Acknowledgment and resend are switches: they only take effect when enabled. The resend at startup can be narrowed down by recipient partner name and a minimum document number.
  • IDocs to SAP: With the “Wait for Transfer” setting, the IDoc transfer object waits after sending until the IDoc has been processed in SAP; the SAP IDoc Status transfer object queries the status and its message texts for a given IDoc number. The IDoc transfer object places IDocs that cannot be sent in an IDoc queue whose name you configure.
  • RFC return parameter TRANSFER_OK: 1 for a successful transfer, 2 for an abort by a transfer object, 3 for an error during execution. It is a fixed return parameter, not a switch; the calling side in SAP has to evaluate it. A request that has to be resubmitted must not be marked as completed in the connected system. An aborted transfer is not repeated.
  • Trap in expert mode: If “Asynchronous Call” is checked on the RFC trigger, evaluating TRANSFER_OK is irrelevant in that operating mode.
  • Transfer status trigger: It picks up messages from a database table and, after the transfer, marks each record as transferred or failed; the record stays in the table throughout. The table needs a simple (non-composite) primary key. If the option to retry failed transfers is enabled, the trigger retries them after a configurable retry delay, up to a set number of retries. It reads retried and new records in the same query, in the configured sort order; if no sort order is selected, no sorting takes place. For each record, the table shows whether it was transferred, is still pending or has failed, and the retry column counts how often it has been retried.
  • Store & Forward: enable it globally under “Tools > Settings”, where retention time and storage capacity are also set, and additionally per flow. The transfer objects it applies to then show the Store & Forward icon; the manual gives DB Insert as an example.
  • Try/Catch: Retry is disabled by default. Each attempt has a fixed time limit of 30 seconds; exceeding it counts as a failed attempt. Above that sits the flow timeout, 300 seconds unless set otherwise.
  • Separate process: So that an error in the SAP trigger does not stop the whole service, receiving RFC calls and IDocs can be moved to an additional process.

After publishing

  • Reading flows: trigger each one manually once by right-clicking it in the status tree.
  • Posting flows: A manually triggered flow runs in full: if it posts a quantity via RFC, that quantity is posted. A reading call to the same function group covers S_RFC, but not the authorizations for the posting itself.
  • Flows on the IDoc trigger: check them with a test IDoc sent from SAP via WE19.
  • Narrowing down errors: A Try/Catch transfer object in the flow names the error message, the step number and the transfer object that caused the error.
08

What happens when the connection drops?

The question already belongs in the selection phase. Production does not stop because a server restarts, and the data from those minutes must not be missing.

A common approach is to buffer messages. In the OPC Router, on the SAP connection, that can be the Store & Forward add-on, a database table worked through by the transfer status trigger (retry can be enabled) or, when sending IDocs, the IDoc queue for IDocs that cannot be sent (see the checklist above). A manufacturer of outdoor power equipment goes one step further and connects each assembly line through the OPC Router to its own local SQL Server database. The user report from April 2019 counts 16 installations in Germany alone, plus the plants in the USA and China. All information on parts, bills of materials and production periods is available there well before the order starts. The report spells out the consequence: if the connection fails, the current order and the next one can still be produced.

The second question: which system is the master? If ERP and MES both keep the same order status, it has to be settled which one counts. That decision lies with the company and belongs before the first line of configuration.

The SAP connection step by step

The OPC Router connects SAP via IDoc, RFC and BAPI with machines, databases and MES systems, configured graphically. Feedback in both directions can be set up: it acknowledges received IDocs with a status record of its own in SAP, and for IDocs it sends, it queries the processing status. The video tutorials show the setup.

09

What does this look like in real plants?

The following figures come from published user reports and describe the setup at the time of publication, not today.

A manufacturer of self-adhesive materials links 14 machines over 35 connections directly between PLCs and SAP ERP, according to its user report on opc-router.com (undated; its company figures refer to the 2017 financial year). Posting times are below 15 milliseconds at around 15,000 data telegrams per day. The ERP system sends formulation and production speed, and the machines report defects and quality data back. Feedback is part of the design: SAP communication is additionally safeguarded by an RFC handshake, and the confirmation of a completed transfer makes an interruption visible. There is no MES in between.

A packaging manufacturer runs around 500 machines in eleven plants, according to a German-language user report on kepware-opcserver.de from April 2020. An OPC server collects the data at the machines, an OPC Router at headquarters passes it on, and the MES runs on its own SAP database. Collecting the data and making it available takes one to two seconds, and the data volume is around 1.2 gigabytes per day. Where a production data acquisition system used to evaluate the values overnight, the report describes a query every second. Machine connectivity, the integration layer and the MES are three separate systems in this setup.

A manufacturer of polyethylene pipes in Italy, according to the undated international use cases on opc-router.com, uses the OPC Router as the layer between SAP S/4HANA and an MES, over SAP IDoc, SAP RFC and MS SQL Server. Several transactions are configured in both directions, from item master data through raw material receipt and production orders to the confirmation of pieces produced, material consumption and scrap in kilograms.

A long-established specialty chemicals company has automated this confirmation at its filling line. Before, an employee reported the number of containers into the system by hand and applied the label manually. After the changeover, the OPC Router reads the number and the process order number from the PLC and posts the quantity to SAP via RFC; SAP then creates the label, which is applied automatically. The complete message goes back to the PLC and additionally into an SQL database for traceability. As described, this is a case from the synchronous half: the label is created only after the posting in SAP. The line went live on May 1, 2019, after a test phase of around four months.

A manufacturer of wax technologies shows what a connection looks like when it starts as a programming project. According to the use case on opc-router.com about system integrator ZewaTec (page as of January 2025), the first solution connected two Siemens systems and a Yokogawa control system to SAP through a combination of many partial solutions and took around 20,000 lines of code. The page names two weaknesses: the cost of the many software licenses and a data transfer that stalled whenever one of the partial solutions stopped working. The OPC Router then replaced over 90 percent of that programming with graphical connections.

What is a manufacturing execution system (MES)?

The software between business planning and the machine. It takes orders from the ERP system, breaks them down into operations, tracks batches and reports back what was produced.

What does MES stand for in manufacturing?

Manufacturing execution system. In projects, people usually just say MES.

Is SAP an MES?

No, at its core SAP is an ERP system. There are extensions that take on MES tasks, but a standard SAP system without these modules is not an MES.

What is the difference between MES and ERP?

The ERP system plans against the market, in orders and over days to months. The MES plans against the equipment, in operations and shifts.

Does every plant need an MES?

No. ISA-95 describes functions, not a product. A full MES fits when your own processes fit the system. Besides that there are two other routes: build only the functions you need, or drop the level. Then an integration layer takes over the data path between production and the ERP system; MES functions such as detailed scheduling or traceability are not part of its job.

Which interfaces connect an MES to an ERP system such as SAP?

Orders and master data go down; confirmations with quantities, consumption and scrap come back up. Common channels are web services (REST, SOAP), databases and staging tables, files, and the ERP vendor’s own interfaces. With SAP, that usually means IDoc for asynchronous bulk data, synchronous RFC or BAPI calls for queries, plus web services where they are available.

Should I use IDoc or RFC?

IDoc is asynchronous and fits orders and confirmations, because the sender does not have to wait. Whether an IDoc that SAP sends out was also processed is only visible in SAP through a separate acknowledgment. A synchronous RFC call is the right choice when information is needed immediately.

What happens when the connection between MES and ERP drops?

Messages that only have to arrive can wait. As a rule, the Store & Forward add-on can be used on any transfer object at the end of a flow, including the SAP transfer objects. Its product page limits it to channels that do not expect responses to be processed, which rules out, for example, an RFC call whose return values the flow evaluates. On the SAP connection, the OPC Router can also pick up messages from a database table with the transfer status trigger; the record stays in the table. If retry is enabled, it resends failed transfers after a retry delay, up to a set number of retries. IDocs that cannot be sent are placed in an IDoc queue. A call can also be retried without Store & Forward, with a Try/Catch transfer object; this bridges short interruptions but only suits flows that can safely run more than once. For queries whose answer is needed within the same flow, you have to define what applies without an answer and, on the organizational side, which system counts when states conflict.

How can you tell in SAP whether an IDoc was actually processed?

It depends on the direction. When SAP sends an IDoc, the triggering call is acknowledged immediately, and only a second, separate confirmation shows whether it was processed: on the IDoc trigger, you can enable IDoc acknowledgment; the OPC Router then opens an RFC connection of its own and writes back an SAP status code selected in the trigger. When an IDoc goes to SAP, SAP keeps the processing status itself; the SAP IDoc Status transfer object queries it for a given IDoc number. Whether a repeated message posts a second time is decided by processing in the receiving system.

Can a buffer cover every connection loss?

No. A holding area keeps messages, not queries whose answer is needed within the same flow. And it is limited: with the transfer status trigger by the set number of retries, which run at intervals of the retry delay; with the Store & Forward add-on, which as a rule works on the transfer objects at the end of a flow, such as DB Insert, by retention time and storage capacity.

Which SAP authorizations does the connection need?

For the plain connection, S_RFC on the function groups SYST and RFC1; depending on use, additional rights for tables, custom function modules and SAP Query. The list is in the manual and can be requested as a role before the project; the function groups of custom modules are on no vendor list and come on top. Authorizations are checked only on access, not during the connection test. So trigger every reading flow once manually after publishing. A posting flow really posts when triggered; for it, a reading call to the same function group checks S_RFC, but not the authorizations for the posting itself.

Your project
Which data should flow between your ERP system and production

Confirmations, queries, master data: tell us what has to go in which direction. We will reply with the method that fits and the settings the OPC Router needs for it.