SAP + Drupal Commerce integration - banner.png
8 minutes

Drupal Commerce + SAP Integration: Solutions and Benefits

If you’ve been looking for a viable solution to extend the functionality of your Drupal Commerce platform, we have one. In this article, our Drupal Team Lead, Mykhailo Hurei, provides a comprehensive overview of SAP integration with Drupal Commerce. Keep reading to learn how we integrated the Drupal Commerce platform with SAP for one of our clients and find out what custom features we added. 

Learn about Drupal Commerce - Article CTA - Lemberg Solutions - 5.png

What is SAP integration?

SAP (System Analysis Program Development) is a widely-used software that helps businesses of any size optimize their activities. SAP provides ERP solutions enabling automated operations management across versatile industries. You can improve your internal processes, like customer relations and data processing operations, via ERP.

Why is SAP integration important?

SAP integration solutions help businesses manage customer relations and data processing operations using ERP software products. Versatile SAP integration modules are designed to address specific business objectives from sales to finance operations. SAP system integration is suitable for any type and size of the enterprise.

SAP integrations take data from a source application, and make it readable and functional for SAP. SAP integration solution is a common request from organizations, as it is widely used for enterprise resource planning.

SAP Integration with Drupal

SAP integration with a Drupal Commerce platform holds multiple opportunities for ecommerce business owners. While Drupal has many ready-to-go integrations with ERP systems (you can find them at, there are few integrations for SAP. 

Each online shop has its unique structure, specific requirements, and features. Thus, it’s impossible to create a universal SAP system integration solution for all Drupal Commerce-based businesses, and each project on Drupal requires custom integration with SAP. 

Client case review: 5 SAP integration solutions

One of our clients has several webshops, some already integrated with SAP. Shops with SAP integration use CMS as a front-end, making them easy to manage. Other shops of our client still use outdated systems that are hard to manage and require a lot of manual work. 

Also, shops based on outdated platforms are hard to integrate with SAP, which means all products and orders are managed manually in SAP and on the front-end. To improve and automate processes, our client decided to migrate their shops from the old system to Drupal Commerce and integrate it with SAP. 

Here are the solutions the client asked us to implement:

  • Automatic product synchronization
  • Dynamic stock check-up 
  • Transfer orders to SAP with all necessary customer data
  • Validate customers’ addresses
  • Show available payment methods based on address validation.

First, we performed the discovery phase and analyzed the SAP system features. We also checked existing shops that incorporated SAP integrations. This way, we learned about all up-to-date improvements and fixes on the SAP side. 

We used REST-based OData services for communication with SAP instances. SAP gateway uses OData for SAP products, which contains SAP-specific metadata helping the developer to consume SAP business data. The latter includes descriptions of fields that can be retrieved from the SAP ABAP Dictionary.

Below, you can see the architecture we built for our customer’s shop:

SAP + Drupal Commerce integration (architecture)

The client already had PHP libraries that implemented OData services. During the development, we also updated this library and added support for PHP 8. It helped us build unified objects with similar structures in all systems. 

We introduced the following custom features to the client’s webshop using the SAP integration suite:

  1. Product Import
  2. Stock list
  3. Order transfer
  4. Blacklist import
  5. Address check.

1. Product Import

Product imports have different parameters, enabling to fetch a complete product list or receive updates since the last import case. For automation of product import, we added a new Drush (Drupal Shell) command and configured a cron on the server to ensure it runs simultaneously. We also added a custom Drupal service that implements the above functionality.  

Cron triggers the Drush command that retrieves only updated SAP products. Our client’s system comprises around 2000 products, which undergo dozens of daily updates. We performed a complete product import before the release. 

However, you won’t have to retrieve some product fields from SAP. We import titles, SKUs, and product prices from SAP, while product descriptions, images, and categories are managed on the Drupal side. Fields collected from SAP can’t be changed from Drupal. 

Product status is also controlled by SAP. Besides, there are some additional rules for product publication status. In particular, SAP products have start and end publication dates. Products with invalid dates must be unpublished and restored when the start date is active. We’ve added a Drush command that checks all products' dates and, based on this information, publishes or unpublished them.

2. Stock list

Another functionality we integrated into the customer’s ecommerce store was product stock. Since we had to enable the real-time stock status feature, we implemented a dynamic status checker. Our team added a new stock service that retrieves stock data from SAP each time the Drupal Commerce system checks it. This functionality was necessary, as the described platform isn’t a single platform where our client sells products. Hence, ensuring the system provides relevant product availability information was crucial. Apart from the stock information, we also display shipping details and approximate delivery/availability time.

We also added some SAP fields used exclusively on the backend to Drupal products (only website administrators can view these fields). This functionality helped us check whether the information collected from the SAP system was correct. The product status in Drupal is set based on the rules related to start/end dates and publication status in SAP.

All fields used on the backend can be checked on the product edit form. It helps with troubleshooting issues both on the Drupal and SAP sides. Within extra fields, we added the last import date. We also enabled website administrators to manually synchronize individual products. Administrators can import the changes manually when some products are updated in SAP, and the client needs them to be instantly displayed on the Drupal side.

3. Order transfer

Manual payment methods used in SAP were not configured for automated processing. Thus, we had to adjust them. So we fixed the SAP scripts to set up order transfer from Drupal to SAP. 

On the Drupal side, the client had four payment methods. For each of them, we filled in specific data sent to SAP. One of the payment methods was Saferpay, which had a ready-to-go Commerce Saferpay module. To use this module properly, we introduced some customizations the client’s shop required.

Saferpay is an offsite payment method, so the payments are carried out through the queue worker. Additionally, the customer’s system performs extra requests before transferring the order with payment to SAP. After an order is successfully transferred to SAP, the client receives an order ID on the Drupal side. This way, administrators can find connected Drupal and SAP orders.

SAP + Drupal integration - connected Drupal and SAP orders - Lemberg Solutions

4. Blacklist import

The SAP system has a blacklist of customer addresses blocked from placing orders. As there was no OData service to validate addresses, we introduced a service that retrieved all addresses from the blacklist. We decided to store all addresses on our side and update the list regularly. 

As a result, we added a new custom content entity type BlackListAddress to store addresses from SAP in Drupal using this entity type. We also created a new Drush command that makes requests to SAP and withdraws addresses. It checks for new addresses and adds them to the list. We also added a new condition plugin for payment validation, implemented similarly to our module Commerce Tax Conditions.

5. Address check

We added the address check functionality to make sure each user only sees payment methods available for them. Besides BlackList validation, we also enabled an OData service that checks customers’ ranks based on their addresses. The customer’s system now displays different payment methods based on the rank value of each customer.

Final thoughts 

Building SAP integrations with Drupal Commerce and other systems requires a considerable investigation and specification of the features to be added to the website. Based on our experience, most of these features are specific to the project and require custom Drupal development services. 

In the described project, the discovery phase helped us structure clear goals and detailed requirements. Our client plans to transfer all of his online shops to Drupal, and we already have a base of features implemented in Drupal that can be reused, including OData client service and payments.  

Drop us a line if you want to extend the features of your Drupal Commerce website. We’ll get back to you shortly with all the answers concerning the most suitable SAP integration options.

Frequently Asked Questions on SAP Integration

  • How does SAP integration work?

SAP is a source software that helps other systems extend their functionalities. SAP integration can be performed using Intermediate Documents (IDOCS) or Business Application Programming Interface (BAPI). Many enterprises worldwide use it for resource planning and extension of custom functionalities.

  • What are some of the capabilities of the SAP integration suite?

The capabilities of the SAP integration suite include the following:

- Business process automation

- Improvement of regulatory compliance

- Ecommerce development

- Enhancing the API economy

- Delivering customer insight

- Connecting B2B partners

- Building a reliable IT landscape. 

  • What are SAP data integration tools?

SAP data integration tools enable the proper incorporation of SAP into your system. These tools help transfer information to and from the SAP system. Besides, SAP data integration tools help to map, filter, and consolidate your data. SAP data integration tools include APIs, Data Intelligence solutions, cloud connectors, etc. 

  • What does an SAP integration architect do?

An SAP integration architect is responsible for implementing SAP solutions with other systems. Among the responsibilities of an SAP integration architect are mapping corporate processes, choosing integration technologies and tools, and building integration architecture.

Let's discuss your Drupal project - Article CTA - Lemberg Solutions - 3.png
Article Contents: