### Setup and Dependencies (Bash) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md This bash script outlines the setup process for the example, including installing necessary Python packages. It specifies the command to run from the repository root and lists the external dependencies required for the script to function correctly. ```bash # Run from the SAPKnowledge/ repo root pip install pyyaml # only external dependency python examples/example12.py ``` -------------------------------- ### Setup and Verify MCP Server Python Environment (Bash) Source: https://context7.com/brandedtamarasu-glitch/sapknowledge/llms.txt Installs the necessary Python environment for the MCP server, including creating a virtual environment and installing dependencies from a requirements file. It then verifies the installation by importing a package and provides instructions to test the MCP server manually by running the script directly. This setup should be performed from the root directory of the SAPKnowledge project. ```bash # Setup steps (run from SAPKnowledge directory) python3 -m venv .venv .venv/bin/python -m pip install -r scripts/requirements.txt # Verify installation .venv/bin/python -c "import fastmcp; print('OK')" # Test server manually .venv/bin/python scripts/mcp_server.py # Server starts on stdio — press Ctrl+C to stop ``` -------------------------------- ### Get SAP SPRO Configuration Steps by Topic (Python) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Retrieves SPRO/IMG configuration steps for a specific topic within a given SAP module from the knowledge base. It normalizes the module name and searches the relevant `config-spro.md` file. Handles cases where the module or topic is not found. Requires Python 3.10+ and dependencies installed via `pip install -r scripts/requirements.txt`. ```Python import sys sys.path.insert(0, "scripts") from kb_reader import get_file_body, find_section_by_topic, normalize_module, CONFIG_FILE def get_config_steps(module: str, topic: str) -> str: """Find SPRO/IMG configuration steps for a topic within a module.""" mod = normalize_module(module) if not mod: return f"Module '{module}' not in KB." body, source = get_file_body(CONFIG_FILE, mod) section = find_section_by_topic(body, topic) if not section: return f"No config section matching '{topic}' found in {mod} config-spro.md." return f"{section}\n\nSource: {source}" # Examples print(get_config_steps("MM", "tolerance")) # MM LIV tolerance keys print(get_config_steps("FI", "payment terms")) # FI payment terms config print(get_config_steps("SD", "pricing procedure")) # SD pricing setup print(get_config_steps("CO", "cost center")) # CO cost center config ``` -------------------------------- ### Run Example Script Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Executes the example10.py script from the SAPKnowledge repository root. This script likely demonstrates a specific functionality of the knowledge base reader. ```bash python examples/example10.py ``` -------------------------------- ### Python Examples for SAP T-code Lookup and Process Flow Extraction Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/llms.txt A collection of 17 runnable Python examples demonstrating various SAP interactions. These include T-code lookup, SPRO navigation, process flow extraction, account determination troubleshooting, query routing, fallback strategies, and MCP client usage via fastmcp. ```python from fastmcp import MCP mcp = MCP() # Example: Lookup T-code tcode_info = mcp.lookup_tcode('VA01') print(f"T-code VA01: {tcode_info}") # Example: Get module overview module_overview = mcp.get_module_overview('SD') print(f"SD Module Overview: {module_overview}") # Example: Get process flow process_flow = mcp.get_process_flow('Order-to-Cash') print(f"Order-to-Cash Process Flow: {process_flow}") # Example: Compare ECC 6 and S/4HANA comparison = mcp.compare_ecc_s4('Vendor Master') print(f"ECC 6 vs S/4HANA Vendor Master: {comparison}") # Example: Search by keyword search_results = mcp.search_by_keyword('account determination') print(f"Search Results for 'account determination': {search_results}") ``` -------------------------------- ### Demonstrate Use Case 1: SPRO Coverage Summary Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Demonstrates the first use case by fetching all design patterns with SPRO details and printing a summary table. This showcases how to get a high-level overview of SPRO configuration coverage across all patterns in the system. ```python # ── Use case 1: Summary view across all 12 patterns ────────────────────────── print("=" * 70) print("USE CASE 1 — All 12 patterns: SPRO coverage summary") print("=" * 70) all_patterns = get_design_patterns_with_spro() print_summary_table(all_patterns) ``` -------------------------------- ### Install Dependency Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Installs the PyYAML library, which is the only external dependency required by the SAP knowledge base reader scripts beyond Python's standard library. ```bash pip install pyyaml ``` -------------------------------- ### Demonstrate Use Case 3: Module-Filtered SPRO Paths Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Demonstrates the third use case by fetching a pattern (e.g., 'Make-to-Stock') and filtering its configuration steps to include only specific modules (e.g., 'MM', 'FI'). It then prints a concise view of these filtered steps, indicating SPRO detail availability and source. ```python # ── Use case 3: Module-filtered SPRO paths ──────────────────────────────────── print("\n\n" + "=" * 70) print("USE CASE 3 — Pattern 1 (Make-to-Stock): MM and FI SPRO paths only") print("=" * 70) mts = get_design_patterns_with_spro( pattern_keywords=["Make-to-Stock"], modules_filter=["MM", "FI"], ) for p in mts: mm_fi = [s for s in p["config_steps"] if _base_module(s["module"]) in ("MM", "FI")] print(f"\nPattern: {p['pattern_name']} ({len(mm_fi)} MM/FI steps)") for step in mm_fi: flag = "✓" if step["spro_detail"] else "·" print(f" [{flag}] [{step['module']}] {step['step']}") if step["spro_detail"]: print(f" Source: {step['spro_source']}") print(f" Detail: {step['spro_detail'][:160].splitlines()[0]}") ``` -------------------------------- ### Verify Dependency Installation (macOS/Linux) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/SETUP.md Performs a smoke test to verify that the 'fastmcp' library was successfully installed in the virtual environment. Expected output is 'OK'. ```bash .venv/bin/python -c "import fastmcp; print('OK')" ``` -------------------------------- ### Verify Dependency Installation (Windows) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/SETUP.md Tests the 'fastmcp' library installation on Windows by running a Python command within the virtual environment. Successful execution prints 'OK'. ```powershell .venv\Scripts\python.exe -c "import fastmcp; print('OK')" ``` -------------------------------- ### Tag and Create GitHub Release (Git & GitHub CLI) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/docs/plans/2026-02-18-readme-and-release.md This process involves two main steps: first, creating a Git tag locally and pushing it to the remote repository, and second, using the GitHub CLI to create a formal release associated with that tag. The release includes a title and detailed release notes provided via a heredoc. ```bash git tag v0.1.0 git push origin v0.1.0 gh release create v0.1.0 \ --title "v0.1.0 — Initial SAP ECC 6.0 Knowledge Base" \ --notes "$(cat <<'EOF'\n## Initial Release\n\nThis is the first structured release of the SAP ECC 6.0 Knowledge Base for Claude Code.\n\n### What's Included\n\n**MM — Materials Management**\n- Transaction codes: purchasing, goods movements, inventory, vendor master\n- Configuration: account determination (OBYC), movement type customization, MRP\n- Processes: Procure-to-Pay end-to-end, goods receipt/invoice verification\n- Integration: MM→FI account determination, MM→SD availability check\n\n**SD — Sales & Distribution**\n- Transaction codes: order management, delivery, billing, pricing\n- Configuration: pricing procedures, output (NACE), credit management\n- Processes: Order-to-Cash end-to-end\n- Integration: SD→FI billing, SD→MM availability and goods issue\n\n**FI — Financial Accounting**\n- Transaction codes: GL, AP, AR, asset accounting, bank accounting\n- Configuration: chart of accounts, document types, posting keys, fiscal year\n- Processes: period-end close sequence, document parking and clearing\n- Integration: FI↔CO reconciliation, FI←MM/SD automatic postings\n\n**CO — Controlling**\n- Transaction codes: cost centers, internal orders, profit centers, allocations, settlement\n- Configuration: controlling area, cost element categories, settlement profiles\n- Processes: period-end CO sequence, allocation cycles, order settlement\n- Integration: CO↔FI integration catalog (21 scenarios across 3 directions)\n\n**Cross-Module**\n- End-to-end process playbooks: P2P, O2C, R2R\n- 8 scenario playbooks: consignment, intercompany, third-party, subcontracting, split valuation, batch management, serial number, project stock\n- 12 solution design patterns for common business requirements\n- Month-end and year-end close checklists with T-codes and sequence\n\n**Reference**\n- Movement type catalog\n- Document type and posting key tables\n- Org structure reference\n\n### Scope\n\nECC 6.0 (Enhancement Packs 0–8) only. S/4HANA differences are noted inline for disambiguation.\n\n### Setup\n\nSee [README](README.md) for installation and usage instructions.\nEOF )" ``` -------------------------------- ### Install Server Dependencies (macOS/Linux) Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/SETUP.md Installs the server's dependencies, specifically the 'fastmcp' library, using pip within the virtual environment. Requires Python 3.10+. ```bash .venv/bin/python -m pip install -r scripts/requirements.txt ``` -------------------------------- ### SAP Live Query Execution Examples Source: https://github.com/brandedtamarasu-glitch/sapknowledge/blob/main/EXAMPLES.md Demonstrates the live execution of the SAP knowledge routing system with various query types. It calls the `route_query` function with different inputs, including a simple T-code lookup, a configuration query, a cross-module process query, and a keyword fallback query. The `stop_on_first_hit` parameter is shown to control the routing behavior for non-T-code queries. ```python print("\n─"*35) print("LIVE EXECUTION — T-code lookup (ME21N):") route_query("What does ME21N do?") print("\nLIVE EXECUTION — Config query (FI payment terms):") route_query("What is the SPRO path for payment terms in FI?", stop_on_first_hit=False) print("\nLIVE EXECUTION — Cross-module process (GR → FI):") route_query("How does a goods receipt in MM post to FI?", stop_on_first_hit=False) print("\nLIVE EXECUTION — Keyword fallback:") route_query("What is GR/IR clearing?") ```