Email automationSAP S/4HANA Agent view

How to automate email into SAP S/4HANA

Short answer

Monitor the shared mailboxes, classify each email and attachment, extract structured data, validate it against S/4HANA master data, and create or update documents through released APIs. Anything below a confidence threshold goes to a review queue instead of posting.

A surprising amount of S/4HANA order intake still arrives as email: customer purchase orders as PDFs or spreadsheets, supplier order confirmations, shipping notices, RFQ replies and a steady stream of questions that start with 'what is the status of'. Someone retypes them into VA01, ME21N or a Fiori app, and mistakes follow.

Email automation here means more than OCR. The hard parts are identifying which customer and which ship-to the email refers to, mapping their part numbers to your materials, handling revisions, and deciding whether this is a new order, a change or just a question.

The goal is not zero-touch on day one. A good implementation starts by drafting the SAP transaction for a person to confirm, and promotes the most reliable senders to automatic posting once the numbers support it.

What teams use it for

Customer PO to sales order

Read the PDF or EDI-like attachment, find the sold-to using the sender and PO header, map customer material numbers using customer-material info records, and create a draft sales order through the sales order API.

Supplier order confirmations

Match a supplier's acknowledgement to a PO using the PO number and line references, then update confirmed dates or flag differences from the requested dates to the buyer.

Advance shipping notices by email

For suppliers without EDI, parse shipment notices and create inbound deliveries or update expected receipt dates so warehouse planning sees them.

RFQ response capture

Extract quoted prices, lead times and validity dates from supplier replies and attach them as quotation data to the RFQ for comparison.

Status request deflection

Classify routine 'where is my order' emails, look up the sales order and delivery status, and draft or send a reply grounded in the actual document flow.

Invoice and credit memo intake

Route supplier invoice emails to the invoice capture process, covered separately in the document OCR page, while this flow handles classification and exceptions.

SAP S/4HANA integration surface

  • SAPconnect (transaction SCOT) and the SMTP node for outbound mail, with inbound handled by an SAP-side inbound email processing class (SO50 and email handlers) or, more commonly, an external mail reader that talks to SAP over APIs.
  • Released sales order, purchase order, supplier invoice and inbound delivery APIs on the SAP API Business Hub; verify service names for your release in /IWFND/MAINT_SERVICE.
  • Customer-material and supplier info record data (tables behind transactions VD51 and ME11 respectively) for part number mapping, exposed through released or custom CDS-backed services.
  • Generic Object Services and attachment APIs so the original email and PDF are stored with the created document for audit.
  • Business Rule Framework plus (BRF+) or a rules service for routing decisions such as which plant, sales area or buyer handles an email.
  • Microsoft Graph or IMAP for the mailbox side, since reading shared mailboxes from within ABAP is rarely the best option.

How it works

  1. 1

    Inventory the mail types and senders

    Sample a few hundred real emails per mailbox. Classify them: new PO, change, confirmation, question, spam. Identify the top senders, because a few customers usually represent most volume.

  2. 2

    Connect the mailbox

    Use Graph or IMAP with a service account on a shared mailbox. Read, tag and move messages but keep the originals. Preserve headers for threading.

  3. 3

    Classify and extract

    A model or rules extract header fields (customer PO number, dates, ship-to) and lines (customer part, quantity, price, requested date) into a structured form with a confidence value per field.

  4. 4

    Validate against S/4HANA

    Check the sold-to, ship-to, material mapping, units, price against pricing conditions and credit status. Mismatches are exceptions, not auto-corrections.

  5. 5

    Create a draft or document

    Post through released APIs with the email linked as an attachment. Start in draft or with a hold status where your process supports it, and let a clerk release it.

  6. 6

    Close the loop

    Send an order acknowledgement from SAP output, update the mailbox thread with the sales order number, and feed corrections back into the mapping rules.

Example flows

Repeat customer PO by email

