Integrate ERP

Elevate, May 20-22-2025, Miami Beach, Florida

Integrating a commerce solution, such as commercetools, with an Enterprise Resource Planning (ERP) system is often a central aspect of a commerce project. An ERP system typically holds the key master data crucial for a business. This data includes product information, customer data, and inventory levels. To ensure smooth operations, the data, as well as core business processes, such as order replication, must be effectively managed and synchronized between the commerce solution and the ERP system.

In this guide, we'll explore key considerations of integrating commercetools with an ERP system. You'll gain insights into the strategic considerations for middleware selection, detailed guidance on the integration architecture, data flow and data mapping for SAP ERP systems, and best practices for ensuring a robust, secure, and efficient integration.

Choose the right integration solution

When integrating commercetools with an SAP ERP system, such as SAP S/4 HANA, a critical consideration is using middleware. Middleware bridges the commerce platform and the ERP system, facilitating communication and data exchange. It plays a vital role in ensuring that the integration is seamless, efficient, and reliable. When selecting a middleware solution for this integration, consider the following key factors to ensure the solution aligns with the business's needs and capabilities:

  • Scalability and performance: the middleware should be able to accommodate the growth of the business, handling increased data volumes and more complex operations without compromising performance.
  • Security: given the sensitive nature of the data exchanged, the middleware must provide robust security features to protect against data breaches and unauthorized access.
  • Flexibility: the chosen middleware should be adaptable to the business's specific requirements and capable of integrating with various systems and technologies as needed.
  • Team skillset: the technical expertise required to implement and maintain the middleware should match the team's skillset.
  • Cost: the overall cost of the middleware, including initial setup, maintenance, and potential scalability needs, should be evaluated against the budget and the expected return on investment.

When it comes to middleware integration to connect commercetools with SAP ERP, two of the most prominent options are SAP Cloud Integration and best-of-breed middleware solutions, such as Boomi, and MuleSoft.

  • SAP Cloud Integration (SAP CI): a centralized solution for linking various systems and applications, acting as middleware to connect ERP and commerce systems. It allows you to create and manage integration flows, including data mapping and transformation, using APIs for smooth data exchange between commercetools and SAP ERP. It's best suited for customers already using SAP CI to connect various other systems with SAP ERP.

  • Best-of-breed middleware: a platform as a service solution for integrations that comes with pre-built connectors. They allow you to connect commercetools and SAP ERP quickly and easily, without extensive development work. Recommended for customers looking for full flexibility and custom integration flows to meet specific requirements.

Typical data flow for B2C and B2B transactions

The following table outlines the data flow and data mapping between SAP ERP and commercetools, and the recommended integration method:

SAP data typeData flow for replicating dataData mapping detailsIntegration method
Products and MaterialSAP ERP -> commercetoolsMATMAS IDOCs -> Product and Product VariantAsynchronous: batch and delta
Product ClassificationSAP ERP -> commercetoolsCHRMAS, CLFMAS, and CLSMAS IDocs -> Product Type, Product Attribute, and Product VariantAsynchronous: batch and delta
Price Row and Discount RowSAP ERP -> commercetools(COND_A) IDocs -> Embedded or Standalone PricesAsynchronous: batch and delta
B2C Customercommercetools -> SAP ERPCustomer -> Customer profiles and transaction historiesAsynchronous
B2B CustomerSAP ERP -> commercetoolsB2B Customer and B2B Units -> Business Units and AssociatesAsynchronous: batch and delta
B2B Customercommercetools -> SAP ERPAssociates -> AccountsAsynchronous
Stock LevelsSAP ERP -> commercetoolsLOISTD IDOCs -> InventoryAsynchronous: batch and delta
Orderscommercetools -> SAP ERPOrders -> Sales OrdersAsynchronous
InvoiceSAP ERP -> commercetoolsInvoice IDOCs -> OrderAsynchronous

The provided data exchange framework between SAP ERP and commercetools covers key elements of commerce operations like product information, pricing, customer data, inventory, and order management. This integration ensures that both systems are synchronized, maintaining data consistency, and streamlining business processes across the B2C and B2B spectrum. The asynchronous nature of these integrations, often incorporating both batch and delta methods, ensures timely and efficient data transfer and synchronization between the two systems.

