SAP S/4HANA Public Cloud & Magento e-commerce Integration Using SAP Integration Suite

By - Parthiban

Organizations which use e-commerce platforms like Magento rely on seamless ERP integration to ensure accurate order fulfilment, real-time inventory visibility and smooth financial reconciliation. In our use case, when a Goods Issue (PGI) is created and Outbound Delivery is released in SAP S/4HANA Public Cloud, a corresponding Shipment must be auto-created in Magento for the original customer order. This will give real time insight about the order status to the end buyer.

Business Challenge:

Currently, there is no native integration between SAP S/4HANA Public Cloud and Magento, leading to manual updates, data mismatches, and delays in logistics processing. Synchronizing delivery and shipment information becomes error-prone without an event-driven, automated integration mechanism.

Technical Solution Overview:

Leveraging SAP Integration Suite, we implemented a streamlined, event-driven integration that automates and stabilizes data exchange between SAP S/4HANA Public Cloud and Magento.

To maintain end-to-end traceability, custom extension fields were added in the product master and sales order to store the Magento Order Reference ID whenever an online order is replicated into SAP.

During the Order-to-Cash process, once PGI and Outbound Delivery Release occur, SAP S/4HANA Public Cloud emits a Business Event. This event is published to SAP Event Mesh, which then forwards the payload to a custom iFlow in SAP Integration Suite. The figure below shows the outbound delivery event as it appears in SAP Event Mesh.

Outbound delivery - Event Mesh

Within the iFlow, the integration logic retrieves the required delivery and sales order information using targeted GET APIs and constructs the JSON payload required for the Magento Shipment Creation API. The shipment is then created automatically in Magento, enabling real-time synchronization without manual effort.

iFlow Processing Overview

The following image provides an overview of the custom iFlow developed to enable this integration

1. Event-Triggered Process (Standard Flow)

HTTP Sender (AMQP) => Convertor (JSON to XML) => Token Fetch (Magento) => Query Outbound Delivery (By Outbound Delivery ID) => Router (Count > 0) => Query Sales Order (By Outbound Delivery SD Reference) => Router (Magento Reference Count > 0) => Payload Generate => Post Call (Create Shipment in Magento) => Post Call (Create Log in RAP application).

2. Retrigger Process (For Failed Cases)

HTTP Sender (Outbound Delivery ID) => Token Fetch (Magento) => Query Outbound Delivery (By Outbound Delivery ID) => Router (Count > 0) => Query Sales Order (By Outbound Delivery SD Reference) => Router (Magento Reference Count > 0) => Payload Generate => Post Call (Create Shipment in Magento) => Post Call (Create Log in RAP application).

Both the event-driven flow and the retrigger flow include comprehensive exception handling.

Magento Shipment Overview

The shipment created in Magento appears as shown below for the corresponding customer order. 

Magento Shipment 

Monitoring, Logging & Attachment

SAP Integration Suite allows detailed logs, including request and response payloads, making it easy to track what data was sent and received. This helps during troubleshooting and provides clear visibility of each transaction.

Monitoring Logs and Attachments in Sap Integration Suite

RAP-Based Observability and Reprocessing Architecture

To strengthen observability, a custom RAP (RESTful ABAP Programming) Application was developed in SAP S/4HANA Public Cloud. It records all integration transactions—success, failure and retriggered—along with timestamps, status codes, API responses, error details, and business references including any attached files exchanged during integration.

A built-in Reprocess Function allows users to re-trigger failed transactions directly from the SAP S4HANA Public Cloud log UI, significantly reducing manual intervention and improving operational resilience.

This logging and reprocessing framework provides a balanced, high-performance audit trail suited for complex, event-driven SAP–Magento integrations.

RAP Application  - Magento Interface Logs

API Call Execution:

SAP S/4HANA Public Cloud APIs

  • Get Delivery Information 
  • Get Sales Order 
  • Post Magento Log

Magento APIs

  • Shipment Creation API 
  • Token Fetch API

Key Highlights:

  • Secure, scalable SAP - Magento connectivity via SAP Integration Suite 
  • Event-driven integration using SAP Event Mesh 
  • End-to-end tracking through custom RAP logs 
  • Reprocess capability for faster issue resolution 
  • Automated shipment creation reduces manual work and errors

Business Benefits:

This solution helps e-commerce operations run more smoothly by aligning SAP and Magento in real time. It reduces manual effort, improves accuracy, speeds up the fulfilment cycle, and ensures customers receive timely updates on their orders.
It also provides strong monitoring and control, making it easier for business and operations teams to manage day-to-day activities.

Parthiban

Parthiban