Integrate ERP
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.
Choosing 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 type | Data flow for replicating data | Data mapping details | Integration method |
---|---|---|---|
Products and Material | SAP ERP -> commercetools | MATMAS IDOCs -> Product and Product Variant | Asynchronous: batch and delta |
Product Classification | SAP ERP -> commercetools | CHRMAS, CLFMAS, and CLSMAS IDocs -> Product Type, Product Attribute, and Product Variant | Asynchronous: batch and delta |
Price Row and Discount Row | SAP ERP -> commercetools | (COND_A) IDocs -> Embedded or Standalone Prices | Asynchronous: batch and delta |
B2C Customer | commercetools -> SAP ERP | Customer -> Customer profiles and transaction histories | Asynchronous |
B2B Customer | SAP ERP -> commercetools | B2B Customer and B2B Units -> Business Units and Associates | Asynchronous: batch and delta |
B2B Customer | commercetools -> SAP ERP | Associates -> Accounts | Asynchronous |
Stock Levels | SAP ERP -> commercetools | LOISTD IDOCs -> Inventory | Asynchronous: batch and delta |
Orders | commercetools -> SAP ERP | Orders -> Sales Orders | Asynchronous |
Invoice | SAP ERP -> commercetools | Invoice IDOCs -> Order | Asynchronous |
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
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:
- Use SAP Gateway for data accessibility: SAP Gateway provides access to SAP data through APIs using the OData protocol. OData, an Open Data Protocol, adheres to OASIS standards and is ISO/IEC approved. Running data over HTTPS ensures secure internet connectivity and supports hybrid, multi-cloud environments with scalability for varying data volumes. SAP Gateway offers extensive options for extracting SAP data, moving beyond traditional protocols like RFC or IDOC.
- Expose SAP data endpoints over APIs: specific versions of SAP ERP and SAP S/4HANA expose various data endpoints and services over APIs through the SAP Gateway using the OData protocol. This setup enables data extraction, such as product information, from SAP systems to cloud-based services or storage solutions like Amazon S3 or Azure Data Lake Storage.
- Integrate with cloud provider services: cloud providers offer built-in services that support the OData protocol, simplifying communication with the SAP backend. This includes importing OData metadata for streamlined API and schema creation. Within the cloud provider's environment, OData APIs are mapped to the provider-specific API layer (like Azure API Management or Amazon API Gateway), which then manages communication with the SAP backend. This layer also addresses critical aspects such as authentication, authorization, and security.
- Transform and integrate data into commercetools: post-extraction, the data must be transformed from the OData XML format to the JSON format used by commercetools APIs. This transformation can be accomplished using various libraries and cloud functions like AWS Lambdas or GCP Cloud Functions. The transformed data is then integrated into commercetools Composable Commerce using APIs, such as the Import API. This logical layer also handles errors, retries, and timeouts during the integration process.
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.
Building an integration on Connect
Cloud-based integrations can also use commercetools Connect, for running the building blocks of the integration, such as API Extensions, jobs, and event listeners. With commercetools 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 specifing 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, commercetools Connect can help reduce the operational overhead and risk of building, hosting, and maintaining integrations between Composable Commerce and the ERP.