CASE STUDY

Heineken (Pivovarna Laško Union)

Shopify order integration into SAP for two retail stores.

Snapshot

  • Industry: FMCG / Beverages / E-commerce
  • Client: Pivovarna Laško Union d.o.o. (Heineken group)
  • Deliverable: Integration service syncing Shopify orders into SAP
  • Role: System architecture, backend implementation, SAP integration logic
  • Integration points: Shopify Admin API (orders/products/inventory), SAP order messaging, HTTP Basic Auth
  • Status: Production integration

Context

The client operates two Shopify stores (rundasekunda.si and union-experience.si) while all order processing happens in SAP. Manual re-entry created delays and avoidable errors. The goal was a deterministic, SAP-ready order pipeline that removes manual steps.

Problem

  • Orders were not available in SAP immediately, slowing fulfillment.
  • Manual copy-paste introduced errors in customer and line-item data.
  • Operations spent time on administrative tasks instead of execution.

The integration needed to be deterministic, SAP-compatible, and robust against Shopify data variations.

Project Goals

  • Pull orders from two Shopify stores and map them into SAP-compatible order messages.
  • Include full line items, pricing, taxes, and customer data.
  • Handle address edge-cases and VAT identifiers reliably.
  • Support order confirmation and payment state transitions.
  • Provide product and inventory sync endpoints when required.

Constraints & Challenges

  • SAP requires strict message structure and qualifier handling.
  • Shopify data is flexible and varies per order (billing vs shipping, optional address fields).
  • Payment gateways influence SAP payment terms and must be mapped correctly.
  • Refunds and partial refunds must be reflected in line items.

Solution Overview

We implemented a Python/Flask integration service that pulls orders from Shopify, transforms them into SAP-compatible order messages, and exposes endpoints for confirmations and payment state updates.

The result is a deterministic pipeline from two Shopify stores directly into SAP without manual intervention.

Architecture & Technical Approach

Shopify integration

  • Uses the Shopify Admin API (REST + GraphQL) via the official client.
  • Supports two stores through environment-based configuration.
  • Filters orders by payment and fulfillment status.

SAP order message generation

  • Generates SAP-compatible order messages with headers, partner data, and line items.
  • Maps taxes, discounts, and shipping as structured line items.
  • Sets payment terms based on Shopify gateway.

Address and VAT logic

  • Selects billing vs shipping based on country context.
  • Extracts company/VAT identifiers from auxiliary address fields.
  • Normalizes fields to reduce SAP parsing issues.

Operational endpoints

  • Order export endpoint for SAP intake.
  • Confirmation endpoint to close orders in Shopify after SAP ingestion.
  • Payment state endpoints for unpaid/paid transitions.
  • Product and inventory endpoints for optional SAP → Shopify flows.

Technology Stack

  • Python
  • Flask
  • ShopifyAPI (Shopify Admin API client)
  • lxml / objectify (XML generation)
  • HTTP Basic Auth

Implementation Process

  1. Modeled SAP order requirements and aligned them with Shopify data structures.
  2. Implemented order extraction and filtering for both stores.
  3. Built the message generation pipeline with all required segments.
  4. Added address/VAT parsing and payment-term mapping logic.
  5. Implemented operational endpoints for confirmations and payment states.
  6. Added product/inventory endpoints for optional backflows.

Results & Impact

  • Orders flow into SAP automatically without manual re-entry.
  • Reduced operational errors caused by copying order data.
  • Faster order processing and improved fulfillment accuracy.
  • Single integration layer covering both Shopify stores.

Reflection

The core reliability factor was strict adherence to SAP message structure and careful normalization of Shopify data. Shopify orders are flexible; SAP is strict. The integration acts as a deterministic translator between the two.

Summary

This project delivered a production-grade Shopify → SAP integration for Heineken’s Slovenian operations. It eliminates manual order handling, reduces errors, and creates a consistent order flow from two Shopify stores directly into SAP.