SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Optimize Cable Roll Selection for Work Orders with a Custom Joule Agent

Overview

🎓 beginner ⏱ 30 min. Joule StudioJouleJoule WorkBeginner

You will learn

  • ✔How to identify a manufacturing workflow with a clear optimisation objective suitable for agent automation
  • ✔How to write an effective intent statement for a constraint-based optimisation agent
  • ✔How to review and validate the assets created, including the generated Product Requirements Document (PRD)
  • ✔How to deploy a production-ready Joule Agent to the SAP managed service
Ilya Belozerov I Ilya Belozerov October 1, 2026
Created on October 1, 2026
Contributors

More from Ilya Belozerov

See all 3 tutorials by Ilya Belozerov →

Prerequisites

  • Access to Joule Studio
  • Access to an SAP S/4HANA Cloud system with:
    • Production Orders (PP module) containing cable material requirements
    • Batch stock management across multiple storage locations (MM/WM module)
    • Stock Transfer Order creation enabled (MM module)

Steps

Intro

IMPORTANT

Welcome to the Agent lab

You are working with a pre-release version of the Joule Studio. This gives you an early look at our upcoming capabilities. Please keep the following in mind:

  • Features are subject to change: The UI, terminology, and functionality you see may differ from the final product.
  • Educational use only: This environment is designed for learning and experimentation, not for production use.
  • Potential instability: As a preview version, you may encounter occasional instability or unexpected behavior.

Cable is one of the most common sources of avoidable material waste in manufacturing. When a production work order specifies a required cable length, the operative must select a roll from available stock. The wrong choice - picking a roll that is significantly longer than needed - leaves an offcut that may be too short to reuse and is written off as scrap. Multiply that decision across hundreds of work orders per week, across multiple production lines and warehouse locations, and the cumulative waste becomes a measurable cost.

In this tutorial, you build a Cable Roll Optimizer Agent using Joule Studio. The agent reads work order cable requirements from SAP S/4HANA, checks available batch stock across all storage locations, applies a deterministic optimisation engine to identify the roll or combination of rolls that minimises offcut waste, and - where local stock is insufficient - recommends raising a stock transfer order (STO) to bring the right roll from another location. All recommendations require human approval before any SAP data is modified.

You’ll follow the full Joule Studio development process - from a plain-language intent statement to a deployed Python agent integrated with SAP S/4HANA via dedicated MCP servers.

About the scenario: The cable types, roll lengths, and location names used in this tutorial are illustrative. The agent pattern applies to any manufacturing context where a continuous material (cable, pipe, tubing, sheet, wire, fabric) is consumed by length or area from batch-managed stock rolls or coils held across multiple locations.

Why is this a strong automation candidate? The optimisation logic is deterministic (minimise offcut = minimise roll_length minus required_length), the data sources are known (work order requirements + batch stock), the trigger is predictable (work order release), and the output is well-defined (roll selection + optional STO). Deterministic optimisation problems with known inputs and outputs are among the highest-value use cases for Joule Studio agents.

Step 1 Understand the Business Challenge
—

Before building the agent, it is important to understand the problem it solves. This step describes the three stock fulfillment scenarios the agent handles and the manual pain points it eliminates.

Three cable fulfillment scenarios

When a work order is released, the production planner or warehouse operative must fulfil the cable requirement from available stock. Three distinct scenarios arise:

ScenarioDescriptionChallenge
Single-roll local fulfillmentOne roll at the work order’s home location is sufficient for the required length.Selecting the roll with the minimum offcut from potentially many available rolls of varying lengths requires manual comparison - and is often skipped in favour of the first available roll.
Multi-roll local fulfillmentNo single roll covers the required length; two or more rolls from the local location must be combined.Identifying the combination of rolls that covers the requirement with the least total offcut is a combinatorial problem that cannot be solved reliably by manual inspection.
Cross-location fulfillmentLocal stock is insufficient in length or quantity. Suitable rolls exist at one or more other storage locations.The planner has no consolidated view of roll availability across locations. Stock transfer orders are raised reactively and often for the wrong quantity, generating further waste at the source location.

Current pain points

The manual handling of cable roll selection creates the following operational challenges:

  • No consolidated stock view - Roll availability, batch numbers, and remaining lengths are visible per location but not aggregated across the network. Planners must check each location separately.
  • Suboptimal roll selection - Without a systematic comparison, operatives select rolls based on proximity or habit rather than fit, generating avoidable offcut waste on every work order.
  • Untracked offcut accumulation - Offcuts below a reusable threshold are not systematically identified at selection time, making waste invisible until a physical stock count.
  • Reactive stock transfers - Cross-location replenishment is initiated only after local stock is exhausted, causing production delays and last-minute logistics pressure.
  • No audit link between selection and waste - There is no record connecting the roll selection decision to the resulting offcut, making it impossible to measure or improve selection quality over time.

The agent addresses all five pain points. It aggregates batch stock across all locations in a single query, applies a deterministic optimisation engine to every work order, surfaces the best roll selection with a quantified offcut estimate, and - where a stock transfer is needed - generates a ready-to-approve STO recommendation linked directly to the work order.

Step 2 Open Joule Studio and Define the Agent Intent
+
Step 3 Review the Intent
+
Step 4 Product Requirements Document
+
Step 5 Inspect the Generated Specification
+
Step 6 Generate the Solution
+
Step 7 Validate the Agent with Automated Tests
+
Step 8 Deploy the Agent to Development Landscape
+
Step 9 Summary
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Understand the Business Challenge 2. Open Joule Studio and Define the Agent Intent 3. Review the Intent 4. Product Requirements Document 5. Inspect the Generated Specification 6. Generate the Solution 7. Validate the Agent with Automated Tests 8. Deploy the Agent to Development Landscape 9. Summary