Back to projects
WorkJune 2026

Enterprise ERP Macros & AI Automation Engine

A two-pronged optimization initiative encompassing a massive suite of manually built SAP GUI automation scripts alongside a custom AI engine that generates new macros from natural language.

SAP ERPAnthropic Claude APIPythonVBAGUI ScriptingProcess AutomationGenerative AI

Background

Navigating SAP ERP is a notoriously manual, click-heavy, and fragmented experience for operational teams. In supply chain and production planning, processing simple tasks often requires jumping through a dozen different screens, causing major inefficiencies.

To combat this, my work focused on an intensive, two-pronged approach. First, I manually built out a comprehensive library of custom VBA macro projects to automate our most critical, high-volume transactional workflows. Second, recognizing that writing unique code for hundreds of distinct operational edge cases creates a development bottleneck, I built a next-generation Python tool powered by the Anthropic Claude API to automatically generate these complex scripts on demand.

How It Works

  • Manual Script Architecture: Over a series of projects, I mapped and built complex, multi-transaction SAP GUI automation scripts. These macros navigate across numerous critical operational layers seamlessly in a single execution path. Core T-codes automated include:
    • COOISPI (Process Order Information) to track manufacturing batches.
    • SE16N (General Table Display) to audit raw backend tables directly.
    • PPL1 (Production Planning / Scheduling logs) to monitor timeline compliance.
    • MDVP (Collective Availability Check) to verify component inventory.
    • ...alongside dozens of other core material management and logistics views.
  • The AI Meta-Automation Engine: To scale macro development beyond my manual output, I built a custom Python-based tool wrapped around the Anthropic Claude LLM.
  • Natural Language Code Generation: A user describes their desired multi-transaction SAP workflow in plain, everyday language. The tool automatically analyzes the business logic and outputs syntactically flawless, context-aware VBA macro code designed specifically for SAP's scripting interface.

Challenges

The biggest hurdle across both manual creation and AI generation is the incredibly rigid and unforgiving nature of the SAP GUI scripting object model. SAP relies entirely on absolute session IDs and hyper-specific UI element window paths (such as wnd[0]/usr/btn[4]).

If a user opens an extra window, changes their local display language, or alters their workspace layout, the script paths break immediately. For my manual macros, this required building highly resilient error-trapping and dynamic window scanning. For the AI generator, I had to engineer strict structural validation logic in Python that forces the LLM to adhere to precise syntax wrappers, ensuring the generated code handles these volatile layout paths safely.

What I Learned

This initiative provided a masterclass in enterprise architecture, moving from traditional scripting to intelligent, software-driven code generation. I gained a deep understanding of legacy ERP data flows and learned how to constrain generative AI outputs to meet incredibly precise technical guidelines.

The dual impact of delivering a mature suite of pre-built operational macros alongside a tool that allows teams to spin up their own scripts on the fly completely transformed our workflow velocity, turning hours of tedious manual data entry into single-click background operations.