Integration architecture using middleware

SAP ERP data flow diagram

Inbound data flow

The inbound portion of the architecture diagram highlights the inbound data replication flow from SAP S4/HANA or SAP ERP to commercetools, using SAP Cloud Integration. This process is a critical architectural component where SAP CI plays a key role. At this step, the integration and data mapping to the commercetools APIs takes place.

SAP CI has an out-of-the-box capability to extract data from the ERP system. However, to enable replication to the commercetools APIs, specific integration flows need to be established. For instance, for the Inbound Material Replication Integration Flow, you can use the Product Import API from commercetools. This setup allows for creating product data without including price or stock information, which are handled separately.

Inbound data replication scenarios

The inbound integration from SAP systems to commercetools using SAP CI requires additional cloud services to push data synchronously and asynchronously from SAP CI to commercetools. These processes include:

  • Customer replication (B2C/B2B): use API Extensions to ensure that the successful response from SAP CI is relayed to the frontend.
  • Order creation and replication: use Subscriptions and a queue with underlying services. The aim is to efficiently push the order payload into SAP CI.

Outbound data flow

The outbound portion of the architecture diagram illustrates the outbound data replication scenarios from commercetools to SAP S4/HANA or SAP ERP, using SAP CI.

Outbound data replication scenarios

Invoice replication (B2B): this step extracts invoice data from SAP ERP and transfers it to commercetools, with the integration layer receiving the data in a byte array format and storing it as a Custom Field in commercetools. Additionally, to make the invoice accessible from both the Buyer portal and the Merchant Center, the integration layer generates a PDF document of the invoice, saves it at a location accessible via URL, such as a CDN or a file storage service. This URL can then be referenced as a Custom Field on the corresponding Order.

Integration best practices

To ensure a seamless flow of data and maintain the highest standards of security and reliability, prioritize the following aspects:

  • Accurate data mapping and transformation: ensure that the data remains consistent and compatible across both systems, preserving its integrity and relevance.

  • Authentication and security: secure data transmission is key. Implementing reliable authentication mechanisms safeguards data during transfer. Additionally, adherence to the security best practices of both commercetools and SAP ERP is crucial for maintaining data confidentiality.

  • Error handling and logging: develop strong error-handling protocols to manage any discrepancies or failures that might occur during the integration process. Coupled with comprehensive logging, these measures provide valuable insights for troubleshooting and enable continuous monitoring of the system's performance.

Cloud-based integration options

An alternative option to middleware solutions like SAP CI, MuleSoft, and Boomi, is building the integration with cloud services offered by AWS, Google Cloud, or Azure. For this approach, we recommend the following:

This alternative cloud-based integration approach offers flexibility and scalability, providing a robust solution for linking SAP ERP systems with commercetools without relying on traditional middleware platforms.

Build an integration on Connect

Cloud-based integrations can also use Connect, for running the building blocks of the integration, such as API Extensions, jobs, and event listeners. With Connect, you do not need to deploy the integration components directly on AWS, GCP, or Azure. Connect takes care of the build, deployment, and hosting of the application or service. Developers can focus on the integration logic, data mapping, and business processes without the need to provision infrastructure and maintain CI/CD processes.

Let's explore how Connect can help in cloud-based ERP integrations through an example of an order replication service. Once an Order is created in commercetools with its order workflow status set, an OrderCreated Message is sent to a designated event listener.

Without Connect, developers would have to provision this event listener, for example, setting up a new topic in GCP, creating a subscription to the topic, and then a Cloud Function that is triggered by the subscription. In addition, developers would have to configure a Subscription resource in commercetools.

With Connect, on the other hand, developers can make use of the event type Connectors. By specifying the queue name and its properties, Connect can handle getting all the components set up. Developers can then focus on handling event logic and data mapping.

Overall, Connect can help reduce the operational overhead and risk of building, hosting, and maintaining integrations between Composable Commerce and the ERP.