> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/guides/sap-s4hana-purchase-to-pay.md).

# SAP S/4HANA purchase to pay: see where each order waits

Connect SAP S/4HANA, Cloud or on-premise, to Duaer. It reads each purchase order's steps from requisition to payment through SAP's standard OData APIs, so you see where orders wait and for how long.
## What does Duaer read from SAP?

Each purchase order is a case. Duaer reads its steps through SAP's standard OData APIs:

The steps match the requested, ordered, received, invoiced and paid steps of purchase to pay. Duaer draws the process map from them, finds where orders wait longest, and can say which suppliers or company codes the delays happen to. The Purchase to pay view in My processes on the employee portal lists time between steps, compliance issues, unpaid invoices and suppliers; refer to [Purchase to pay board](/build/process-findings.md#purchase-to-pay).

- Requisition created and Requisition released: when the linked purchase requisition was created and released (API_PURCHASEREQ_PROCESS_SRV).
- Order created: the purchase order (API_PURCHASEORDER_PROCESS_SRV), with its supplier, company code, currency and net value.
- Goods received and Goods receipt reversed: goods receipts for the order (movement type 101) and their reversals (102) (API_MATERIAL_DOCUMENT_SRV).
- Invoice posted: the supplier invoice's posting date (API_SUPPLIERINVOICE_PROCESS_SRV); reversed invoices are left out.
- Paid: the date the invoice's supplier line item was cleared (API_OPLACCTGDOCITEMCUBE_SRV).

## What does order to cash read?

The same SAP credential also reads order to cash: each sales order is a case, with steps that match the ordered, shipped, delivered, invoiced and paid steps of order to cash. The Order to cash view in My processes on the employee portal lists on-time delivery, time between steps, issues, unpaid invoices and customers; refer to [Order to cash board](/build/process-findings.md#order-to-cash). From SAP S/4HANA under Order to cash, Check system needs only the four APIs below; from the plain SAP S/4HANA tile, the process choice lists only the processes the system can read.

- Order created: the sales order (API_SALES_ORDER_SRV), with its customer, sales organization, currency, net value and requested delivery date.
- Delivery created, Goods issued and Delivered: when the outbound delivery was created, its goods issue posted, and its proof of delivery recorded (API_OUTBOUND_DELIVERY_SRV).
- Invoice created: the billing date (API_BILLING_DOCUMENT_SRV); cancelled invoices are left out.
- Paid: the date the invoice's customer line item was cleared (API_OPLACCTGDOCITEMCUBE_SRV).

Each run reads one kind of document, 100 at most: sales orders by last change, new deliveries by number, changed deliveries by change date (goods issue and proof of delivery come after creation), invoices by number, payments by the date the clearing was entered. SAP's standard APIs give no time for credit release or delivery blocks, so they are not steps yet; credit memos and returns are not read yet.

## How do you connect SAP S/4HANA to Duaer?

1. In SAP, set up a communication user that can read the five APIs above: in S/4HANA Cloud, a communication arrangement for each; on-premise, activate the services in SAP Gateway and authorize the user.
2. In Duaer, create an SAP S/4HANA API credential with the system URL (https, with a port on-premise; http only through an on-premises data gateway), the communication user and its password, and on-premise the client (three digits).
3. As an owner or admin, open your project › Data tables › Duaer cases › Process sources › Add source, choose SAP S/4HANA and the credential, and select Check system. It shows Connected only when all five APIs answer; otherwise it lists each API that does not, with SAP's status code.
4. Choose the Purchase to pay process; the mapping is fixed. Preview, set the schedule and who sees the cases, and confirm.

## What if your SAP system is not open to the internet?

1. As an owner or admin, open Settings › On-premises data gateways in Duaer, add a gateway and copy its token; it is shown once.
2. On a host inside your network that reaches SAP, run the gateway with the docker run command the page gives, with ALLOWED_TARGETS set to the SAP address (for example http://sap.internal:8000). The gateway connects out to Duaer; open no inbound port.
3. When the gateway shows Online with that address, use the same address as the system URL of the SAP S/4HANA API credential and select Check system: it says the system is reached through the gateway.

The gateway reaches only the addresses in ALLOWED_TARGETS, follows no redirects, caps each request and answer at 20 MB, times out after 60 seconds, and logs each call. While the gateway is offline, Check system and reads say so, and the source pauses and notifies the person who set it up and the owners. Revoke the gateway in Settings when it is no longer needed; its token stops working at once.

## How often does it read, and how much?

Each run reads one kind of document, 100 at most: purchase orders by last change, goods receipts and invoices by document number, payments by the date the clearing was entered, each from where it stopped. After a round of all four, it waits for your schedule; a first read of many documents finishes over several runs. A step is never written twice.

## What are the limits?

- Read only: Duaer never writes to SAP.
- SAP's standard APIs do not give the time a purchase order was approved, so it is not a step yet; nor are payment blocks.
- An invoice reversed after it was read keeps the step already written.
- User and password (Basic) authentication only; OAuth for S/4HANA Cloud is not supported yet. An on-premise system that is not open to the internet is reached through an on-premises data gateway (see above).

To see how Duaer puts process analysis and follow-through together, open the [Duaer home page](https://www.duaer.com/).
## Questions

### Does Duaer support SAP ECC?

Not yet. It reads the standard OData APIs of S/4HANA, Cloud and on-premise.

### Does Duaer change data in SAP?

No. Duaer only reads the five APIs and never writes anything.

### Do all five APIs have to be open?

Purchase to pay needs those five; order to cash needs the sales order, outbound delivery, billing document and clearing APIs. Check system lists any that does not answer, with SAP's status code; grant access and check again.

## Related

- [Add a process source in Duaer](https://doc.duaer.com/build/process-sources.md)
- [See the process in your data and generate workflows in Duaer](https://doc.duaer.com/build/process.md)
- [Process findings and SOP conformance in Duaer](https://doc.duaer.com/build/process-findings.md)
- [Turn SOPs into AI follow-through with Duaer](https://doc.duaer.com/guides/sop-follow-through.md)
- [Enterprise AI search vs process mining: what’s the difference?](https://doc.duaer.com/guides/ai-search-vs-process-mining.md)

