StockControl & SAP Synchronization
Description
Technologies used
- Docker
- Google Cloud Run
- MySQL
- Python
- SAP Business One API
Responsibilities
- Product owner
- Backend developer
This project involved the implementation of StockControl, a comprehensive Warehouse Management System (WMS), and its deep integration with SAP. The primary goal was to create a parallel operational environment where warehouse activities are managed through specialized data collectors while automatically informing SAP of the results in real-time. Core Capabilities The synchronization program manages the flow of critical logistics data, ensuring that the ERP (SAP) remains the "source of truth" while the WMS handles the granular warehouse logic.
Achievements
- Import-export data following bussiness logic.
- Cloud-Native Deployment: Optimized to run on Google Cloud Run (GCR) with a minimal resource footprint.
Learned
- Intricacies of SAP-driven Units of Measure (UoM). Managing a master item list of over 30,000 records required a deep understanding of how SAP determines counting units and how to map DUN codes (Distribution Unit Numbers) for accurate reading on Android data collectors. I learned to ensure that while the WMS handles the physical scanning, it remains secondary to SAP's established unit definitions for inventory counts.
- Implement complex "Future Reserve" conversion logic. Developed specialized algorithms to convert "Future Reserves" into actionable picking orders based on specific logistics rules, such as triggering shipments only when a branch falls below a 15-day stock minimum. This involved mastering calculations for 100% item replacements and enforcing maximum transfer limits per branch to ensure fair stock distribution.
- Operational benefits of decoupling reception from Quality Control (QC). By implementing a system that generates unique "Packages to control" labels, I learned how to allow warehouse staff to postpone QC without halting the physical receipt of goods. This required creating logic to categorize merchandise into three distinct states—Accepted, Rejected, or Excess (Demasía)—where rejected or excess items are automatically blocked and moved to reserved areas.
- Managing High-frequency data synchronization for inventory audits. To maintain real-time accuracy, I implemented a 2-minute synchronization cycle for open inventory count originating in SAP. I gained experience in reconciling "blind audits" performed on mobile collectors with SAP’s records, ensuring that every finished count is exported back to SAP to settle inventory differences.
- Architect a robust bidirectional integration using the SAP Business One API: I gained deep technical experience in the determination of endpoints and data models required to bridge the WMS with SAP, ensuring the seamless import of parametric data and the export of operational results like receptions and distributions. I learned to manage high-frequency, automated 2-minute synchronization cycles for critical tasks such as inventory audits while implementing a sophisticated status-tracking system (e.g., pending_fill, processed, and pending_reprocess) to handle data integrity and error recovery. Furthermore, I learned to interface with specific SAP structures, such as the OALI table, to pull item replacement data directly into the synchronization logic.
Main automated processes
- Automated Data Import (SAP → StockControl):
- Master Data: Items (over 30,000 records), categories, customers, and addresses.
- Logistics Infrastructure: Warehouses and specific storage areas.
- Operational Documents: Purchase orders, sales orders, and replenishment orders.
- Real-Time Data Export (StockControl → SAP):
- Reception Results: Confirmation of received purchase orders.
- Distribution: Successful sales order fulfillment.
- Inventory Accuracy: Inventory counts and replenishment completions.
Key Features
- Advanced Quality Control (QC): The system decouples reception from quality checks. Upon receiving goods, unique "Packages to control" labels are generated, allowing QC to be performed later via PC or Android data collectors. The system classifies goods into three states: Accepted (clears the PO), Rejected (blocked / reserved), or Excess (quantities exceeding the PO or unrecognized items).
- Intelligent Reservation Conversion. I implemented custom logic to convert "Future Reserves" into actual picking orders based on specific business rules:
- Sales Calculations: Automating shipments when the stock falls below a 15-day minimum.
- Replacement Logic: Handling 100% item replacements for missing stock.
- Stock Constraints: Managing maximum transfer limits per branch to ensure fair distribution across the network.
- Integrated Inventory Auditing The sync program supports blind audits that can originate either in SAP or directly within StockControl.
- SAP-Origin: Open inventory counts are synced every 2 minutes to the WMS.
- StockControl-Origin: Local audits are mapped to specific warehouses and exported back to SAP as finished inventory counts.
Screenshots
Quality Control
graph TB
PO_1([PO #1])
PO_2([PO #2])
PO_N([PO #3])
RECEPTION[<b>Reception</b></br>Groups all the products belonging to the PO]
QC_PACKAGES[<b>Processing packages</b> </br>No distinction between POs]
QC_PACKAGE_1[<b>Processing package</b> </br>Merchandise pending QC]
EVAL_QUALITY{<b>Check</b></br>Quality Control}
ACCEPTED[<b>Accepted</b></br>Exist in PO and has pending quantity]
REJECTED[<b>Rejected</b></br>Failed QC</br>Damaged</br>Due</br>etc.]
OVER_QTY[<b>Excess</b></br>Above required quantity </br> Does not belong to a PO </br> Unknown SKU]
RESERVATION_BLOCK[<b>Create reserve</b></br>Block products</br>Not available]
AVAILABLE[<b>Available</b></br>Products placed on stock]
NOT_AVAILABLE[<b>NOT Available</b></br>Blocked products are kept in stock but not available for distribution]
WAREHOUSE_STOCK[<b>Place products in the warehouse</b></br>Products are placed into the warehouse]
OVER_QTY_ALERT[<b>Raise an alert</b></br>Manager receives alert</br>Run additional processes]
REJECTED_ALERT[<b>Raise an alert</b></br>Manager receives alert</br>Run additional processes]
PO_1 --> RECEPTION
PO_2 --> RECEPTION
PO_N --> RECEPTION
RECEPTION --> QC_PACKAGES
QC_PACKAGES --> QC_PACKAGE_1
QC_PACKAGE_1 --> EVAL_QUALITY
EVAL_QUALITY --> ACCEPTED
EVAL_QUALITY --> REJECTED
EVAL_QUALITY --> OVER_QTY
ACCEPTED --> AVAILABLE
AVAILABLE --> WAREHOUSE_STOCK
REJECTED --> RESERVATION_BLOCK
REJECTED --> REJECTED_ALERT
OVER_QTY --> RESERVATION_BLOCK
OVER_QTY --> OVER_QTY_ALERT
RESERVATION_BLOCK --> NOT_AVAILABLE
NOT_AVAILABLE --> WAREHOUSE_STOCK
The three possible states for merchandise during this quality control stage are:
Accepted
This merchandise meets the required standards and settles the content of the related Purchase Orders (POs). Once accepted, the items are moved to a "Ready to stow" area and become available in the warehouse stock.
Rejected
This status is applied to goods that fail quality control due to being damaged, expired, or other issues. This merchandise does not settle the PO, is not placed in general availability, and is instead moved to a special reserved area.
Excess
This state is triggered by three specific scenarios:
- The merchandise is included in a PO, but the quantity exceeds what was requested.
- The merchandise is not found in the related POs.
- The item's definitions or barcodes are not registered in SAP. Like rejected items, excess merchandise is reserved and placed in a special designated area.
Both the Rejected and Excess states trigger alerts to the person in charge to initiate additional processing.



