Do you use still SAP transactions? Talk with your SAP system! AI can do the same things like you but faster and smarter!
What the agent does:
This Python application combines cutting-edge AI frameworks with battle-tested SAP automation:
Tech Stack:
├── 🖥️ pywin32 (COM automation for SAP GUI)
├── 📊 openpyxl (Excel generation)
├── 📚 sap_scripting.py (reusable SAP GUI API sap_gui_scripting_api.pdf )
└── 📝 CLAUDE.md (living project documentation)Capability Description
| Live SAP GUI Connection | ROT-based COM access to running sessions |
| Intelligent Navigation | Transaction execution, screen exploration, button discovery |
| Complex Grid Parsing | Tree controls, ALV grids, splitter shells, dynamic content |
| Error Analysis | Message classification, severity scoring, root cause mapping |
| Excel Automation | Structured remediation plans with SAP transaction references |
| Conversational Interface | Natural language → structured SAP operations |
Context: Migration project has 14,000+ posting simulation errors
# Message Count Severity Solution
| 1 | NR 751 - Number range interval missing | 9999+ | 🔴HIGH | FBN1/SNRO → Maintain number ranges in target |
| 2 | CNV_PE 451 - TRule error | 2,328 | 🔴HIGH | CNV_PE_CUSTOM → Read Customizing + Regenerate TRules |
| 3 | CNV_OT_CX 000 - Generic exception | 1,746 | 🔴HIGH | ST22/SM21 → Check dumps/system log for root cause |
Message Count Severity Root Cause SAP Transaction
| NR 751 | 9999+ | HIGH | Number range gap | FBN1/SNRO |
| CNV_PE 451 | 2,328 | HIGH | TRule customization | CNV_PE_CUSTOM |
| CNV_OT_CX 000 | 1,746 | HIGH | System exception | ST22/SM21 |
| F5A 002 | 86 | MEDIUM | Vendor deletion flag | XK02/FK02 |
| CNV_PE 589 | 54 | MEDIUM | WL2MOD exit error | Debug ABAP exit |
| CNV_PE 205 | 51 | MEDIUM | Reference doc missing | Post ref docs first |
| F5 351 | 17 | MEDIUM | Account blocked | FS00/FK02 |
| F5A 003 | 14 | MEDIUM | G/L deletion flag | FS00 |
| F5 026 | 10 | LOW | Missing bank details | FK02 |
| /SLO/PECON 102 | 5 | LOW | WHT data missing | FK02 |
┌─────────────────────────────────────────────────────────────────┐
│ User: Natural Language Request │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 1. COM Connection → session.Info → System validation │
│ 2. /SLO/PECON → Error Monitor (ERR_OV) → F8 Execute │
│ 3. Tree Control parsing → MSGNO/MSGCNT_RCV/MSGTEXT extraction │
│ 4. LLM Reasoning → Severity classification + solution mapping │
│ 5. openpyxl → Structured Excel with 2 sheets │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Output: PE_Error_Analysis_ZFI_SDT.xlsx │
└─────────────────────────────────────────────────────────────────┘import win32com.client
# Connect to RUNNING SAP session (never launch from script)
SapGuiAuto = win32com.client.GetObject("SAPGUI")
application = SapGuiAuto.GetScriptingEngine
connection = application.Children(0) # first connection
session = connection.Children(0) # first session
# Validate connection
print(f"System: {session.Info.SystemName}")
print(f"Client: {session.Info.Client}")
print(f"User: {session.Info.User}")Traditional Approach AI Agent Approach
| Manual Error Monitor → Export → Excel → Manual analysis → 4+ hours | "Check errors and create Excel" → ✅Done in 2 minutes |
| Static SQL queries → Miss dynamic tree data | Live GUI parsing → Always current |
| Generic error lists | Severity-ranked remediation with exact transactions |
| Consultant dependency | Self-service analysis for any team member |
Here's the actual conversation flow with Claude Code that produced this solution:
User: "List SAP connections"
Agent: → Found 2 connections
User: "Test System"
Agent: → Connected to system
User: "Open /SLO/PECON"
Agent: → Transaction opened, PECON Start screen displayed
User: "Go into Error Monitor, check messages, create Excel with solutions"
Agent: → Clicked ERR_OV → F8 Execute → Parsed tree (16 nodes)
→ Generated PE_Error_Analysis.xlsx with 10 errors + solutionsTotal time: ~2 minutes. Zero manual SAP navigation.
sapgui/user_scripting = TRUEsap_gui_scripting_ai/ ├── 📚 sap_scripting.py #SAP GUI Scripting Framework Generic Python wrapper#├── 📝 CLAUDE.md # Living documentation (auto-updated) ├── 📊 PE_Error_Analysis.xlsx # Generated output └── 📁 posting_engine_knowledge/ # SAP docs + extracted knowledge ├── PECON_User_Guide_v2.1.pdf ├── PECON_FAQ_v1.5.pdf └── PE_Enablement_2025_10.pdf
Q: Does this replace SAP GUI scripting consultants? A: It augments them. The agent handles 80% of repetitive analysis; consultants focus on exceptions.
Q: Is this safe for Production SAP? A: Read-only analysis mode. No postings, no data changes. Uses your existing session permissions.
Q: What SAP systems are supported? A: Any SAP GUI system with scripting enabled — ECC, S/4HANA, any client. Multi-system aware.
Q: Can it handle custom Z-transactions? A: Yes! Recursive screen exploration + visual debugging discovers any SAP screen pattern.
Q: What LLM powers the agent? A: Currently using Claude (Anthropic) via LangChain, but architecture supports OpenAI, Azure, or local models.
👍Like this post if you want Part 1 next week!
Share your SAP challenges in the comments below — which analysis blocks you most often?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 36 | |
| 28 | |
| 27 | |
| 26 | |
| 26 | |
| 26 | |
| 25 | |
| 24 | |
| 23 | |
| 23 |