Trigger: An email with a PDF PO arrives from a customer known to the system.

  1. The classifier tags it as a new PO and extracts the header and lines.
  2. Customer part numbers are mapped through customer-material records; two lines have no mapping.
  3. The service creates a draft with mapped lines and flags the others for the clerk.
  4. The clerk fixes the two lines, approves, and the sales order posts through the API.
  5. An acknowledgement goes to the customer from standard output.

Result: Typing time falls to correcting exceptions, and every order has the source email attached.

Supplier confirmation changes a date

Trigger: A supplier replies to a PO email with a later delivery date.

  1. The email is matched to the PO using the PO number and thread headers.
  2. The service extracts the new date per line.
  3. It compares to the schedule line and the production demand date.
  4. Because the new date breaks a production order start, it notifies the planner rather than silently updating.

Result: Delays are surfaced as decisions, not discovered at goods receipt.

Keeping data on-prem

Email content often includes drawings, pricing and customer names, so many S/4HANA customers do not want it sent to an external AI service. Run extraction and classification with an open-weight model on local GPUs inside your network, read the mailbox via an on-premise Exchange or a Graph app locked to your tenant, and call S/4HANA through an internal API gateway. Keep the raw emails and attachments in your own storage and write only references plus the extracted fields into SAP. For air-gapped setups, an internal mail relay with a scanned import folder can substitute for live mailbox access.

Security checklist

  • Treat inbound email as hostile: scan attachments, strip active content, and never execute links or macros from messages.
  • Beware of spoofed senders and payment-detail changes. Verify sender domains, and route any bank detail or address change to a manual process.
  • Use a dedicated technical SAP user with narrow API rights, and prevent it from posting beyond configured value limits.
  • Store the original email with the document for audit and retain it per your records policy.
  • Log extraction output, confidence and the human decision so you can prove how a document was created.

Ways to get it done

SAP and partner order capture products

Effort: Medium, with templates and licensing to configure.

Several vendors sell order and invoice capture that integrates with S/4HANA. They are a good fit for standard forms and large volumes, and usually priced per document.

Build with an LLM extraction service in-house

Effort: Several weeks for a first mailbox, with ongoing tuning.

Works when documents vary widely by customer and you have developers to maintain mappings and validations.

Netray with private models

Effort: Pilot in weeks on one mailbox; add senders gradually.

Fits when documents cannot leave your network and you want review queues, mapping memory and agent-style follow-ups.

Pitfalls

  • !Customer part numbers and units of measure cause more errors than OCR does; invest in the mapping tables first.
  • !Auto-posting before you measure accuracy per sender creates quiet errors that surface at invoicing.
  • !Replies in the same thread can be changes, cancellations or just questions. Classify at message level, not thread level.
  • !Pricing in the customer's PO rarely matches condition records; decide in advance whether to flag, block or accept.
  • !Forgetting attachment size limits and duplicate emails leads to duplicate orders. Deduplicate on customer PO number plus sender.

Frequently asked questions

Can S/4HANA read inbound email by itself?

SAPconnect supports inbound email handling, but it is limited for parsing attachments and unstructured content. Most teams read the mailbox externally, extract data, and post through released APIs, which is easier to maintain and upgrade.

Is it safe to let AI create sales orders?

Yes if you start with drafts, validate against master data, set confidence thresholds and keep a person in the loop until accuracy per sender is proven. Auto-posting should be limited to well understood senders and low-risk values.

What data do we need for matching customers?

Sender email domains, customer PO formats, ship-to addresses, customer-material info records and previous orders. The better these are maintained in S/4HANA, the more reliable the matching becomes.

Does this replace EDI?

No. EDI is more reliable for large partners. Email automation is for the long tail of customers and suppliers who will not or cannot do EDI, and it can pave the way for an EDI conversation later.

How long until it pays back?

It depends on volume and complexity. Teams with hundreds of order emails a day often see value within months, while low volume mailboxes may be better served by simple templates and a process fix. Measure current touch time first.

Want Email automation 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