How to add document OCR to SAP S/4HANA
Short answer
Extract fields from scanned or PDF documents, validate them against purchase orders, goods receipts and master data, and post through supplier invoice and attachment APIs. Low confidence fields or failed matches go to a review screen. Keep the original document linked to the SAP object for audit.
S/4HANA gives you strong processes for three-way match, goods receipt and quality certificates, but it expects clean data. In reality documents arrive as scanned invoices, supplier packing slips, mill certificates, certificates of conformance and hand-annotated drawings. Someone still keys or attaches them.
OCR for S/4HANA is only valuable if it respects what SAP will check later: tax codes, payment terms, PO and goods receipt references, vendor bank data, plant and unit of measure. A tool that produces text but ignores these produces exceptions, not savings.
This page covers the SAP side of document capture: where to hook in, which interfaces accept the results, and how to build confidence thresholds and review that auditors will accept.
What teams use it for
Supplier invoices against POs
Extract invoice header and lines, find the matching PO and goods receipt, and create the supplier invoice in the MM invoice verification process with exceptions flagged for price or quantity tolerance.
Packing slips to goods receipts
Read supplier delivery notes at the dock and propose the goods receipt against the PO, showing differences to the ordered quantity before posting.
Certificates of conformance and mill certs
Capture heat numbers, material grades and test results and attach them to the batch or inspection lot, so quality can find the certificate by batch rather than by filename.
Customs and transport documents
Extract HS codes, weights and reference numbers from supplier and carrier paperwork and populate fields used by foreign trade processing.
Drawing and revision capture
Read title blocks on incoming drawings to capture drawing number and revision and link them to the document info record for the material.
SAP S/4HANA integration surface
- Supplier invoice APIs (the released supplier invoice OData service on the SAP API Business Hub, or the MIRO-related BAPIs on classic setups); confirm service names for your release.
- Goods receipt posting through the material document API or MIGO-related BAPI (BAPI_GOODSMVT_CREATE), for packing slip scenarios.
- Document Management (DMS) document info records and ArchiveLink / Generic Object Services for storing and linking original files to business objects.
- SAP Document Information Extraction on SAP BTP where licensed, or third-party capture such as OpenText, Kofax and similar products which have established S/4HANA connectors; verify current product names and availability.
- Master data checks through business partner, material and info record APIs: vendor VAT IDs, bank details, tax codes, order units.
- The Fiori invoice apps and exception handling worklists for the human review step on invoices that fail match.
How it works
- 1
Choose document types and rank by pain
Count monthly volume, error rate and touch time per document type. Invoices are usually first, certificates and packing slips second.
- 2
Set up ingestion
Take PDFs from mailbox, scanner folders or supplier portals into a capture service with image clean-up, deskew and page splitting. Preserve the original as an immutable file.
- 3
Extract with per-field confidence
Use a layout-aware OCR plus an LLM or specialised model to extract fields. Store the value, bounding box and confidence per field for the review screen.
- 4
Validate against SAP
Look up the vendor, PO, GR and tax code; check totals and tolerances. Apply duplicate detection on vendor, invoice number, date and amount.
- 5
Review, then post
A clerk sees the image beside extracted fields with colour-coded confidence. Approved documents post through the invoice or goods movement API; others stay parked.
- 6
Learn from corrections
Feed corrections back as per-vendor rules, such as which label is the invoice number, which date format they use and which GL account they typically hit.
Example flows
Invoice matched to PO and goods receipt
Trigger: A supplier invoice PDF arrives in the AP shared inbox.
- The PDF is stored and OCR extracts vendor, invoice number, date, totals and lines.
- The vendor VAT ID resolves the SAP vendor; the PO number is matched on the first page.
- Quantities and prices are compared with the PO and goods receipts within tolerance.
- All checks pass; the service creates the supplier invoice through the API with the PDF attached.
Result: A clean invoice posts without keying, while one with a price variance goes to the buyer.
Mill certificate attached to a batch
Trigger: A certificate PDF arrives with a steel delivery.
- OCR extracts heat number, grade, chemical composition and test values.
- The heat number is matched to the batch created on goods receipt.
- Values are compared with specification limits from the inspection plan.
- The certificate is attached to the batch and inspection lot; out-of-limit values raise a quality notification.
Result: Quality can find the certificate by batch, and non-conforming values are caught at receipt instead of at assembly.
Keeping data on-prem
Documents contain vendor bank details, prices and sometimes controlled technical data, so many manufacturers want capture inside their network. Open-source OCR engines and open-weight vision-language models can run on local GPUs, with the capture service writing to S/4HANA through an internal API gateway. Store originals in your DMS or file store, not in a vendor cloud. SAP's own cloud extraction service requires BTP connectivity, so for on-premise or air-gapped plants confirm whether it is allowed or choose a locally hosted alternative. Keep a model version and extraction log per document so results are reproducible.
Security checklist
- Validate vendor bank details against master data and require a separate approval for any change, since invoice fraud often arrives as a PDF.
- Run duplicate checks across vendor, number, date and amount before posting.
- Keep originals immutable and linked to the SAP object, with retention aligned to tax and audit rules.
- Limit who can edit extracted values and log every correction with user and timestamp.
- Strip or redact export-controlled drawings from any cloud service, or keep processing on-premise.
Ways to get it done
SAP or partner invoice capture product
Effort: Medium to high for licences, templates and integration, then low run effort.
Best for high-volume AP with standard invoices, where an established product with S/4HANA connectors and support makes sense.
Custom capture service with a local model
Effort: Several weeks per document type, plus a labelled sample set.
Fits varied documents like certificates, packing slips and drawings that off-the-shelf invoice tools do not cover.
Netray private capture
Effort: Pilot on one document type in weeks; expand by type.
When documents must stay on-premise and you need review queues, vendor-specific learning and validation against S/4HANA data.
Pitfalls
- !Accuracy on sample invoices is not accuracy on your worst vendors. Test per vendor on real volume before choosing thresholds.
- !Skipping duplicate detection leads to double payments, particularly with resent PDFs.
- !Tax code determination is country and product dependent; defaulting it silently creates compliance problems.
- !Multi-page and multi-PO invoices need explicit handling, or lines get attached to the wrong order.
- !Storing images only in the capture tool, not in SAP's DMS or attachment service, breaks audit access later.
Frequently asked questions
Does S/4HANA have built-in OCR?
Core S/4HANA does not extract text from images on its own. SAP offers cloud document extraction on BTP and partners offer capture suites. Which of these is available and licensed for you depends on your contract and edition.
What accuracy should we expect?
It varies with document quality and vendor layout. Clean digital PDFs from repeat vendors can be highly reliable, while scans and handwriting are not. Measure per field and per vendor and set review thresholds from your own data.
Can OCR create the goods receipt too?
It can propose one from a packing slip, but posting should be confirmed by the warehouse because physical receipt is what matters. Use OCR to pre-fill and compare, not to confirm what has not arrived.
How do we handle certificates for traceability?
Extract heat or lot numbers, match them to batches and attach the document to the batch or inspection lot. Compare values to inspection specs and raise a notification when out of range. Keep the original file for audits.
Can this run fully on-premise?
Yes, with open-source OCR and open-weight models on local GPUs, plus an internal path to S/4HANA APIs. You trade a managed service for operational responsibility, but sensitive documents stay inside your network.
Want Document OCR working on your SAP S/4HANA?
A free 30 minute assessment: we map the integration path for your version and setup, and where it should run.
Get a free assessment