AI & automation

Automated document processing — OCR and AI connected to ERP

Maciej Zaleski · Published · Updated · 7 min read

Automated document processing means moving from a file to verified data that can be used in a business process. OCR recognizes text, while a language model can help interpret varying layouts and field meanings. Safely writing the result to ERP also requires validation rules, duplicate checks, and human exception handling.

This applies not only to invoices but also to orders, export documents, and quality documentation, including certificates of analysis. Each type carries different risks. Reading a document number is not the same as confirming that batch parameters meet a customer's requirements.

Automated document processing as a process

Design the entire workflow, not just the reading screen. A document may arrive by email, from a business partner's portal, or from a repository. Next, its type must be identified, page completeness checked, content read, fields assigned, and the result compared with reference data. Only then do approval and writing take place.

Individual stages should have their own statuses. The operator must know whether the problem is an unreadable file, a missing business partner, an inconsistent total, or ERP unavailability. A single generic error status makes work harder and sends cases requiring different skills into the same queue.

Initially, choose one document type and define the pilot's boundaries. Do not mix simple order confirmations with complex quality attachments just because they are all PDF files. A shared file format does not imply shared data meaning or identical checking methods.

What OCR does and what a language model does

If a PDF contains a correct text layer, you can start by reading it rather than recognizing the entire image again. Scans require OCR. Input quality matters: blur, a rotated page, or a cropped table can hamper subsequent stages regardless of the model chosen.

A language model can map different terms to a common schema, recognize relationships between fields, and organize the output. However, it should work with a defined response structure. A missing value should be recorded as missing, rather than asking the model to supply it based on the most probable context.

Keep every important field linked to its source: a page, text passage, or image highlight. An operator can verify a value faster when it appears alongside the original. A model-generated explanation is no substitute for evidence from the document.

Invoices and orders — from fields to business consistency

On an invoice, the presence of a number, date, and amount does not itself mean the reading is correct. Formats, relationships between values, and the link to the business partner must be verified. Totals should be checked deterministically using the rules adopted for the process, not by asking the model whether the document “looks right.”

For orders, matching line items to product master data can be crucial. The customer's product name may differ from the name in ERP. The system should use approved mappings and route ambiguous cases for clarification. A similar product must not be selected automatically based solely on linguistic similarity.

Changes to bank accounts, business partner details, or other sensitive information require separate control rules. Reading a document should not, by itself, update master data. It is worth separating permission to prepare a record from permission to change master data and approve the operation.

Export documents and certificates of analysis

For export documents, you can check consistency in goods descriptions, quantities, transaction parties, and links between attachments. The system should flag discrepancies, not independently resolve unclear formal issues. The required document set depends on the specific process and should be described by the people responsible for handling it.

A certificate of analysis may include a batch identifier, parameter name, method, result, and unit. Reading should preserve the relationships between these elements. Inequality signs, decimal separators, ranges, and footnotes require particular attention. Losing a single symbol can change a value's interpretation despite apparently correct text recognition.

Comparing results against a specification requires an approved source of requirements and controlled rules. The model should not invent acceptable ranges. In organizations in the pharmaceutical industry, quality decisions must remain within established responsibilities, procedures, and requirements for the process concerned.

Current industry regulations, personal-data requirements, and any applicability of the AI Act should be verified with a specialist. A technical architecture description does not establish compliance. The scope of documentation, validation, and approval should follow an analysis of the specific use case.

Validation and human-in-the-loop

Human oversight should have a clearly defined purpose. Operators do not have to retype the entire document, but should see fields requiring a decision, the reason for the hold, and source material. Approval without a way to check context can easily become routine clicking.

Control layer Example question
Technical Can the file be read, and does it contain every page?
Structural Are required fields present and correctly formatted?
Arithmetic Do values satisfy the agreed relationships?
Reference Do the business partner, product and batch exist in the system?
Business Does the document match the order and applicable specification?
Decision Does the case require approval by an authorized person?

Do not base the approval path solely on the model's stated confidence. It is better to combine test results, rule checks, and the importance of the field. An error in an auxiliary description may carry different weight from an error in a batch identifier or liability amount.

Operator corrections are worth recording for quality analysis. However, they should not automatically change rules for all subsequent documents. First determine whether a correction reveals a new process variant, a configuration error, or a one-off exception requiring manual handling.

ERP integration without losing control

Writing to ERP should use an agreed interface and appropriate permissions. The document-processing system must receive confirmation of which record was created. If a request times out after submission, a retry must not create another instance of the same operation without checking.

In practice, document and operation identifiers, status histories, and transient error handling are needed. The original file, extracted output, and approved data version should remain distinguishable. This helps explain whether a discrepancy arose during recognition, correction, or writing to the target system.

Not every organization should immediately enable fully automatic writing. Preparing a draft document in ERP is a sensible intermediate step. Go2ops works with Dynamics NAV and Business Central and with workflow automation in pharmaceuticals; however, the scope of a particular integration requires checking the configuration and available interfaces.

How to run a pilot and assess quality

Build a document set covering different suppliers, layouts, languages, and scan qualities. Separate examples used for configuration from the final evaluation set. Include incomplete and out-of-scope documents to check whether the system can stop them rather than force an output.

Measure field-level correctness, review time, and the number of cases that must be returned to the sender. Analyze critical errors separately. An attractive preview and fast reading are not enough if an employee must subsequently compare every line item against the original manually. Evaluate the whole workflow, including exceptions and retries.

You can base your first experiment on our guide to implementing AI in a company. If the process requires selecting an integration tool, the comparison of n8n vs Make and Zapier will also help. A tool should support the agreed rules, not replace them.

FAQ

Is OCR enough to automate documents?

OCR provides text but usually does not solve field mapping, business checks, or integration. Rules may suffice for a fixed, simple format. With variable documents, it is worth testing additional interpretation without abandoning validation.

Can all documents be approved automatically?

Do not assume this before risk analysis and test results. Some cases may always require a human. The automatic path's scope should follow from data quality, the consequences of errors, and established procedures.

How should an illegible scan be handled?

The system should flag the problem and route the document for correction or review. Guessing missing values is not an appropriate way to fix quality. Distinguish missing information from an uncertain reading of information present in the file.

Can a model assess compliance of a certificate of analysis?

It can help read and compile data, but compliance criteria must come from an approved specification. The decision and level of oversight must be designed in line with the organization's risks and procedures. A model description alone does not establish process correctness.

Summary

A well-designed workflow combines document reading with validation, human review, and predictable writing to ERP. First limit the scope, prepare representative samples, and define unacceptable errors. Only the results of such a test allow you to assess whether expanding automation is justified.

If you want to analyze your own workflow, let's discuss systems and data integration. The starting point can be one document type and a description of how it currently moves from sender to approved record.

MZ

Maciej Zaleski

Managing Director, Go2ops

Related articles