WhatsApp
SAP Technical

Idempotency in SAP CPI: Prevent Duplicate Messages

Best Online Career

SAP Consultant

December 4, 2026
Idempotency in SAP CPI: Prevent Duplicate Messages

Introduction

Duplicate data is often an issue in integration. If a system does not receive a response from the network and so times out, it may re-transmit a message. Even if the initial message was received, duplicates can therefore occur. This can result in duplicate purchase orders, re-charge of payments and/or erroneous updates to data.

Within the SAP Integration Suite, SAP Cloud Integration (CPI) offers features for the detection and management of duplicates. It is key for integration developers to understand the concept of idempotency.

This tutorial describes how idempotency is utilized in SAP CPI. It also demonstrates how to set up an Idempotent Process Call and how to manage duplicates within an integration.

1. Understanding Idempotency

An integration is said to be idempotent if re-executing a business request yields the same business outcome as originally executing it.

For example, an integration could exist between SAP S/4HANA and a third party procurement system. Should a purchase order be sent and the sender does not receive a response due to network issues, the sender will re-transmit the message. There is therefore a risk that the receiver will receive duplicate purchase orders.

However, an idempotent integration will recognize this re-transmission and stop the receiver from generating a further purchase order.

Doing so increases data accuracy and avoids superfluous actions.

2. Sources of Duplicate Data

Duplicates can occur in integration in a number of ways including:

Network issues – the receiver executes a message but does not receive confirmation of this to the sender.

Retransmission – due to a time-out, the sender will re-transmit a message.

Middleware issues – an integration flow fails and is subsequently re-attempted.

Asynchronous communications – in queue based messaging, messages can be resent following intermittent issues.

Duplicate detection is therefore a key feature within an integration.

3. Setting up an Idempotent Process Call

Within SAP CPI there is an Idempotent Process Call function which recognizes previously executed messages.

An idempotent store is used to record the message IDs of already executed messages. Should CPI receive a message containing a duplicate ID it can either bypass execution, or recognize it as a duplicate.

Integration developers can set up this feature within an integration flow.

Key settings to configure are:

Integration process – specify which sub-process should be idempotent.

Message ID – assign a message identifier either via a message header or exchange property.

Skip Process Call for Duplicates – activate this to allow CPI to bypass re-execution of the integration sub-process.

It is crucial that the message ID remains constant on re-transmission. If a new random message ID was allocated for each request then duplicate business actions would not be recognized.

4. Avoiding Duplicate Purchase Orders

Imagine an integration whereby a third party procurement system transmits purchase orders to SAP S/4HANA using SAP CPI.

If a purchase order (for example, PO10025) is sent and successfully received, but confirmation is not received by the procurement system, it will re-transmit the message.

Steps to avoid duplicate purchase orders include:

Receiving a purchase order using an HTTP sender adapter.

Ready to Start Your Learning Journey?

Join thousands of learners and build your future with expert-led courses and 100% practical training.

Expert Guidance

Learn from industry experts

Trusted & Recognized

Top-rated by learners

Flexible Learning

Online options

Placement Support

Career support & more

Using a Content Modifier to obtain the purchase order number from the XML message.

Saving the purchase order number to an exchange property.

Configuring an Idempotent Process Call and specifying the purchase order number as the Message ID.

Embedding the receiver communication within the relevant integration process.

Activating Skip Process Call for Duplicates so that the integration process is not re-executed.

The Message ID can for instance be set to refer to an exchange property:

${property.orderNumber}

On re-occurrence of PO10025, CPI will recognize that this purchase order was successfully executed and bypass the defined integration sub-process.

The integration will therefore avoid re-sending the same purchase order.

5. Managing Duplicates – Providing Alternative Responses

In some cases, merely bypassing duplicate messages is insufficient.

Within synchronous integration, the invoking application may require confirmation as to whether or not a message was executed or recognized as a duplicate.

Developers can un-tick the Skip Process Call for Duplicates setting and then analyze the value of an exchange property:

${property.CamelDuplicateMessage} = 'true'

A Router can subsequently distinguish between standard and duplicate messages.

Standard messages are directed to the receiver system. Duplicate messages, however, can trigger an alternative response. For example, this might involve informing the invoking application that the purchase order already exists.

This facilitates improved inter-application communication.

6. Best Practice for Robust Idempotent Integration

Below are best practice guidelines for developing SAP CPI integrations suitable for live use:

Identify and utilize robust business data such as purchase order and transaction numbers.

Ensure that this data remains unchanged on re-transmission of messages.

Apply idempotency to the business action which should not be re-executed.

Simplify the idempotent sub-process in order to minimize the risk of issues occurring.

Wherever possible, also apply idempotency at the receiver.

Be aware of both the functionality and constraints of the idempotency store.

Before an integration is live, test for network, re-transmission and re-invocation issues.

Whilst duplicate recognition at middleware level can assist in achieving exactly-once business execution, it is not foolproof in all failure scenarios. Greater security can be provided by also applying idempotency at the receiver.

Conclusion

It is key to recognize the importance of idempotency in SAP CPI integration development. Developers can enhance integration robustness by utilizing an Idempotent Process Call, defining suitable message IDs and defining suitable responses for managing duplicates.

For integration experts, knowledge of idempotency is a key skill. Combining SAP CPI training with practical examples of its application can effectively enable integration developers to devise resilient integration flows for genuine enterprise use.

Tags

#SAP CPI#SAP Integration Suite#Idempotency#iFlow#Error Handling#SAP BTP

Share this article

Help others discover this valuable SAP content

About Best Online Career

Experienced SAP consultant with expertise in various SAP modules. Dedicated to helping professionals advance their SAP careers through quality training and guidance.

Related Articles