Chọn lối vào · Hướng dẫn
🔍
v1.25.7 · 28 agents · 43 skills
Plugin + MCP + GUI cho SAP ABAP Cloud

SAP ABAP Agent

Làm việc với SAP BTP / S/4HANA Cloud qua Claude Code hoặc GUI desktop — đọc ABAP, hỏi consultant, scaffold RAP/CDS. Chọn một lối vào phù hợp với bạn:

💻 Lối 1 — Claude Code (5 bước)

Dành cho ABAP developer / consultant dùng Claude Code. Mục tiêu: ping được hệ thống và hỏi được câu đầu tiên.

  1. Cài MCP server (wheel) Cài bằng pip — không cần clone repo. Chi tiết lệnh ở mục Cài đặt.
  2. Đăng ký MCP bắt buộc Thêm sap-connect, sap-dict-bridge, cds-kb, mcp-sap-docs-btp. Xem Đăng ký MCP.
  3. Thêm project SAP Chạy wizard setup / thêm profile OAuth2. Xem Thêm project SAP.
  4. Kiểm tra kết nối sap_ping / doctor — xác nhận tenant sẵn sàng. Xem Kiểm tra kết nối.
  5. Dùng hàng ngày Đọc/tìm/activate qua MCP Tools, hoặc codegen từ FS. Xem MCP Tools và Codegen.

🖥️ Lối 2 — GUI desktop (Windows)

Dành cho người muốn cấu hình bằng giao diện. App cũ (ví dụ 1.19) không có About/updater — nên cài bản mới từ gui-latest.

  1. Tải bộ cài NSIS Mở release gui-latest → file *_x64-setup.exe.
  2. Cài và mở app Chạy installer, mở SAP ABAP Agent. Kiểm tra phiên bản ở About.
  3. Đăng ký MCP bắt buộc Dùng CTA trong GUI để đăng ký các MCP core — tránh nút “xem doc” chết.
  4. Thêm / chọn profile SAP Nhập thông tin BTP/S4HC giống lối Claude Code. Chi tiết OAuth ở OAuth2.
  5. Cập nhật sau này About → Check update (đọc gui-latest/update.json). Bản quá cũ cần cài lại tay.

📚 Lối 3 — Học & hỏi SAP

Dành cho consultant / learner. Có thể hỏi module mà chưa cần codegen; kết nối hệ thống vẫn hữu ích khi cần đọc object thật.

  1. Cài plugin / MCP tối thiểu Ít nhất Claude Code + plugin SAP ABAP Agent. Xem Cài đặt nếu chưa có.
  2. Hỏi theo module Ví dụ: hoi SD: cau hinh pricing — engine tự chọn consultant. Xem Cách đặt câu hỏi.
  3. Xem danh mục 28 agents Biết module nào có sẵn trước khi hỏi sâu. Xem Chi tiết từng Agent.
  4. Bật học mỗi ngày (opt-in) Daily tip + skill tự tạo — mặc định tắt. Xem Học SAP mỗi ngày.

📚 Lối 3 — Học & hỏi SAP

Dành cho consultant / learner. Có thể hỏi module mà chưa cần codegen; kết nối hệ thống vẫn hữu ích khi cần đọc object thật.

  1. Cài plugin / MCP tối thiểu Ít nhất Claude Code + plugin SAP ABAP Agent. Xem Cài đặt nếu chưa có.
  2. Hỏi theo module Ví dụ: hoi SD: cau hinh pricing — engine tự chọn consultant. Xem Cách đặt câu hỏi.
  3. Xem danh mục 28 agents Biết module nào có sẵn trước khi hỏi sâu. Xem Chi tiết từng Agent.
  4. Bật học mỗi ngày (opt-in) Daily tip + skill tự tạo — mặc định tắt. Xem Học SAP mỗi ngày. Đã MCP ping? Thử học từ hệ thống.

🏠 Giới thiệu

SAP ABAP Agent là plugin dành cho Claude Code (Anthropic) kết hợp với MCP server, cho phép bạn tương tác trực tiếp với SAP BTP hoặc S/4HANA Cloud ngay trong terminal.

Bạn có thể đọc source code ABAP, tìm kiếm object, syntax-check, activate object — tất cả đều thông qua hội thoại với Claude mà không cần rời khỏi editor.

Điểm mạnh nhất là hỗ trợ multi-profile: mỗi project SAP (URL, tenant, OAuth2 riêng) là một profile độc lập, được lưu an toàn trong máy bạn với secret được mã hóa.

✨ Tính năng nổi bật

🧠

28 agents (25 modules + 3 cross-cutting)

Auto-scoring routing engine. Hỏi câu hỏi nghiệp vụ, AI tự dispatch consultant phù hợp hoặc nhiều module song song.

🎯

Học SAP mỗi ngày

Hermes-like daily learning agent. Tự động track tiến độ, gửi tip hằng ngày, tạo skill documents từ câu hỏi phức tạp.

🖥️

GUI desktop + updater

App Windows đăng ký MCP, quản lý profile, kiểm tra cập nhật qua kênh gui-latest.

🔌

MCP core sẵn sàng

sap-connect, dict-bridge, CDS KB, SAP Docs — đủ để đọc/tìm/activate và tra cứu Cloud.

⚡

Thêm project chỉ 1 lệnh

mcp-sap-connect setup <URL> — wizard tự sinh profile, hỏi thông tin OAuth2 và lưu cấu hình.

📚

CDS KB + SAP Docs Research

Tra cứu 7,355 CDS views + SAP Help, Community, API Hub, Fiori App Library qua MCP.

🏗️ Kiến trúc hệ thống

Ba tầng đơn giản: bạn hỏi trong Claude/GUI → routing + skills → MCP nói chuyện với SAP.

1. Bạn

Claude Code hoặc GUI desktop — câu hỏi nghiệp vụ, lệnh setup, codegen.

2. Agent + Skills

28 consultants, routing theo keyword, skills ABAP/MCP hướng dẫn đúng quy trình Cloud.

3. MCP → SAP

sap-connect, dict-bridge, CDS KB, docs — đọc/tìm/activate/tạo object trên BTP / S/4HANA Cloud.

Xem sơ đồ chi tiết (ASCII) và file map
┌─────────────────────────────────────────────────────────┐ │ 📱 USER (Claude Code) │ │ "hoi SD: cau hinh pricing" │ │ "hoc SAP hom nay" │ │ "setup SAP BTP" │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ 🧠 sap-ask-consultant │ │ (Auto-scoring Routing Engine) │ │ │ │ 🟢 Buoc 1: Keyword Scoring (weight 3/2/1) │ │ 🟢 Buoc 2: Explicit Mention ("hoi X") │ │ 🟢 Buoc 3: Module Coupling (FI↔CO, PP→QM→MM...) │ │ 🟢 Buoc 4: Parallel Dispatch (>= threshold) │ └──┬──────┬──────┬──────┬──────┬──────┬──────┬─────────┘ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌──────────┐ │ SD │ │ FI │ │ MM │ │ PP │ │ QM │ │... │ │ Researcher│ └──┬─┘ └──┬─┘ └──┬─┘ └──┬─┘ └──┬─┘ └────┘ └─────┬────┘ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ┌─────────────────────────────────────────────────────────┐ │ MCP Servers & Skills Layer │ │ │ │ 📦 sap-btp-setup → mcp-sap-connect CLI │ │ 📚 sap-cds-kb → cds-kb-mcp (7,355 CDS views) │ │ 📖 sap-docs-research → mcp-sap-docs-btp │ │ 🧹 sap-clean-code → ABAP Cloud naming rules │ │ 🧩 sap-extensibility→ Extensibility checklist │ │ 🛠️ sap-key-user-toolkit→ Key User handbook │ │ 📘 sap-daily-learner→ Hermes-like skill creation │ │ 📄 sap-doc-to-md → Word/Excel → Markdown │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ 🖥️ SAP BTP / S/4HANA Cloud │ │ │ │ sap_list_profiles sap_ping sap_search │ │ sap_list_packages sap_read_source sap_syntax_check │ │ sap_activate sap_find_where_used │ │ sap_execute_query sap_run_unit_tests │ │ sap_get_system_info sap_analyze_dump │ │ sap_create_domain sap_create_data_element │ │ sap_create_table (sap-cloud-dictionary) │ └─────────────────────────────────────────────────────────┘

🔄 Luồng xử lý câu hỏi

  1. User nhập câu hỏi trong Claude Code (VD: "cau hinh cost center va GL")
  2. sap-ask-consultant phân tích keywords, tính score cho từng module
  3. Routing Engine chọn module >= threshold (2): CO (cost center = 3) + FI (GL = 3)
  4. Module Coupling phát hiện CO↔FI → dispatch cả hai
  5. Parallel Dispatch gửi câu hỏi đến sap-co-consultant-cloud + sap-fi-consultant-cloud đồng thời
  6. Tổng hợp câu trả lời từ 2 agent thành 1 phản hồi duy nhất

📁 File Map

📦 sap-abap-agent/ ├── .claude-plugin/ ← Manifest + metadata ├── agents/ ← 28 agent definitions (.md) ├── skills/ ← 43 skill implementations │ ├── sap-ask-consultant/ ← Routing engine (28 agents) │ ├── sap-btp-setup/ ← BTP connection manager │ ├── sap-cds-kb/ ← CDS view search (7,355 views) │ ├── sap-docs-research/ ← SAP Help + Community + API │ ├── sap-clean-code/ ← ABAP Cloud naming rules │ ├── sap-extensibility/ ← Extensibility checklist │ ├── sap-key-user-toolkit/ ← Key User handbook │ ├── sap-daily-learner/ ← Hermes-like skill creation │ ├── sap-doc-to-md/ ← Convert Word/Excel → Markdown │ ├── sap-routing-discipline/ ← SessionStart routing hook │ ├── sap-mcp-status/ ← MCP server audit script │ ├── sap-package-backup/ ← Backup Z*/YY1 qua ADT REST (cảm hứng abapGit) │ └── ... ← 32 other skills (codegen, scaffold, review, test, security) ├── reference/process/ ← Context engineering (trim, summary, module-routing) ├── reference/mcp-guides/ ← MCP setup guides (ADT, GUI, SuccessFactors) ├── reference/modules/ ← 43 module knowledge bases ├── reference/scripts/ ← Lint, validate, cleanup, update, mcp-status ├── commands/ ← /sap-connect, /sync-skills ├── hooks/ ← SELECT * warning + routing discipline ├── index.html ← Trang hướng dẫn này └── README.md ← Tổng quan dự án

📦 Cài đặt

Yêu cầu

  • Python >= 3.10 (cho MCP server mới)
  • Node.js >= 18 (cho supergateway)
  • Claude Code
  • Tài khoản SAP BTP / S/4HANA Cloud với OAuth2 client

Các bước cài đặt

Không cần clone repo — tải 1 file .whl và cài bằng pip:

  1. Cài MCP Server từ file wheel:
# Cài MCP Server — không cần clone repo, tự lấy release mcp-server-v* mới nhất
WHL=$(python -c "import json,urllib.request as u; r=json.load(u.urlopen('https://api.github.com/repos/StormShynn/sap-abap-agent/releases')); rel=next(x for x in r if x['tag_name'].startswith('mcp-server-v')); print(next(a['browser_download_url'] for a in rel['assets'] if a['name'].endswith('.whl')))")
pip install "mcp_sap_connect @ $WHL"

# Trên Windows, thêm win-dpapi
pip install "mcp_sap_connect[win-dpapi] @ $WHL"

# Muốn dùng Cookie Auth kiểu tự mở browser đăng nhập (Auto mode)
pip install "mcp_sap_connect[playwright] @ $WHL"
playwright install chromium

# Kiểm tra môi trường — chạy được dù PATH chưa đúng
python -m mcp_sap_connect.doctor

Lệnh doctor tự phát hiện các lỗi môi trường hay gặp nhất (PATH thiếu entry point, thiếu pywin32/playwright...) và in sẵn lệnh fix — không cần debug thủ công.

Muốn sửa code MCP server hoặc tự build wheel mới? Xem phần "Dev / contributor" trong README (mục xổ xuống ngay sau bước cài đặt).

  1. Cấu hình MCP remote servers cho CDS KB & SAP Docs:
# CDS Knowledge Base (cds-kb-mcp, Streamable HTTP)
claude mcp add --transport http cds-kb --url https://mcp.tringhia.io.vn/mcp

# SAP Docs Research
claude mcp add --transport sse mcp-sap-docs-btp --url https://sap-docs-extend-mcp.cfapps.ap21.hana.ondemand.com/sse

# Notion (skill notes dùng chung cho team) — đã auto-bundle sẵn, chỉ cần /mcp để đăng nhập
claude mcp add --transport http notion https://mcp.notion.com/mcp
  1. Cấu hình Claude Code plugin:
claude mcp add --transport stdio sap-connect -- mcp-sap-connect

Sau bước này, các MCP tool và 28 agents sẽ sẵn sàng trong Claude Code.

🌐 Biến môi trường

SAP_BTP_PROFILE = <id> — Khóa profile cho 1 lần chạy (alias cũ; ưu tiên hơn registry)
MCP_SAP_CONNECT_PROFILE = <id> — Giống trên, tên mới (ưu tiên hơn SAP_BTP_PROFILE)
MCP_SAP_CONNECT_HOME = /path/to/folder — Đổi thư mục cấu hình (mặc định ~/.mcp-sap-connect)

🐛 Báo cáo lỗi tự động (Continuous Improvement)

Error reporter chạy ngầm qua hook system, tự động phát hiện lỗi runtime (lệnh bash fail, MCP tool lỗi, activate fail...) rồi ghi file Markdown local tại %USERPROFILE%\.sap-abap-agent\error-reports\reports\ (Windows) hoặc ~/.sap-abap-agent/error-reports/reports/ (macOS/Linux). Nếu có GitHub auth, sẽ tự tạo issue để dev fix — mỗi ngày plugin càng ít lỗi hơn.

⚠️ Mặc định TẮT (opt-in). Tính năng chỉ chạy khi bạn bật rõ ràng — không tự động thu thập gì nếu bạn không bật. Phần "đính code fix vào issue" chỉ gửi code của chính plugin này lên issue, không bao giờ đính kèm code ABAP/project nội bộ của bạn.

Bước 1 — Bật error reporter

Chọn 1 trong 2 cách:

Cách A — Tạm thời (chỉ session terminal hiện tại)

PowerShell Windows
$env:SAP_ABAP_AGENT_ERROR_REPORTING = "1"
CMD Windows
set SAP_ABAP_AGENT_ERROR_REPORTING=1
bash / zsh / Git Bash / WSL macOS · Linux
export SAP_ABAP_AGENT_ERROR_REPORTING=1

Cách B — Vĩnh viễn (tạo file marker, không cần set env mỗi lần)

PowerShell Windows
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.sap-abap-agent\error-reports"
New-Item -ItemType File -Force -Path "$env:USERPROFILE\.sap-abap-agent\error-reports\ENABLED"
CMD Windows
if not exist "%USERPROFILE%\.sap-abap-agent\error-reports" mkdir "%USERPROFILE%\.sap-abap-agent\error-reports"
echo. > "%USERPROFILE%\.sap-abap-agent\error-reports\ENABLED"
bash / zsh / Git Bash / WSL macOS · Linux
mkdir -p ~/.sap-abap-agent/error-reports && touch ~/.sap-abap-agent/error-reports/ENABLED

Bước 2 — Kiểm tra trạng thái

Chạy lệnh sau bất kỳ lúc nào để xem số lỗi đã ghi nhận, bao nhiêu issue đã tạo trên GitHub:

PowerShell Windows
"{}" | python hooks/error_reporter.py status
CMD Windows
echo {} | python hooks\error_reporter.py status
bash / zsh / Git Bash / WSL macOS · Linux
echo '{}' | python hooks/error_reporter.py status

Bước 3 — Xem file report (Markdown local, không cần GitHub)

Mỗi lỗi được save thành 1 file .md hoàn chỉnh tại ~/.sap-abap-agent/error-reports/reports/. Dù không có GitHub auth bạn vẫn đọc và share được:

PowerShell Windows
Get-ChildItem "$env:USERPROFILE\.sap-abap-agent\error-reports\reports\"
CMD Windows
dir "%USERPROFILE%\.sap-abap-agent\error-reports\reports\"
bash / zsh / Git Bash / WSL macOS · Linux
ls ~/.sap-abap-agent/error-reports/reports/

Bước 4 — Tạo GitHub issue tự động (optional)

Nếu muốn error reporter tự tạo GitHub issue để dev fix, cần 1 trong 2 thứ:

  • gh CLI đã login, HOẶC
  • Set biến môi trường GITHUB_TOKEN (hoặc GH_TOKEN):
PowerShell Windows — vĩnh viễn
[System.Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "ghp_xxx", "User")
CMD Windows — vĩnh viễn
setx GITHUB_TOKEN "ghp_xxx"
bash / zsh macOS · Linux — vĩnh viễn
echo 'export GITHUB_TOKEN=ghp_xxx' >> ~/.bashrc

Sau khi có token, chạy 1 lần để tạo 2 label cần thiết trên repo:

PowerShell / CMD Windows
python reference\scripts\setup_labels.py
bash / zsh macOS · Linux
python reference/scripts/setup_labels.py

Lưu đồ hoạt động

User chạy lệnh → PostToolUse detect → ghi error_log.jsonl
                                           ↓
Stop hook → gom nhóm 24h → dedup (SHA256) → tạo GitHub issue (nếu mới)
                                           ↓
Khi Claude viết code sửa lỗi → detect-fix → ghi fix_log.jsonl
                                           ↓
Stop → match fix với issue → add comment "cách sửa" vào issue có sẵn
                                           ↓
Issue = [🐛 error] + [✅ fix solution] → Dev fix → release → user update → ít lỗi hơn

Các chế độ hook

Hook eventModeChức năng
PostToolUse (Bash) detect-bash Phát hiện lỗi từ Bash command (exit code ≠ 0, stderr)
PostToolUse (sap_*) detect-tool Phát hiện lỗi từ MCP tool (syntax check fail, activate fail, connection error)
PostToolUse (Edit/Write) detect-fix Khi Claude viết code, kiểm tra có phải đang fix lỗi cũ không → ghi fix record
Stop report Gom error → dedup → tạo issue + Gom fix → add comment
💡 Mẹo: Sau khi cập nhật plugin lên version mới, lỗi bạn từng gặp đã có thể đã được fix. Bật error reporter từ đầu giúp bạn thấy ngay khi có lỗi mới xuất hiện — không phải chờ release note.

➕ Thêm project SAP mới

Cách nhanh nhất — truyền URL trực tiếp:

mcp-sap-connect setup https://project1.s4hana.cloud.sap

Wizard sẽ tự sinh profile ID từ hostname (vd: project1.s4hana.cloud.sap) và hỏi phương thức xác thực (chọn 1-4):

  • 1. OAuth2 (client_credentials) — client_id + client_secret, mặc định/khuyên dùng
  • 2. Password — username + password
  • 3. Bearer token — token có sẵn, nhập tay
  • 4. Cookie-based — session cookie SAP, xem chi tiết ở mục Cookie Auth & Web Popup Re-Auth bên dưới

Sau đó hỏi thêm Region, service type (s4hc_(private) / s4hc_(public) / btp / onprem).

Thông tin được lưu riêng trong thư mục profile:

📂 %USERPROFILE%\.mcp-sap-connect\profiles\project1.s4hana.cloud.sap\
├──
config.json ← URL, tenant, client_id, region, service (không nhạy cảm)
└──
secrets.json ← client_secret / token (ĐÃ MÃ HÓA)

Thêm project thứ 2, thứ 3... cũng dễ dàng:

mcp-sap-connect setup https://project2.s4hana.cloud.sap
mcp-sap-connect setup https://project3.s4hana.cloud.sap

Mỗi project có profile riêng, secret riêng (mã hóa độc lập).

🔐 OAuth2 — Kết nối SAP BTP

SAP ABAP Agent hỗ trợ 3 chế độ xác thực OAuth2 để kết nối SAP BTP / S/4HANA Cloud. Tùy vào cấu hình tenant, bạn chọn chế độ phù hợp.

🔑

Client Credentials

Dùng client_id + client_secret. Phù hợp cho M2M automation, không cần user tương tác.

👤

Password Grant

Dùng username + password. Phù hợp khi bạn có tài khoản SAP BTP cá nhân.

🎫

Bearer Token

Dùng token có sẵn (nhập tay). Phù hợp cho testing hoặc token ngắn hạn.

Luồng hoạt động

Khi bạn gọi một MCP tool (vd sap_search), hệ thống tự động:

1. Kiểm tra token trong bộ nhớ (memory cache) 2. Nếu hết hạn → kiểm tra secret đã mã hóa trong secrets.json 3. Nếu còn hạn → dùng lại (tránh gọi OAuth2 liên tục) 4. Nếu hết hạn → gọi OAuth2 endpoint để lấy token mới 5. Tự động lưu refresh_token + expiresAt vào secrets.json 6. Token được refresh 30 giây trước khi hết hạn (SAFETY_MARGIN_S)

Cấu hình OAuth2 Client trên SAP BTP

Trước khi setup, bạn cần tạo OAuth2 client trên SAP BTP cockpit:

  1. Đăng nhập SAP BTP Cockpit → vào Subaccount của bạn
  2. Vào menu Security > OAuth2 Client (hoặc API Clients trong các phiên bản mới)
  3. Tạo client mới với Grant Type = Client Credentials
  4. Ghi lại Client ID và Client Secret
  5. Nếu dùng IAS (Identity Authentication), lưu ý token URL là /oauth2/token thay vì /oauth/token

Wizard Setup chi tiết

Khi chạy mcp-sap-connect setup, wizard sẽ hỏi từng thông tin:

# Bước 1: Nhập URL SAP BTP
$ mcp-sap-connect setup https://project1.s4hana.cloud.sap

# Bước 2: Chọn chế độ xác thực
? Chọn auth mode:
  1. OAuth2 (client_credentials) ← Mặc định, khuyên dùng
  2. Password (username/password)
  3. Bearer token (nhập tay)

# Bước 3a: Nếu chọn OAuth2 client_credentials
? Client ID: sb-abc123-4567-project1x-project1project1
? Client Secret: ****************
? Scope (để trống nếu không cần):

# Bước 3b: Nếu chọn Password grant
? Username: your-username
? Password: ****************
? Client ID: sb-abc123-4567-project1x-project1project1

# Bước 3c: Nếu chọn Bearer token
? Bearer Token: ****************

# Bước 4: Thông tin bổ sung
? Region: eu10
? Service type (s4hc_(private) / s4hc_(public) / btp / onprem): s4hc_(public)

Token URL & Xử lý các hệ thống khác nhau

Mỗi hệ thống SAP có endpoint OAuth2 khác nhau. Agent tự động xác định dựa trên URL gốc, nhưng bạn có thể override nếu cần:

Hệ thống Token URL mặc định Ghi chú
XS UAA (cf) {btpUrl}/oauth/token Mặc định cho hầu hết S/4HANA Cloud
IAS {btpUrl}/oauth2/token Identity Authentication Service
Custom Override trong secrets.json Sửa tokenUrl theo ý muốn

Override Token URL thủ công

Nếu gặp lỗi 404 /oauth/token, bạn có thể sửa trực tiếp file secrets.json:

# Mở file secrets.json (đã mã hóa, cần giải mã qua CLI)
# HOẶC chạy lại setup với đúng token URL

# Cách nhanh: chạy lại setup với flag --overwrite
mcp-sap-connect setup https://project1.s4hana.cloud.sap

# Sau đó sửa tokenUrl trong profile
# File nằm ở:
%USERPROFILE%\.mcp-sap-connect\profiles\project1.s4hana.cloud.sap\secrets.json

Token Lifecycle & Auto-Refresh

Agent quản lý vòng đời token hoàn toàn tự động:

🔄 Tự động refresh

Token được cache trong bộ nhớ. Khi còn 30 giây trước khi hết hạn, agent tự động gọi OAuth2 endpoint để lấy token mới — bạn không cần làm gì cả.

💾 Lưu token an toàn

Token mới + refresh_token + expiresAt được lưu vào secrets.json đã mã hóa. Khi restart agent, token được phục hồi từ file mà không cần xác thực lại.

🔐 Mã hóa đa nền tảng

Windows: DPAPI (gắn với tài khoản Windows). macOS/Linux: AES-256-GCM, key derive từ hostname + username qua scrypt. File mode 0o600.

🔌 Kiểm tra kết nối

Sau khi thêm project, kiểm tra profile trước khi dùng MCP. Entry point chính thức là mcp-sap-connect; sap-btp-agent vẫn là shim tương đương.

# Ping nhanh — chỉ đọc session (nhẹ, không xin CSRF/write)
mcp-sap-connect ping
sap-btp-agent ping

# Connect đầy đủ — đọc + kiểm tra ghi (CSRF). Dùng trước activate / list_packages…
mcp-sap-connect connect
mcp-sap-connect connect project1.s4hana.cloud.sap

# Cookie hết hạn — đăng nhập lại (nhanh hơn setup từ đầu)
mcp-sap-connect reauth
mcp-sap-connect reauth project1.s4hana.cloud.sap

# Môi trường máy (PATH, dependency) — không cần profile
mcp-sap-connect doctor
# Nếu lệnh không nhận diện được:
python -m mcp_sap_connect.doctor

Khác biệt: ping = session còn sống (read-only). connect = ping + thử ghi; nếu write fail nhưng read OK, tool đọc vẫn dùng được còn activate/syntax-check sẽ lỗi — khi cookie auth hãy chạy reauth.

👥 Quản lý nhiều profile

Mỗi URL SAP = 1 profile (secrets riêng). Entry chính: mcp-sap-connect (sap-btp-agent = shim cùng lệnh).

mcp-sap-connect profiles list
Liệt kê profile (* = active). Thêm --json nếu cần máy đọc.
mcp-sap-connect profiles use <id>
Chọn profile active mặc định
mcp-sap-connect profiles show [id]
Xem config (bỏ id = profile active)
mcp-sap-connect profiles remove <id>
Xóa một profile
mcp-sap-connect profiles import <config.json>
Import URL từ backup config.json (secrets phải copy tay)
mcp-sap-connect reset
⚠️ Xóa tất cả profile + secrets (gõ yes để xác nhận)

Chọn profile trong MCP tools

Thứ tự ưu tiên: env SAP_BTP_PROFILE → tham số profile trên tool → profile active.

"Liệt kê package trên project1"
→ sap_list_packages({ profile: "project1.s4hana.cloud.sap" })

"Tìm ZCL_* trên profile đang active"
→ sap_search({ query: "ZCL_" })  # không truyền profile

Chạy nhiều instance cùng lúc

Gắn profile khác nhau cho mỗi process MCP (env ghi đè active):

bash / zsh / Git Bash macOS · Linux · WSL
# Terminal A — profile project1
SAP_BTP_PROFILE=project1.s4hana.cloud.sap mcp-sap-connect

# Terminal B — profile khác
SAP_BTP_PROFILE=project2.s4hana.cloud.sap mcp-sap-connect
PowerShell Windows
# Terminal A
$env:SAP_BTP_PROFILE = "project1.s4hana.cloud.sap"
mcp-sap-connect

# Terminal B
$env:SAP_BTP_PROFILE = "project2.s4hana.cloud.sap"
mcp-sap-connect

⚙️ Đăng ký MCP với Claude Code

Claude Code không còn dùng file mcp_servers.json — đăng ký bằng lệnh claude mcp add:

claude mcp add --transport stdio sap-connect -- mcp-sap-connect

Mặc định scope local (chỉ máy này, chỉ project hiện tại). Dùng --scope user để dùng được ở mọi project, hoặc --scope project để lưu vào .mcp.json và chia sẻ qua git cho cả team.

💡 Notion — skill notes dùng chung cho team. Server notion đã auto-bundle sẵn trong .mcp.json của plugin này — không cần claude mcp add thủ công. Mỗi thành viên chỉ cần gõ /mcp trong Claude Code để đăng nhập tài khoản Notion của chính mình (OAuth, không lưu token nào trong repo). Chia sẻ workspace cho team = mời thành viên vào page Notion tương ứng (thao tác phía Notion), không liên quan đến file cấu hình.

Test plugin cục bộ (không cần cài vào marketplace):

claude --plugin-dir ./sap-abap-agent

🔄 Cập nhật

Có 2 cơ chế cập nhật tự động — chạy 1 lệnh là xong:

🤖

Auto (CI/CD)

Mỗi lần push code mới vào main, GitHub Actions tự động: bump version trong plugin.json → build wheel .whl → tạo GitHub Release → tạo git tag vX.Y.Z. Claude Code marketplace thấy tag mới → tự nhắc bạn cập nhật plugin.

⬇️

Local update (1 lệnh)

Chạy script update để tải wheel mới nhất + pip install + git pull plugin:

# Windows (PowerShell)
.\reference\scripts\update.ps1

# Linux / macOS
bash reference/scripts/update.sh

🛠️ MCP Tools

Sau khi đăng ký, các tool sau sẽ xuất hiện trong Claude Code. Mỗi tool đều có tham số profile (để trống = dùng profile active).

Tool Mô tả Tham số chính
sap_list_profiles Liệt kê các profile đã cấu hình —
sap_ping Test kết nối profile profile
sap_list_packages Liệt kê package ABAP profile, parent
sap_search Tìm object ABAP theo tên profile, query, objectType
sap_read_source Đọc source code (class, program, include...) profile, objectUri, objectType
sap_syntax_check Syntax check (không activate) profile, objectUri, objectType
sap_activate Activate object (transport local) profile, objectUri, objectType
sap_find_where_used Tìm nơi sử dụng object ABAP (where-used) profile, objectName, objectType
sap_execute_query Truy vấn dữ liệu bảng / CDS view profile, tableName, objectType, top
sap_run_unit_tests Chạy ABAP Unit tests profile, objectUri, objectType
sap_get_system_info Lấy thông tin hệ thống SAP (version, profile...) profile
sap_analyze_dump Phân tích ST22 runtime dump profile, dumpId, top

Ví dụ prompt trong Claude Code:

"Liệt kê tất cả profile SAP của tôi"
→ Claude gọi sap_list_profiles()

"Tìm class bắt đầu bằng ZCL_ trong project project1"
→ Claude gọi sap_search({ profile: "project1.s4hana.cloud.sap", query: "ZCL_" })

⌨️ Lệnh CLI

Lệnh Mô tả
mcp-sap-connect setup <URL> Thêm project SAP mới (wizard)
mcp-sap-connect connect Test kết nối profile active
mcp-sap-connect connect <id> Test kết nối một profile cụ thể
mcp-sap-connect profiles list Liệt kê tất cả profile
mcp-sap-connect profiles use <id> Chọn profile active
mcp-sap-connect profiles show Xem chi tiết profile active
mcp-sap-connect profiles remove <id> Xóa một profile
mcp-sap-connect reset ⚠️ Xóa tất cả dữ liệu
mcp-sap-connect doctor Kiểm tra môi trường (PATH, dependency...)
mcp-sap-connect --help Xem trợ giúp

Tips: Bạn có thể dùng lệnh /sap-connect ngay trong Claude Code để được hướng dẫn từng bước. Nếu mcp-sap-connect báo "not recognized", chạy python -m mcp_sap_connect.doctor — lệnh này chạy được dù PATH chưa đúng.

🧠 SAP Consultant System (28 agents)

skills/sap-ask-consultant/SKILL.md — Auto-scoring routing engine dispatch câu hỏi user tới 28 agents (25 module consultants + 1 researcher + 1 daily learner + 1 reviewer).

🔀 Cách hoạt động

  1. Keyword Matrix: Mỗi module có keywords với weight 3/2/1
  2. Tính score: Module >= threshold (2) → dispatch
  3. Explicit mention: "hoi SD", "hoi FI" → dispatch mặc định
  4. Module coupling: FI↔CO, PP→QM→MM, PM→MM→FI, v.v.
  5. Parallel dispatch: Tất cả module >= threshold dispatch song song

Danh sách 28 agents (25 module consultants + 3 cross-cutting)

#AgentModule
1sap-sd-consultant-cloudSales & Distribution
2sap-fi-consultant-cloudFinancial Accounting
3sap-mm-consultant-cloudMaterials Management
4sap-co-consultant-cloudControlling
5sap-pp-consultant-cloudProduction Planning
6sap-qm-consultant-cloudQuality Management
7sap-pm-consultant-cloudPlant Maintenance
8sap-wm-consultant-cloudWarehouse Management
9sap-ps-consultant-cloudProject Systems
10sap-hcm-consultant-cloudHuman Capital Management
11sap-bw-consultant-cloudAnalytics / BW
12sap-basis-consultant-cloudBasis / Technical Admin
13sap-tm-consultant-cloudTransportation Management
14sap-tr-consultant-cloudTreasury & Cash Management
15sap-ariba-consultant-cloudProcurement Collaboration
16sap-ca-consultant-cloudCross-Application Functions
17sap-gts-consultant-cloudGlobal Trade Services
18sap-ehs-consultant-cloudEnvironment, Health & Safety
19sap-ibp-consultant-cloudIntegrated Business Planning
20sap-ewm-consultant-cloudExtended Warehouse Management
21sap-fiori-consultant-cloudFiori/UI5 & Frontend
22sap-cap-consultant-cloudCAP / Cloud Application Programming
23sap-cpi-consultant-cloudCloud Platform Integration
24sap-successfactors-consultant-cloudSuccessFactors & HR Cloud
25sap-btp-admin-consultant-cloudBTP Admin & Infrastructure
—sap-docs-researcher📚 CDS view & Docs Research
🎯sap-daily-learner🧠 Học SAP mỗi ngày — Hermes-like (2026)

Ví dụ routing

Câu hỏiDispatch
"tim CDS view cho sales order bi cham giao hang"sap-docs-researcher + sap-sd-consultant-cloud
"cau hinh cost center va GL"sap-co-consultant-cloud + sap-fi-consultant-cloud
"lam sao tao purchase order"sap-mm-consultant-cloud
"hoi PP va QM va MM"sap-pp + sap-qm + sap-mm song song
"cau hinh customs cho import"sap-gts-consultant-cloud + sap-mm-consultant-cloud
"quan ly hoa chat nguy hiem"sap-ehs-consultant-cloud + sap-mm-consultant-cloud
"hoc SAP hom nay"sap-daily-learner (daily tip + learning path)
"quiz MM cho toi"sap-daily-learner (trac nghiem MM)
"Fiori app cho sales order"sap-fiori-consultant-cloud + sap-sd-consultant-cloud
"CAP side-by-side extension"sap-cap-consultant-cloud + sap-btp-admin-consultant-cloud
"iFlow tich hop S/4HANA vs SuccessFactors"sap-cpi-consultant-cloud + sap-successfactors-consultant-cloud
"IBP inventory optimization"sap-ibp-consultant-cloud + sap-mm-consultant-cloud
"EWM wave management cho kho"sap-ewm-consultant-cloud
"BTP destination + Cloud Connector"sap-btp-admin-consultant-cloud

🔀 Auto-scoring Routing Engine

Chi tiết keyword matrix, explicit mention, module coupling xem trong file skills/sap-ask-consultant/SKILL.md.

📚 Bước 5 — tra kiến thức có sẵn trước khi dispatch: trước khi giao cho agent tư vấn trả lời, routing tự tra memory/procedural/skills/ (local, offline) rồi tới database "SAP Skills" trên Notion (online, chỉ khi local chưa có) — thấy thì dùng luôn + tự cache lại local, không thấy thì agent trả lời như bình thường. Mất local (đổi máy...) không sao, lần hỏi lại đầu tiên sẽ tự lấy lại từ Notion. Áp dụng cho toàn bộ 25 agent tư vấn, không chỉ Daily Learner.

Keyword Matrix (rút gọn)

ModuleWeight 3 keywordsWeight 2 keywords
SDsales order, pricing, billing, deliverydon hang, giao hang, hoa don ban
FIGL, journal entry, AP, AR, assetsổ cái, công nợ, khấu hao, thuế
MMpurchase order, requisition, PO, goods receiptinventory, tồn kho, nhập kho
COcost center, product costing, CO-PAgiá thành, phân bổ chi phí
PPproduction order, MRP, BOM, routingsản xuất, work center
QMinspection lot, quality certificatekiểm tra chất lượng
PMmaintenance order, equipment, functional locationbảo trì, spare parts
WMwarehouse, EWM, transfer orderkho, picking, cycle counting
PSproject, WBS, network, milestonedự án, budget, RRB
HCMemployee, HR, payrollnhân sự, timesheet
BWanalytics, SAC, BIbáo cáo, query, analytical
Basisbasis, role, transport, user adminphân quyền, job, tenant
TMtransportation, freight ordervận chuyển, shipment
TRtreasury, cash management, bank accountngân hàng, dòng tiền
Aribaariba, business network, sourcingsupplier management
CAbusiness partner, document managementBP, DMS, workflow
GTScustoms, global trade, SPLhải quan, xuất nhập khẩu
EHSenvironment, health, safetymôi trường, an toàn, hóa chất
IBPdemand planning, supply planning, S&OP, inventorydự báo, tồn kho an toàn
EWMembedded EWM, wave, warehouse, laborkho, wave management, VAS
FioriFiori, UI5, Fiori Elements, SAP Buildgiao diện, frontend, freestyle
CAPCAP, CDS, side-by-side, MTAextension, cloud application
CPICPI, iFlow, integration, middlewaretích hợp, adapter, B2B
SFSuccessFactors, Employee Central, talentnhân sự cloud, recruiting
BTP AdminBTP, CF, Kyma, destination, Cloud Connectorsubaccount, entitlement, cockpit
ResearchCDS view, SAP note, SAP HelpFiori app, API hub

Module Coupling chính

Module AAuto-dispatchLý do
COFICost center trên ACDOCA (FI)
PPQM, MMQuality inspection, BOM/component
PMMM, PP, FI, COSpare parts, equipment, chi phí
WMMM, SD, PPGR, delivery, production supply
PSCO, FI, SD, PP, HCMCost object, billing, timesheet
AribaMM, FIProcurement (MM), invoice (FI)
CASD, MM, FIBP dùng chung cho customer/supplier
GTSSD, MM, TMExport (SD), import (MM), transport (TM)
EHSMM, PP, WMHóa chất (MM), sản xuất (PP), kho (WM)
IBPPP, SD, MMDemand (SD), supply (PP), procurement (MM)
EWMMM, SD, PPGR (MM), delivery (SD), production supply (PP)
FioriTất cả modulesFrontend cho mọi module nghiệp vụ
CAPBTP Admin, CPIExtension infrastructure + integration
CPITất cả modulesMiddleware tích hợp cho mọi module cloud
SFCPI, HCMIntegration (CPI), HR core (HCM)
BTP AdminBasis, CAP, CPIInfrastructure, extension, integration

📇 Chi tiết từng Agent (28 files)

28 agents — 25 module consultants (auto-scored, parallel dispatch) + 1 docs researcher (tra cứu CDS/docs) + 1 daily learner (học SAP mỗi ngày) + 1 abap-reviewer (review code). Mỗi agent chỉ tư vấn/review — không tự sửa code (không Write/Edit), chạy model sonnet.

🛒

SD — Sales & Distribution

sap-sd-consultant-cloud

Tư vấn order-to-cash: sales order, pricing, availability check, delivery, billing, credit management. Luôn chỉ rõ SSCUI/Fiori app cụ thể và đúng bậc thang extensibility khi cần mở rộng.

💰

FI — Financial Accounting

sap-fi-consultant-cloud

Tư vấn General Ledger (Universal Journal/ACDOCA), Accounts Payable/Receivable, Asset Accounting. Cân nhắc tác động đóng sổ kỳ/năm khi câu hỏi liên quan closing.

📦

MM — Materials Management

sap-mm-consultant-cloud

Tư vấn procurement (purchase order, requisition, sourcing, contract), inventory management, material master, valuation (standard/moving average price, material ledger).

📊

CO — Controlling

sap-co-consultant-cloud

Cost center accounting, product costing, profitability analysis (CO-PA trên Universal Journal), phân bổ chi phí. Lưu ý: Internal Orders không hỗ trợ đầy đủ trên Public Cloud (thường thay bằng WBS/PS); chỉ có Account-based CO-PA.

🏭

PP — Production Planning

sap-pp-consultant-cloud

Production order, MRP (MRP Live, không phải classic MRP), BOM, routing, work center, capacity, Repetitive Manufacturing (REM). Phân biệt rõ Discrete vs REM; PP/DS cần thêm BTP + IBP.

✅

QM — Quality Management

sap-qm-consultant-cloud

Quality inspection (inspection lot, result recording, usage decision), inspection plan, certificate, non-conformance. Inspection lot thường tự tạo từ GR/production confirmation; phạm vi QM hẹp hơn on-premise.

🔧

PM — Plant Maintenance

sap-pm-consultant-cloud

Maintenance order, notification, equipment, functional location, maintenance plan. Phân biệt corrective (sự cố → notification + order) vs preventive (định kỳ → plan); tích hợp MM/PP/FI.

🏬

WM — Warehouse Management

sap-wm-consultant-cloud

Warehouse structure, stock placement/removal, transfer order, cycle counting. Public Cloud khuyến dùng Embedded EWM (scope BK9) thay vì LE-WM cổ điển.

📋

PS — Project Systems

sap-ps-consultant-cloud

Project, WBS element, network, milestone, project budget, resource-related billing (RRB), settlement. Phạm vi hẹp hơn on-premise — Internal Order không đầy đủ, dùng WBS thay thế.

👥

HCM — Human Capital Mgmt

sap-hcm-consultant-cloud

Personnel admin, organizational management, time management, payroll cơ bản. Quan trọng: phân biệt rõ S/4HANA HCM core (PA/OM/time) vs SuccessFactors (talent/recruiting/performance) — 2 hệ thống khác nhau.

📈

BW — Analytics / BW

sap-bw-consultant-cloud

3 mức độ analytics: Embedded Analytics (CDS query) → SAP Analytics Cloud (SAC) → BW/4HANA side-by-side. Luôn ưu tiên embedded analytics trước, chỉ đề xuất SAC/BW khi cần.

⚙️

Basis — Technical Admin

sap-basis-consultant-cloud

User & role (Business User/Role), transport (Software Collection), job scheduling, monitoring, certificate. Basis Cloud khác hoàn toàn on-premise — kernel update/DB backup/STMS do SAP tự làm.

🚚

TM — Transportation Mgmt

sap-tm-consultant-cloud

Freight order, carrier selection, freight charge calculation/settlement, transportation planning. Phân biệt Embedded TM (scope BPL) vs TM side-by-side trên BTP.

🏦

TR — Treasury & Cash Mgmt

sap-tr-consultant-cloud

Cash management, bank account management, liquidity forecast, payment processing (F110). Nghiệp vụ phức tạp (derivatives, hedge) có phạm vi hẹp trên Public Cloud.

🤝

Ariba — Procurement Collab.

sap-ariba-consultant-cloud

SAP Ariba/Business Network (sourcing, supplier management) và tích hợp S/4HANA qua CPI. Quan trọng: Ariba là hệ thống riêng (Java-based, Ariba Admin Console), không phải module trong S/4HANA core.

🔗

CA — Cross-Application

sap-ca-consultant-cloud

Business Partner, Document Management (DMS), Flexible Workflow, Output Management, Archiving/ILM, Number Ranges. Module ngang — luôn kiểm tra có cần dispatch thêm SD/MM/FI không.

🌍

GTS — Global Trade Services

sap-gts-consultant-cloud

Customs management, Sanctioned Party List (SPL), preference processing, embargo control, Intrastat. Thường triển khai side-by-side trên BTP, cấu hình qua GTS cloud chứ không phải SSCUI.

🌿

EHS — Environment, Health & Safety

sap-ehs-consultant-cloud

Product safety (MSDS), hazardous substance management, waste management, industrial hygiene, incident management. Tích hợp chặt với MM (hóa chất), PP, WM (kho hóa chất).

🔎

Docs Researcher

sap-docs-researcher

Tra cứu CDS view (7,355 views), SAP Help, SAP Community, Accelerator Hub, Fiori App Library, Clean Core Released Objects, ABAP feature matrix qua 2 MCP server chuyên dụng. Chỉ tra cứu — không tư vấn cấu hình chuyên sâu.

📚

Daily Learner

sap-daily-learner

Agent tự cải thiện (self-improving) lấy cảm hứng từ Hermes Agent — gia sư SAP hàng ngày + tự tạo skill document từ tương tác phức tạp. Xem chi tiết ở mục Học SAP mỗi ngày bên dưới.

🕵️

ABAP Reviewer

abap-reviewer · gọi thủ công

Review code ABAP theo chuẩn ABAP Cloud: kiểm tra cả 3 tầng — đặt tên/clean code (namespace Z/Y, bỏ Hungarian notation), kiến trúc/extensibility (cú pháp bị cấm, released API), VÀ bảo mật (sap-security-review — SQL/CDS injection, thiếu authorization check, hardcode credential, kèm kịch bản khai thác cụ thể cho từng phát hiện). Chỉ review, không tự sửa hay tạo code mới.

💡 Cách đặt câu hỏi hiệu quả

Hệ thống sử dụng auto-scoring routing engine để tự động dispatch câu hỏi tới đúng consultant. Cách bạn đặt câu hỏi ảnh hưởng trực tiếp đến độ chính xác của routing.

📝 Nguyên tắc chung

  • Dùng từ khóa chuyên ngành: "purchase order" thay vì "đơn mua", "cost center" thay vì "bộ phận"
  • Nói rõ module: "SD: pricing cho sales order" — dùng "hoi X:" để force dispatch module X
  • Hỏi một vấn đề / lần: Hệ thống dispatch song song, nhưng câu hỏi quá rộng sẽ làm loãng score
  • Dùng tiếng Anh cho keywords: Từ khóa weight-3 đều là tiếng Anh (sales order, GL, purchase order...)

🎯 Mẫu câu hỏi cho từng module

ModuleCâu hỏi mẫu (tốt ✅)Câu hỏi kém (❌)
SD "hoi SD: cau hinh pricing cho sales order"
"lam sao tao billing cho delivery"
"ban hang the nao" (quá chung)
FI "hoi FI: cau hinh GL account"
"cach hach toan AP va AR"
"ke toan" (quá chung, score thấp)
MM "lam sao tao purchase order"
"hoi MM: cau hinh goods receipt"
"mua hang" (score = 1, không đủ threshold)
CO "cau hinh cost center va phan bo chi phi"
"product costing cho san xuat"
"chi phi" (quá ngắn)
PP "hoi PP: cau hinh MRP va BOM"
"production order + routing"
"san xuat" (score thấp)
QM "cau hinh inspection lot cho nguyen vat lieu"
"quality certificate cho PO"
"kiem tra" (không đủ specific)
PM "hoi PM: maintenance order + equipment"
"cau hinh bao tri spare parts"
"bao tri" (chỉ weight 2)
WM "cau hinh warehouse + transfer order"
"EWM: picking + putaway"
"kho" (chỉ weight 1)
PS "hoi PS: WBS + network + milestone"
"project budget + RRB billing"
"du an" (chỉ weight 2)
HCM "hoi HCM: payroll + timesheet"
"cau hinh org unit + position"
"nhan su" (score thấp)
Basis "hoi Basis: phan quyen role + user admin"
"cau hinh transport + job scheduling"
"he thong" (quá chung)
Research "tim CDS view cho sales order bi cham"
"tra cuu SAP Help ve pricing"
"search" (không rõ search gì)
Daily Learner "hoc SAP hom nay"
"quiz MM cho toi"
"progress"
"hoc" (quá ngắn)

🔗 Câu hỏi multi-module (dispatch song song)

Câu hỏiModule dispatchGiải thích
"cau hinh cost center va GL"CO + FIcost center→CO (3), GL→FI (3), coupling CO↔FI
"lam sao tao PO tu production order"MM + PPPO→MM (3), production order→PP (3), coupling PP→MM
"cau hinh customs cho import"GTS + MMcustoms→GTS (3), import→MM (2), coupling GTS→MM
"quan ly hoa chat nguy hiem"EHS + MM + WMhóa chất→EHS (2), EHS→MM→WM coupling
"hoi PP va QM va MM"PP + QM + MMExplicit mention cả 3 module

💬 Câu hỏi cho từng skill

SkillKhi nào dùngCâu hỏi mẫu
sap-ask-consultant Hỏi bất kỳ câu hỏi nghiệp vụ SAP nào "hoi MM: lam sao tao purchase order"
sap-btp-setup Kết nối / cấu hình SAP BTP, lỗi auth "setup SAP BTP cho https://project1.s4hana.cloud.sap"
sap-cds-kb Tra cứu CDS view, taxonomy, field list "tim CDS view cho overdue invoices"
sap-docs-research Tra SAP Help, Community, API, Fiori App "tra cuu SAP ve pricing procedure"
sap-clean-code Review naming, clean code ABAP Cloud "review class ZCL_MATERIAL nay: ..."
sap-extensibility Hỏi về extensibility, Clean Core "co extensibility nao cho custom field PO khong?"
sap-key-user-toolkit Hướng dẫn Key User Extensibility "them custom field vao journal entry bang Key User"
sap-doc-to-md Convert file Word/Excel (FS, BP...) sang Markdown "convert file FS_ZMFG12.docx sang markdown"
sap-daily-learner Học SAP mỗi ngày, quiz, track progress "hoc SAP hom nay" / "quiz MM"
abap-reviewer Review code ABAP (chỉ review, không sửa) "review doan code ABAP Cloud nay:"

⚡ Mẹo nâng cao

🎯

Force dispatch module

Dùng "hoi X:" hoặc "nho X tu van:" để chắc chắn module X được gọi, bất kể score.

🔗

Gộp nhiều module

"hoi FI va CO: cau hinh cost center" → dispatch cả FI và CO song song.

📚

Kết hợp Research

"tim CDS view cho PO + hoi MM" → researcher tra CDS + MM tu van song song.

💬 Bắt đầu ngay

Mở Claude Code với plugin và thử một trong các câu lệnh sau:

"Setup SAP BTP cho project https://project1.s4hana.cloud.sap" "Hoi MM: lam sao tao purchase order" "Tim CDS view cho sales order + hoi SD" "Hoc SAP hom nay" "Quiz MM cho toi" "Liệt kê các profile SAP của tôi"

🔌 Học từ hệ thống (MCP)

Skill sap-learn-from-system — đọc object thật sau ping → lesson local (scrub) → đồng bộ Notion SAP Skills (fail-open / private opt-out).

  1. Ping / connectmcp-sap-connect ping hoặc MCP sap_ping.
  2. Chọn ≤ 5 objectTên rõ hoặc package Z* — xem checklist trong skill.
  3. Đọc + rút patternGhi memory/semantic/notes/system/ — không dump source khách.
  4. Notion shareSearch trùng → tạo page scrub trên DB SAP Skills (notion_skills_db.py get). Private hoặc lỗi → chỉ local.

📚 Học SAP mỗi ngày — Hermes-like Agent

skills/sap-daily-learner/SKILL.md — Agent tự cải thiện (self-improving) lấy cảm hứng từ Hermes Agent bởi Nous Research. Vừa là gia sư SAP hàng ngày, vừa tự động tạo skill documents từ tương tác với người dùng.

Hermes MCP — optional, không thuộc Core

sap-daily-learner đã có memory 3 tầng, auto-skill, curator, cron và Notion trong plugin. Không cần cài Hermes Agent / hermes mcp serve để học SAP mỗi ngày.

  • Không thêm Hermes vào MCP bắt buộc (Core) của Claude Code / GUI.
  • Nếu bạn đã chạy Hermes Agent riêng: cấu hình Hermes như MCP client trỏ tới mcp-sap-connect, CDS KB, SAP Docs — để Hermes hỏi SAP, không thay daily-learner.
  • hermes mcp serve chủ yếu expose messaging (Telegram/Discord…). Chỉ cân nhắc khi cần cầu đa kênh, không phải tip/skill SAP.

Học từ hệ thống đang kết nối — skill sap-learn-from-system

Sau MCP ping OK: đọc table/class/CDS thật, rút lesson local (scrub), rồi đồng bộ pattern lên Notion SAP Skills (cùng DB với daily-learner). Private / lỗi Notion → chỉ local (fail-open).

Checklist: skills/sap-learn-from-system/CHECKLIST.md. Ví dụ: hoc tu he thong / kham pha class ZCL_….

🌟 Hai chế độ hoạt động

📘

Daily Learning Mode

Gửi tip SAP/ABAP mỗi ngày dựa trên module user hay hỏi. Track tiến độ qua LEARNING_PROGRESS.md. Gợi ý lộ trình học cá nhân hóa.

🤖

Auto-Skill Creation

Khi giải quyết vấn đề phức tạp (≥3 bước), tự động tạo skill document trong skills/user-skills/ — giống Hermes Agent. Trước khi tự giải, tra thử Notion xem team đã có skill tương tự chưa; sau khi tạo xong, tự đồng bộ lên Notion cho cả team dùng chung. Đánh dấu <private> quanh nội dung nhạy cảm để giữ riêng local, không đẩy lên Notion.

🧠 Hermes-like Features

Hermes AgentSAP Daily Learner
MCP IntegrationPlugin dùng MCP SAP (Core). Hermes MCP không bắt buộc — xem khung optional phía trên
Automated Skill CreationTự sinh skills/user-skills/ từ câu trả lời phức tạp
Skill Reusability (team-shared)Đồng bộ 2 chiều qua Notion — tra trước khi tự giải, tự đẩy skill mới lên cho cả team dùng; cả 25 agent tư vấn cũng tra chung kho này qua Bước 5 của sap-ask-consultant
Quarantine → PromoteSkill dùng lại ≥3 lần trên Notion thành "ứng viên promote" — lệnh promote skill đưa vào reference/modules/ (git-tracked, đến mọi người dùng plugin), luôn hỏi xác nhận trước khi ghi, không tự commit
Persistent MemoryLEARNING_PROGRESS.md — module progress, mastered topics
Autonomous Curator 🆕skill_curator.py — skill không dùng tới 30 ngày thành stale, 90 ngày thành archived (không bao giờ xoá thật)
Cron Scheduling 🆕Cron thật qua Windows Task Scheduler + cron_manage.py — opt-in, mặc định TẮT (xem mục "Cron thật" bên dưới)
Multi-PlatformHoạt động trong Claude Code, dispatch qua sap-ask-consultant
Self-ImprovingCàng học càng nhiều skill, knowledge base càng phong phú; Curator tự dọn skill không còn dùng
Memory Consolidation3-tier memory: episodic (chat) + semantic (knowledge) + procedural (skills)
Training Data ExportExport LEARNING_PROGRESS + knowledge graph + skills làm training data

🧹 Skill Curator — vòng đời skill tự động

Skill tự tạo trong memory/procedural/skills/ càng tích luỹ càng dễ "chết" — không còn ai dùng nhưng vẫn nằm mãi. reference/scripts/skill_curator.py xử lý việc này, đúng cơ chế Curator của Hermes: skill không dùng tới sau 30 ngày chuyển stale, sau 90 ngày chuyển archived (di chuyển vào .archive/, không bao giờ xoá thật). Dùng lại 1 skill sẽ tự đưa nó về active. Chạy tự động mỗi khi sap-daily-learner được gọi — không cần setup gì thêm.

⏰ Cron thật — daily tip chạy nền qua Windows Task Scheduler

⚠️ Mặc định TẮT (opt-in tuyệt đối), cùng triết lý với Continuous Improvement Engine. Mỗi lần cron thật sự chạy sẽ gọi 1 phiên Claude Code (claude -p) thật — tốn chi phí API thật trên tài khoản của bạn. Cài xong vẫn chưa chạy gì cả cho tới khi bạn bật rõ ràng.

Khác Hermes bản gốc (có gateway daemon chạy liên tục, tự poll mỗi 60 giây): plugin này không có tiến trình nền thật — dùng Windows Task Scheduler làm "cái luôn túc trực" thay cho daemon đó.

Bước 1 — Cài lịch Task Scheduler (chưa chạy gì, cần quyền Administrator)

Click phải reference\scripts\install-daily-learner-cron.bat → Run as administrator

Sau khi cài, task sẽ tự "tick" mỗi 5 phút nhưng vẫn no-op (không làm gì) cho tới Bước 2.

Bước 2 — Bật opt-in thật sự

PowerShell Windows
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.sap-abap-agent\cron"
New-Item -ItemType File -Force -Path "$env:USERPROFILE\.sap-abap-agent\cron\ENABLED"
CMD Windows
if not exist "%USERPROFILE%\.sap-abap-agent\cron" mkdir "%USERPROFILE%\.sap-abap-agent\cron"
echo. > "%USERPROFILE%\.sap-abap-agent\cron\ENABLED"

Hoặc set biến môi trường hệ thống SAP_ABAP_AGENT_CRON_ENABLED=1 thay vì tạo file marker — 2 cách tương đương.

Bước 3 — Thêm ít nhất 1 job

⚠️ Prompt bắt đầu bằng / (gọi thẳng 1 skill) phải thêm qua PowerShell, không dùng Git Bash — đã xác nhận qua test thật: Git Bash tự "dịch" chuỗi bắt đầu bằng / thành đường dẫn Windows (MSYS path-mangling), làm hỏng nội dung prompt.
python reference\scripts\cron_manage.py add "$env:USERPROFILE\.sap-abap-agent" daily-tip "/sap-daily-learner cho toi 1 tip hoc SAP hom nay dua tren tien do hien tai" daily@08:00

Kiểm tra trạng thái / chi phí đã dùng

python reference/scripts/cron_manage.py status "$(python reference/scripts/agent_home.py)"

Kết quả tick được ghi vào <agent-home>/cron/pending/, rồi tự bơm vào phiên chat Claude Code kế tiếp khi bạn mở lên (SessionStart hook hooks/cron_deliver.py) — không có tích hợp Telegram/Slack như Hermes thật, nhưng không cần thêm thao tác nào.

Gỡ bỏ: schtasks /delete /tn "SAP ABAP Agent - Daily Learner Cron Tick" /f, xoá file ENABLED/cron_manage.py disable <job-id> là đủ.

📋 User Commands

LệnhKết quả
"hoc hom nay"Daily tip + đề xuất module học
"hoc [module]"Bắt đầu/bài tiếp theo của module
"progress" / "tien do"Hiển thị LEARNING_PROGRESS.md
"skill list"Liệt kê user skills đã tạo
"quiz [module]"Câu hỏi trắc nghiệm về module
"onboard [module]"Tạo learning path cho module mới
"tip"Random tip từ module user thích
"hom qua chung ta noi gi"Xem lại lịch sử chat hôm qua
"curator status"Skill nào đang active/stale/archived
"cron status"Job cron đang có, tổng chi phí API đã dùng

👥 Chia sẻ database "SAP Skills" cho team

Mời thêm người: (1) accept invite/mở link share Notion trước (thao tác tay), (2) người đó tự /mcp connect Notion bằng tài khoản của chính họ — không dùng chung tài khoản.

⚠️ Cơ chế tìm database hiện tại dựa theo tên — chưa test được với 1 tài khoản Notion thứ 2 liệu search có chắc chắn tìm ra database đã được share hay không. Nếu không tìm ra, Claude sẽ tự tạo 1 database "SAP Skills" mới, riêng, không báo lỗi — mất ý nghĩa dùng chung. Người mới nên tự bảo Claude "search notion database SAP Skills" trước, kiểm tra có ra đúng database cũ (có dữ liệu sẵn) hay không trước khi để daily-learner tự chạy lần đầu.

📚 Module Knowledge Matrix

18 module SAP với nội dung học theo 3 trình độ. Mỗi module có 5 topics cho mỗi level.

ModuleBeginnerIntermediateAdvanced
SDsales order, pricing, delivery, billing, customer mastercredit memo, rebate, availability check, output, EDIconsignment, stock transfer, SD-FI integration, revenue recognition, condition contract
FIGL, AP, AR, bank, business partnerasset, closing, tax, dunning, payment runconsolidation, special GL, document splitting, financial closing cockpit, IFRS vs local GAAP
MMPO, PR, GR, IR, material masterinventory, sourcing, contract, output, valuationstock transport, consignment, subcontracting, batch management, serial number
COcost center, internal order, activity type, primary cost, secondary costproduct costing, CO-PA, profit center, assessment, distributionmaterial ledger, actual costing, PCA, segment reporting, margin analysis
PPproduction order, BOM, routing, work center, MRPdiscrete mfg, REM, repetitive, capacity, kanbanPP/DS, variant configuration, MTO/ETO, production campaign, PI sheet
QMinspection lot, inspection plan, MIC, sample, usage decisionquality certificate, non-conformance, supplier eval, QM in procurementQM in production, QM integration PP-PI, audit management, stability study
PMmaintenance order, equipment, FL, notification, task listmaintenance plan, spare parts, maintenance schedule, costEAM, asset analytics, predictive maintenance, mobile maintenance, IoT integration
WMwarehouse, storage bin, TR, TO, stock placementpicking, putaway, cycle counting, physical inventoryEWM, yard management, VAS, RF, warehouse monitor
PSproject, WBS, network, milestone, budgetsettlement, RRB, availability control, cost planningresource-related billing, project portfolio, SAP PS-SD-PP integration, claim mgmt
HCMorg unit, position, employee master, PA, payrolltimesheet, TM, training, recruitingSuccessFactors integration, payroll control, OM, ESS/MSS
BWquery, report, KPI, data source, providercomposite provider, BW extractor, analytics, SACembedded analytics, CDS analytics, planning, BW bridge
Basisuser admin, role, transport, client, jobsystem admin, monitoring, Fiori admin, patchestenant management, BTP, IAS, SSE, cloud connector
TMfreight order, carrier, shipment, freight unitfreight agreement, rate, settlement, planningtransportation network, vehicle scheduling, TM-EWM integration, GTS integration
TRbank account, payment run, F110, bank statementcash management, liquidity, bank reconciliationtreasury, hedge management, debt management, SEPA
AribaAriba Network, sourcing, supplier, catalog, POcontract, invoicing, guided buying, approval workflowSAP Business Network, procurement integration, Ariba-MM integration, Ariba-FI integration
CAbusiness partner, DMS, output, number range, WFflexible workflow, forms, archiving, ILMBTP integration, CA-SD integration, CA-MM integration, document info record
GTScustoms, export, import, SPL, preferenceIntrastat, FTA, bonded warehouse, embargocompliance management, GTS-SD integration, GTS-MM integration, GTS-TM integration
EHShazardous sub, MSDS, waste mgmt, incident, PPEproduct safety, industrial hygiene, occupational healthEHS-PP integration, EHS-WM integration, EHS-MM integration, sustainability
IBPdemand planning, supply planning, S&OP, inventory optimizationtime series based forecasting, statistical forecasting, heuristicIBP response, optimizer, PP-DS integration, SAP IBP-SAC integration
EWMembedded EWM, warehouse structure, wave, labor mgmtEWM processes, putaway strategy, picking, VASEWM-SAP TM integration, kitting, cross-docking, value-added services
FioriFiori Launchpad, tiles, groups, catalog, roleFiori Elements, List Report, Object Page, SAP Buildfreestyle UI5, Fiori Tools, deployment, SAP Build Apps integration
CAPCAP project structure, CDS, service definitionCAP with Fiori UI, MTA deployment, side-by-side extensionCAP with SAP BTP, eventing, messaging, CI/CD pipeline
CPIiFlow, integration flow, adapter, OData/SOAPCPI mappings, XPath, Groovy, API ManagementCPI-BTP integration, event-driven architecture, B2B integration
SFEmployee Central, org structure, job, positiontalent management, recruiting, performance goalsSuccessFactors-CPI integration, compensation, LMS, RBP
BTP AdminBTP Cockpit, subaccount, Cloud Foundry, destinationKyma, entitlements, Cloud Connector, IASBTP security, CI/CD, multi-environment, SAP BTP-ABAP environment

📝 Daily Tip Templates

Mỗi ngày, Daily Learner gửi tip phù hợp với trình độ của bạn:

📘

Beginner

📘 SAP Tip hôm nay: [Module]
[Kiến thức cơ bản, 2-3 câu]

💡 Ví dụ ngắn · 🔍 Thử ngay: câu lệnh/Fiori app

📗

Intermediate

📗 SAP Deep Dive: [Module] > [Topic]
[Kiến thức nâng cao, 3-4 câu]

⚙️ Cấu hình SSCUI · 🔗 Module coupling

📕

Advanced

📕 SAP Expert: [Module] > [Advanced Topic]
[Kiến thức chuyên sâu]

🔄 Cross-module integration · ⚠️ Release-specific notes

🎯 Progressive Learning Paths

Beginner Path (cho người mới — 4 tuần):

Tuần 1: MM (procurement cơ bản) → Purchase Order → Goods Receipt → Invoice Receipt Tuần 2: SD (sales cơ bản) → Sales Order → Delivery → Billing Tuần 3: FI (kế toán cơ bản) → General Ledger → AP → AR Tuần 4: CO (controlling cơ bản) → Cost Center → Internal Order → Product Costing

Intermediate Path (cho người đã biết SAP):

  • Chọn 1 module chuyên sâu + 2 module liên quan
  • Ví dụ: MM advanced + FI (valuation) + SD (stock transport)
  • Ví dụ: PP advanced + MM (BOM/component) + QM (inspection)
  • Ví dụ: FI advanced + CO (cost center) + TR (cash management)

Expert Path (cho chuyên gia — cross-module integration):

🔄 Order-to-Cash (SD → FI → CO) 🔄 Procure-to-Pay (MM → FI) 🔄 Plan-to-Produce (PP → MM → QM) 🔄 Maintain-to-Close (PM → MM → FI → CO) 🔄 Project-to-Report (PS → SD → CO → FI) 🔄 Transport-to-Settle (TM → SD → FI)

🤖 Auto-Skill Creation Engine

Khi bạn giải quyết vấn đề SAP phức tạp, Daily Learner tự động tạo skill document nếu:

📐

≥ 3 bước

Vấn đề cần ít nhất 3 bước giải quyết — không phải câu trả lời đơn giản.

⚙️

Có cấu hình cụ thể

Có SSCUI / Fiori app / API cụ thể được đề cập trong giải pháp.

✅

User phản hồi tích cực

User nói "cảm ơn", "hữu ích", "got it" — xác nhận giải pháp đúng.

🔄

Không trùng lặp

Kiểm tra skills/sap-user-skills/ không có file tương tự trước khi tạo mới.

📚 CDS Knowledge Base (cds-kb-mcp)

skills/sap-cds-kb/SKILL.md — Tra cứu 7,355 CDS views released cho SAP S/4HANA Cloud Public Edition qua MCP server cds-kb-mcp (host remote, không cần cài local).

5 tools

ToolDùng khiVí dụ
search_cdsTìm CDS view theo business meaning/từ khóa SAPsearch_cds({ query: "overdue invoices", module: "FI" })
get_cds_viewLấy definition đầy đủ 1 view (metadata/fields/associations/source)get_cds_view({ name: "I_SalesDocument" })
get_views_by_tagLiệt kê view theo tag (bo:/lob:/module:) khi cần danh sách xác địnhget_views_by_tag({ tag: "bo:salesorder" })
get_taxonomyKhám phá bản đồ 12 Lines of Business → 829 Business Objectsget_taxonomy()
kb_infoKiểm tra bản build, số view, nguồn dữ liệu KBkb_info()

Module aliasing (dùng tên tự nhiên thay vì code SAP)

CodeTên tự nhiên
FIFinance
SDSales
MMProcurement
PPProduction
HRWorkforce
WMLogistics

💡 Lưu ý: CDS view không phải released API — chỉ là định nghĩa view. Luôn kiểm tra thêm trên api.sap.com nếu cần xác nhận 1 view có được phép dùng trong ABAP Cloud hay không. Dữ liệu được cache local (ETag-based), có thể out-of-date so với release mới nhất.

📖 SAP Docs Research (mcp-sap-docs)

skills/sap-docs-research/SKILL.md — Tra cứu tài liệu SAP tổng hợp qua MCP server mcp-sap-docs-btp: SAP Help, SAP Community, Accelerator Hub, Fiori App Reference Library, Clean Core Released Objects, ABAP feature matrix.

🔍

search / fetch

Tra cứu SAP Help Portal + offline docs (BM25 + semantic embeddings), rồi lấy chi tiết 1 document theo path.

💬

sap_community_search

Tìm SAP Community Q&A/blog cho lỗi thực tế hoặc SAP Note.

✅

sap_search_objects

Kiểm tra 1 class/interface/CDS view có được release cho ABAP Cloud không (Clean Core).

🧬

abap_feature_matrix

Kiểm tra 1 statement/feature ABAP hỗ trợ từ version nào (7.40/7.50/7.54...).

🌐

sap_accelerator_hub_*

Khám phá API/OData/SOAP/REST trên SAP API Business Hub.

📱

sap_fiori_library_*

Tra cứu Fiori app chuẩn — app ID, tile, semantic object, OData dependency.

💡 Lưu ý: SAP-API-HUB-KEY không bắt buộc (thiếu thì chỉ giới hạn sap_accelerator_hub_*). Offline docs có thể không phản ánh release mới nhất (SAP ra 4 bản/năm). sap_search_objects chỉ trả về released objects — không xuất hiện nghĩa là chưa release cho ABAP Cloud.

📝 SAP Notes MCP (mcp-sap-notes)

reference/mcp-guides/mcp-sap-notes.md — Tra cứu SAP Notes qua MCP server mcp-sap-notes bởi marianfoo. Tìm kiếm và đọc nội dung SAP Notes trực tiếp từ Claude Code.

Cài đặt

# Cài qua npm
npm install -g mcp-sap-notes

# Hoặc chạy trực tiếp
npx @marianfoo/mcp-sap-notes

Cấu hình Claude Code

claude mcp add --transport stdio sap-notes -- npx @marianfoo/mcp-sap-notes

Tools

ToolMô tả
search_sap_notesTìm SAP Notes theo từ khóa, component, version
get_sap_noteĐọc nội dung chi tiết 1 SAP Note (số hiệu)

💡 Hữu ích khi cần check SAP Note cho lỗi runtime, security patch, hoặc hướng dẫn cấu hình mới nhất.

🖥️ SAP GUI MCP (mcp-sap-gui)

reference/mcp-guides/mcp-sap-gui.md — Tự động hóa SAP GUI qua MCP. Điều khiển SAP GUI Windows để đọc dữ liệu, thao tác transaction, snapshot màn hình. (Hướng dẫn cài đặt tham chiếu từ agent sap-docs-researcher, không còn là skill tự trigger riêng.)

Cài đặt

# Cài qua uvx (khuyên dùng)
uvx mcp-sap-gui[screenshots]

# Hoặc pip
pip install mcp-sap-gui[screenshots]

Cấu hình Claude Code

# Tạo file .env với SAP GUI config
SAPGUI_USER=your_user
SAPGUI_PASS=your_pass
SAPGUI_CLIENT=100
SAPGUI_LANGUAGE=EN

# Đăng ký MCP server
claude mcp add --transport stdio sap-gui -- uvx mcp-sap-gui

Tools (57 tools)

ToolMô tả
gui_open_connectionMở kết nối SAP GUI
gui_run_transactionChạy transaction (/nVA01, /nMM03...)
gui_send_commandGửi lệnh /n, /o, /i
gui_read_tableĐọc dữ liệu từ ALV Grid
gui_fill_fieldĐiền giá trị vào field
gui_press_buttonNhấn button (F8, F3...)
gui_get_screenLấy screen info + fields

💡 Chạy uvx mcp-sap-gui lần đầu sẽ tự động cài SAP GUI Scripting API. Bảo mật: chỉ chạy trong session riêng, hỗ trợ blocklist field nhạy cảm.

🔧 ADT MCP Servers (3 options)

reference/mcp-guides/mcp-sap-adt.md — 3 lựa chọn MCP server cho SAP ADT (ABAP Development Tools) integration. Hỗ trợ đọc/ghi source ABAP trực tiếp từ ADT. (Hướng dẫn cài đặt tham chiếu từ agent sap-docs-researcher, không còn là skill tự trigger riêng.)

Option 1: SAP Official MCP Server (GA Q2 2026)

MCP server chính thức từ SAP, shipped với ADT. Tích hợp sẵn trong SAP Business Application Studio và ADT.

# Cài đặt qua SAP BTP
npm install -g @sap/adt-mcp-server

# Cấu hình
claude mcp add --transport stdio sap-adt -- @sap/adt-mcp-server --url <ADT_URL>

Option 2: ARC-1 (Enterprise MCP cho ADT)

arc-mcp/arc-1 — Enterprise-grade MCP bridge cho ADT, hỗ trợ ABAP Cloud development workflow.

# Cài qua pip
pip install arc-mcp

# Cấu hình
claude mcp add --transport stdio arc-adt -- arc-mcp-adt

Option 3: mcp-abap-adt (cộng đồng)

mario-andreschak/mcp-abap-adt — MCP server mã nguồn mở cho ADT, 7 tools cốt lõi.

# Cài qua npm
npx @mario-andreschak/mcp-abap-adt

# Cấu hình
claude mcp add --transport stdio abap-adt -- npx @mario-andreschak/mcp-abap-adt

So sánh 3 options

Tính năngSAP OfficialARC-1mcp-abap-adt
Bảo trìSAP (chính thức)ARC (enterprise)Cộng đồng
ADT objectsFullĐầy đủCơ bản
ABAP CloudFull supportFull supportCơ bản
Cài đặtnpmpipnpx

👥 SuccessFactors MCP (mcp-sap-successfactors)

reference/mcp-guides/mcp-sap-successfactors.md — 2 options de tich hop SAP SuccessFactors voi AI assistant: sf-mcp (open-source, 62+ tools) va CData SF MCP (SQL-based read-only). (Hướng dẫn cài đặt tham chiếu từ agent sap-docs-researcher, không còn là skill tự trigger riêng.)

Option 1: sf-mcp (Open-source, khuyen dung)

# Yeu cau: Python 3.10+, uv package manager
git clone https://github.com/aiadiguru2025/sf-mcp.git
cd sf-mcp
uv sync

Cau hinh

claude mcp add --transport stdio sf-mcp -- uv --directory /path/to/sf-mcp run main.py

Tools (62+ tools)

ToolMo ta
get_employee_infoTra cuu thong tin nhan vien theo ID
search_employeesTim nhan vien theo criteria (name, department...)
get_org_structureLay so do to chuc cong ty
get_time_off_balanceKiem tra ngay nghi con lai cua nhan vien
get_role_permissionsKiem tra RBP permissions cua nhan vien

💡 Option 2: CData SF MCP (Java-based, SQL read-only, can CData JDBC driver license). Xem chi tiet trong reference/mcp-guides/mcp-sap-successfactors.md.

✈️ SAP Concur MCP (mcp-sap-concur)

reference/mcp-guides/mcp-sap-concur.md — CData SAP Concur MCP Server cho phep query Travel & Expense data (expense reports, travel requests, bookings, vendors) qua SQL. Read-only, Java-based.

Cai dat

# Yeu cau: Java 11+, Maven
git clone https://github.com/CDataSoftware/sap-concur-mcp-server-by-cdata.git
cd sap-concur-mcp-server-by-cdata
mvn clean install

Cau hinh

claude mcp add --transport stdio sap-concur -- java -jar /path/to/CDataMCP-jar-with-dependencies.jar /path/to/sap-concur.prp

Tools

ToolMo ta
concur_get_tablesLiet ke cac bang SAP Concur instance
concur_get_columnsLiet ke columns cua 1 table
concur_run_queryThuc thi SQL SELECT query

💡 Yeu cau CData JDBC Driver for SAP Concur (trial available). Query expense reports, travel requests, bookings, vendor data truc tiep tu AI.

🛠️ Fieldglass MCP (mcp-sap-fieldglass)

reference/mcp-guides/mcp-sap-fieldglass.md — CData SAP Fieldglass MCP Server cho phep query Services Procurement data (contingent workforce, SoW, timesheets, invoices) qua SQL. Read-only, Java-based.

Cai dat

# Yeu cau: Java 11+, Maven
git clone https://github.com/CDataSoftware/sap-fieldglass-mcp-server-by-cdata.git
cd sap-fieldglass-mcp-server-by-cdata
mvn clean install

# License JDBC Driver
java -jar cdata.jdbc.sapfieldglass.jar --license

Cau hinh

claude mcp add --transport stdio sap-fieldglass -- java -jar /path/to/CDataMCP-jar-with-dependencies.jar /path/to/sap-fieldglass.prp

Tools

ToolMo ta
fieldglass_get_tablesLiet ke cac bang SAP Fieldglass instance
fieldglass_get_columnsLiet ke columns cua 1 table
fieldglass_run_queryThuc thi SQL SELECT query

💡 Yeu cau CData JDBC Driver for SAP Fieldglass (trial available). Query contingent workforce, Statement of Work, timesheets, invoices truc tiep tu AI.

🧭 Service Type Context (sap-service-type-context)

reference/process/sap-service-type-context.md — Xác định hệ thống đang làm việc là s4hc_(private) / s4hc_(public) / btp / onprem bằng cách đọc profiles/<id>/config.json của mcp-sap-connect (offline, không gọi MCP, không đụng secret) — hỏi user nếu chưa xác định được — trước khi trả lời câu hỏi bị ảnh hưởng bởi edition.

So sánh nhanh theo Service Type

Khía cạnhs4hc_(public)s4hc_(private)onprembtp
Đọc dữ liệuChỉ released CDS/APIƯu tiên released, dev on-stack có thể sâu hơnSELECT bảng chuẩn trực tiếp bình thườngKhông đụng core trực tiếp — luôn gọi qua API dù core là edition nào
ExtensibilitySSCUI + Key User + Developer(3-system) + side-by-sideLadder tương tự nhưng on-stack rộng hơn, có thể còn BAdI/exit classic tùy compat scopeToàn bộ classic: SPRO/IMG, user-exit, BAdI classic, enhancement pointChỉ có side-by-side (chính nó là 1 bậc trong ladder)
Cú pháp ABAP Cloud bị cấmBắt buộcTùy compat scope dự án chọnKhông áp dụng trừ khi tự nguyện theoBắt buộc
Landscape mặc định2-systemThường 3-system trở lênThường 3-system trở lênRiêng, không áp dụng
ATC / released-API checkBắt buộc strictCó nhưng ít strict hơnKhông cần trừ khi muốn cloud-readyBắt buộc
SSCUI/Fiori app cụ thể (tư vấn module)ĐúngSSCUI vẫn có nhưng nhiều phần dùng classic transaction/SPRO song songĐa số là transaction code/SPRO, không phải SSCUIKhông áp dụng (không có UI nghiệp vụ riêng)

⚠️ Không đổi theo edition: quy ước namespace Z/Y áp dụng cho mọi edition kể cả on-premise — không phải đặc thù ABAP Cloud.

Cách xác định (offline, không cần hệ thống đang sống)

Đọc thẳng profiles/<id>/config.json (field không nhạy cảm — secret nằm riêng ở secrets.json đã mã hóa) thay vì gọi sap_ping: rẻ hơn (không round-trip mạng), không phụ thuộc hệ thống SAP đang sống hay không.

python "${CLAUDE_PLUGIN_ROOT}/reference/scripts/detect_service_type.py"
sourceÝ nghĩaHành động
configĐã có giá trị service user xác nhận lúc setupDùng thẳng, không hỏi lại
config_defaultConfig tồn tại nhưng thiếu/sai field serviceHỏi lại user xác nhận
not_configuredChưa từng chạy mcp-sap-connect setupHỏi thẳng user (giữ nguyên taxonomy 4 nhánh)

💡 Tích hợp: sap-routing-discipline trỏ tới skill này trước khi trả lời câu hỏi bị ảnh hưởng bởi edition; sap-ask-consultant/sap-extensibility/sap-clean-code/sap-abap-sql đọc kết quả để rẽ nhánh hoặc chèn cảnh báo thay vì mặc định Public Edition.

🧹 Clean Code & Name Conversion

skills/sap-clean-code/SKILL.md — Naming conventions & clean code cho ABAP Cloud (Public Cloud), kèm hướng dẫn chuyển đổi từ legacy ABAP.

Quy tắc bắt buộc

  • Mọi development object customer tạo bắt buộc bắt đầu bằng Z/Y (hoặc namespace /prefix/ đã đăng ký với SAP).
  • Giới hạn 30 ký tự cho mọi development object (class, CDS view, data element...).
  • ABAP chỉ hỗ trợ ASCII — không dùng tiếng Việt có dấu trong tên.
  • Bỏ Hungarian notation hoàn toàn (thay đổi lớn nhất so với legacy ABAP).

Bỏ Hungarian notation

Tiền tốLegacyABAP Cloud
Local variablelv_namename
Structurels_addressaddress
Tablelt_usersusers (số nhiều)
Import paramiv_matnrmaterial_number
Returning paramrv_resultresult
Field symbol<fs_entry><entry>

CDS View — 5 layer VDM (Virtual Data Model)

LayerPrefixVai trò
Interface ViewZ_I_Đọc trực tiếp từ database table — single source of truth
Consumption ViewZ_C_Build trên Interface View, tối ưu cho OData/Fiori/analytics
Extension ViewZ_X_Thêm field/logic vào standard SAP view
Projection ViewZ_P_Giới hạn field/association cho 1 BO context (RAP)
Abstract EntityZ_A_Không map database — kiểu dữ liệu cho RAP actions/functions

Released API — quy tắc bắt buộc (Clean Core)

ABAP Cloud không thể gọi trực tiếp unreleased API — trình biên dịch sẽ báo lỗi. Kiểm tra API State trong ADT (🟢 Released / 🟡 Deprecated / 🔴 Unreleased) trước khi dùng bất kỳ class/BAPI/function module nào. Nếu bắt buộc phải dùng unreleased API, tạo wrapper class đánh dấu @deprecated thay vì gọi trực tiếp.

🧩 Extensibility Ladder & ABAP Cloud Constraints

skills/sap-extensibility/SKILL.md — Xác định nên đặt custom logic ở đâu (SSCUI/Key User/side-by-side BTP) và ràng buộc cú pháp ABAP Cloud.

4 bậc thang Extensibility (luôn đánh giá từ trên xuống)

  1. Cấu hình chuẩn qua SSCUI — chỉ là 1 switch/setting SAP có sẵn.
  2. Key User Extensibility (in-app, không cần dev) — Custom Fields and Logic, Custom Business Objects, Custom Logic (Cloud BAdI), Adaptation Transactions.
  3. Developer Extensibility (on-stack) — chỉ có trên 3-system landscape, vẫn chỉ dùng released API/extension point.
  4. Side-by-side trên BTP — hệ thống/runtime riêng (BTP ABAP Environment/RAP), gọi ngược lại core qua released API.

⚠️ Nguyên tắc fail-fast: nếu 1 yêu cầu không khớp bậc nào trong 4 bậc trên — không bịa ra cách làm không tồn tại, nói thẳng là chưa làm được.

Cú pháp bị cấm trên ABAP Cloud

NhómKhông được dùngDùng thay bằng
Màn hìnhDynpro (CALL SCREEN...)Fiori Elements / RAP
DB accessEXEC SQL, SELECT ... CLIENT SPECIFIEDKhông có
DebugBREAK-POINTADT Debugging
Ngày/giờ hệ thốngsy-datum, sy-uzeitcl_abap_context_info=>get_system_date/time( )
Số họcADD, SUBTRACT...+, -, *, /

📁 2-system vs 3-system landscape: đa số khách hàng Public Cloud là 2-system (chỉ Key User + side-by-side); 3-system có thêm Development tenant → mở khóa Developer Extensibility. Khi không chắc, mặc định giả định 2-system.

🛠️ Key User Toolkit

skills/sap-key-user-toolkit/SKILL.md — Hướng dẫn thực hành Key User Extensibility (bậc 2 trong thang extensibility) — tự làm không cần developer.

4 tác vụ hay gặp nhất

Tác vụFiori appMô tả
Custom FieldCustom Fields and LogicThêm field vào business object/report/UI chuẩn — giới hạn 30-50 field/BO tùy loại
Custom LogicCustom Fields and Logic → tab Custom LogicValidation (chặn save) / Determination (tự điền giá trị) — cú pháp "ABAP for Key Users" đơn giản hóa
Custom Business ObjectCustom Business ObjectsTạo BO mới hoàn toàn — tự động có OData API CRUD + Fiori UI cơ bản
Adaptation TransactionsAdapt UIẨn/hiện/đổi nhãn/di chuyển field trên Fiori app có sẵn — không thêm được field/button mới

Quy trình release (2-system landscape)

Tạo/sửa trên Customizing tenant → test bằng test plan SAP → Export Software Collection → Import Software Collection vào Production → Activate → verify bằng user thật.

⚠️ Lưu ý: sau khi publish, custom field không thể xóa, chỉ có thể tắt qua Usage. Đặt tên nhất quán theo prefix (YY_/Z_) để tránh trùng với extension của team khác trong cùng tenant.

🔌 SAP BTP Setup Helper (multi-profile)

skills/sap-btp-setup/SKILL.md — Setup & xử lý sự cố kết nối SAP BTP qua MCP, hỗ trợ nhiều project SAP cùng lúc (multi-profile).

Thêm project mới chỉ 1 lệnh: mcp-sap-connect setup https://project1.s4hana.cloud.sap — wizard tự sinh profile, hỏi phương thức xác thực.

4 phương thức xác thực

#ModeKhi nào dùng
1OAuth2 (client_credentials)Mặc định/khuyến dùng — đã có client_id + client_secret
2PasswordCó tài khoản SAP đăng nhập trực tiếp
3Bearer tokenĐã có access token sẵn
4Cookie-basedĐã đăng nhập SAP GUI/Fiori/SSO sẵn — tự động re-auth qua browser popup khi hết hạn

13 MCP tools

sap_list_profiles, sap_ping, sap_list_packages, sap_search, sap_read_source, sap_syntax_check, sap_activate, sap_find_where_used, sap_execute_query, sap_run_unit_tests, sap_get_system_info, sap_analyze_dump — mỗi tool đều nhận tham số profile (để trống = active).

💡 Xử lý sự cố nhanh: lỗi 'mcp-sap-connect' is not recognized (Windows, hay gặp nhất) → chạy python -m mcp_sap_connect.doctor để tự phát hiện và lấy lệnh fix PATH.

📄 Doc to Markdown (Word/Excel → .md)

skills/sap-doc-to-md/SKILL.md — Convert file Word (.docx)/Excel (.xlsx/.xls) sang Markdown để làm ngữ cảnh cho AI đọc hiểu tài liệu nghiệp vụ (Functional Spec, Business Process...) và hỗ trợ sinh code/logic ABAP.

📝

.docx → markitdown CLI

Đơn giản, đủ dùng cho text + bảng: markitdown "in/file.docx" -o "out/file.md". Ảnh minh họa sẽ không render được (data URI bị cắt bỏ).

📊

.xlsx/.xls → script riêng

Không dùng markitdown trực tiếp — đã kiểm chứng markitdown/pandas làm mất số 0 đứng đầu (Material SAP dạng số). Dùng reference/scripts/office_to_md.py (đã fix bằng dtype=str).

🖼️

Cần giữ ảnh minh họa?

Cùng dùng reference/scripts/office_to_md.py — trích xuất ảnh thật (kể cả EMF screenshot) ra thư mục <tên-file>_assets/ thay vì bị lược bỏ.

⚠️ Lưu ý quan trọng: mã nghiệp vụ SAP (Material, Plant, Order...) thường có số 0 đứng đầu — luôn đối chiếu vài mã sau khi convert Excel để chắc chắn không bị đổi định dạng số.

📋 Released ABAP Classes (sap-released-classes)

skills/sap-released-classes/SKILL.md — Catalog cac ABAP Cloud released classes va APIs. Nguon tham khao nhanh de tra cuu class/interface co san cho ABAP Cloud development.

🔑

UUID & Identifier

cl_uuid_factory, cl_system_uuid, if_system_uuid, cl_abap_conv_in_ce

📧

Email & Communication

cl_bcs_mail_message, cl_cos_utilities, if_abap_serializability

🔒

Encryption & Security

cl_sec_salted_hash, cl_hashing_utils, cl_abap_hmac, key derivation via scrypt

🗃️ ABAP SQL & AMDP (sap-abap-sql)

skills/sap-abap-sql/SKILL.md — ABAP SQL nang cao: Window Functions, CTE, AMDP, performance patterns, CDS Table Function. Cac cau truy van bi cam tren ABAP Cloud.

📊

Window Functions

ROW_NUMBER, RANK, LEAD, LAG, SUM OVER — phan tich du lieu theo partition

🔗

CTE

Common Table Expression (WITH + AS) de recursive queries va temporary result sets

⚡

AMDP

ABAP-Managed Database Procedures — native SQL trong class method, HANA-specific optimization

🔌 Cloud BAdI Enhancement (sap-badi-enhancement)

skills/sap-badi-enhancement/SKILL.md — Cloud BAdI architecture: BAdI definition, BAdI implementation, enhancement spot, Custom Logic (Key User), BAdI filtering.

🏗️

BAdI Architecture

Business Add-In (BAdI) definition & implementation trong ABAP Cloud. Khac biet so voi classic BAdI (SE18/SE19) va BTE.

🧩

Custom Logic

Key User Extensibility qua Custom Logic — cau hinh BAdI khong can dev, Fiori app "Custom Fields and Logic"

🔍

Filtering & Context

BAdI filtering (on-premise vs cloud), context parameter, multi-implementation sorting

🛡️ Authorization & DCL (sap-authorization)

skills/sap-authorization/SKILL.md — ABAP Cloud authorization concept: DCL (Data Control Language), RAP instance-based authorization, IAM App, Business Role.

🔐

DCL

Data Control Language — access rule tren CDS view, mapping authorization object to CDS condition

👤

IAM App

Identity & Access Management: IAM App definition, Business Catalog, Business Role, authorization default values

🔑

RAP Authorization

Instance-based authorization trong RAP BO: authorization master, authorization dependency, global authorization

🔄 Cloud Migration (sap-cloud-migration)

skills/sap-cloud-migration/SKILL.md — Huong dan 5-buoc migration tu ECC on-premise len S/4HANA Cloud: ATC check, replacement strategy, modification adjustment, custom code migration.

🔎

ATC Check

ABAP Test Cockpit — quet toan bo custom code de phat hien su dung API/cu phap khong tuong thich ABAP Cloud

🔄

Replacement Strategy

Tim replacement cho custom code: released API, wrapper class, key user extensibility, side-by-side extension

📦

User Exit Migration

Migration user exits/enhancements sang Cloud BAdI hoac side-by-side extension tren BTP

🌐 OData Service (sap-odata-service)

skills/sap-odata-service/SKILL.md — RAP-based OData V4 service: service definition, service binding, OData metadata, ETag, deep insert, function import, action.

📡

Service Definition

Define OData service trong RAP: expose entity set, projection, function import, action

🔗

Service Binding

UI5 binding, Web API binding, OData V2/V4 protocols, endpoint URL convention

🔄

Deep Insert & ETag

Deep insert (tao BO cha + con trong 1 request), ETag concurrency control, draft handling

📨 RAP Business Events (sap-rap-events)

skills/sap-rap-events/SKILL.md — RAP business events: event definition, event metadata, event publishing, event consumption, Cloud Events format, SAP Event Mesh integration.

📣

Event Definition

Define business events trong RAP behavior definition: on modify trigger, event metadata extension

📤

Event Publishing

Publish event tu RAP BO: raise event trong behavior implementation, event parameters, CloudEvents format

🔗

Event Mesh

SAP Event Mesh integration: channel, queue, topic, webhook consumer, outbound/inbound event binding

☁️ Steampunk / BTP ABAP (sap-steampunk-cloud)

reference/modules/sap-steampunk-cloud/SKILL.md — BTP ABAP Environment (Steampunk) infrastructure: package structure, ADT, IAM, git-based CI/CD, Cloud Foundry deployment, MTA. (Tài liệu tham chiếu cho agent sap-btp-admin-consultant-cloud, không còn là skill tự trigger riêng.)

🏗️

Package Structure

BTP ABAP package convention: namespace /CUSTOMER/, structure separation, software component

🔧

ADT & CI/CD

ABAP Development Tools, git-based CI/CD pipeline, abapGit, software assembly, gCTS (optional)

☁️

Cloud Foundry

Deployment tren CF: MTA archive, manifest.yml, service binding, environment variables, app router

🔗 BTP Connectivity (sap-btp-connectivity)

reference/modules/sap-btp-connectivity/SKILL.md — Cloud Connector, destination configuration (Basic, OAuth2SAMLBearer, PrincipalPropagation), RFC/BAPI access tu BTP to S/4HANA on-prem.

🔌

Cloud Connector

Cai dat & cau hinh Cloud Connector: access control, virtual host/mapping, role assignment, backend type

🌐

Destination

SAP BTP destination: URL, auth type, proxy type (OnPremise/Internet), Additional Properties, trust store

🔄

Principal Propagation

Principal propagation tu BTP → S/4HANA: certificate exchange, user mapping, SAML2 Bearer Assertion

✅ BTP Best Practices (sap-btp-best-practices)

reference/modules/sap-btp-admin-cloud/deep/SKILL.md — BTP development conventions: account structure, naming conventions, MTA, security, CI/CD setup, CAP best practices, logging/monitoring.

🏗️

Account Structure

Subaccount organization: dev/test/prod separation, entitlements, quota, service instance management

📦

MTA & CI/CD

Multi-target application (MTA) deployment: mtad.yaml, module types, resource binding, CI/CD pipeline via GitHub Actions

🔒

Security

XSUAA security: role template, role collection, scope, attribute check, credential-type mapping, app router security

🏗️ Codegen Pipeline — Function Spec → ABAP code

7 skill nối tiếp nhau, biến 1 file Function Spec (.docx khách hàng gửi) thành code ABAP scaffold theo chuẩn RAP/CDS. File trung gian đặt trong in//out/ — thư mục local per-user, không nằm trong git repo: %USERPROFILE%\.mcp-sap-connect\in\ + ...\out\ (Windows) hoặc ~/.mcp-sap-connect/in/ + .../out/ (macOS/Linux) — cùng nơi lưu profile/secrets kết nối SAP BTP. Lý do: tài liệu FS và output sinh ra là dữ liệu nghiệp vụ/khách hàng, không nên nằm chung với source code plugin.

┌─────────────────────────────────────────────────────────┐ │ 📄 FS.docx (Function Spec khách hàng gửi) │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ [0] sap-doc-to-md → out/<file>.md │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ [1] sap-analyze-function-spec → INTAKE.md │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ [2] sap-write-technical-spec → TECHNICAL_SPEC.md │ └──────────────────────┬──────────────────────────────────┘ ┌────────┴─────────┐ ▼ ▼ ┌────────────────────────┐ ┌────────────────────────┐ │ [3a] sap-scaffold-rap │ │ [3b] sap-scaffold-cds │ │ (có CRUD/RAP) │ │ (chỉ-read) │ └────────────┬───────────┘ └───────────┬────────────┘ └─────────┬──────────────┘ ▼ ┌─────────────────────────────────────────────────────────┐ │ [4] sap-atc-review → ATC_REVIEW.md (naming/API/lint) │ └──────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────┐ │ [5] sap-unit-test → ABAP Unit test class │ └─────────────────────────────────────────────────────────┘

Bước nào làm gì

#SkillInput → OutputLàm gì
0sap-doc-to-mdFS.docx → FS.mdConvert Word sang Markdown (bảng/heading giữ nguyên) để AI đọc được nội dung FS.
1sap-analyze-function-specFS.md → INTAKE.mdChuẩn hoá yêu cầu thành 8 mục cố định, đánh dấu field thiếu "Nguồn", liệt kê câu hỏi cần làm rõ (mục 6), đánh giá mức rủi ro (Tiny/Normal/High-risk).
2sap-write-technical-specINTAKE.md → TECHNICAL_SPEC.mdÁp decision tree chọn pattern (class thường / 3-layer CDS / RAP managed / RAP unmanaged), tìm CDS-API nguồn qua agent consultant phân hệ, liệt kê object cần tạo + test plan.
2.5sap-bootstrap-system-context + sap-deployment-targetMCP ADT → system-context.md (cache)(Gate an toàn) Dò hệ thống ABAP thật qua MCP trước khi scaffold lần đầu trên 1 hệ thống lạ — lấy đúng quy ước đặt tên/field admin đang dùng, đồng thời xác nhận package deploy + rào chắn Z/Y trước khi tạo object thật.
2.6sap-cloud-dictionaryTECHNICAL_SPEC.md → Domain/Data Element/TableTạo Domain, Data Element, Database Table (hoặc CDS Table Entity) bằng cú pháp source-code ABAP Cloud (define domain/data element/table) trước khi scaffold CDS/RAP ở bước sau.
3asap-scaffold-rapTECHNICAL_SPEC.md → src/ (RAP)Sinh skeleton RAP 3-layer (I→R→C) khi pattern cần CRUD — kèm 7 gotcha BDEF đã verify thực tế (comment syntax, field control, numbering UUID, action con...).
3bsap-scaffold-cdsTECHNICAL_SPEC.md → src/ (CDS)Sinh CDS view (interface/consumption/MDE) khi pattern chỉ-read — kèm annotation reference + 6 gotcha activate CDS.
3csap-scaffold-cds-analyticsTECHNICAL_SPEC.md → src/ (Analytics)Sinh CDS Cube/Dimension/Text + Analytical Query khi cần báo cáo aggregate/multi-dimensional — ưu tiên build Analytical Query trên CDS/Cube đã released trước khi tự tạo Cube từ đầu.
4sap-atc-reviewsrc/ → ATC_REVIEW.mdLint naming Z*, released API, clean ABAP, test coverage — kèm bảng anti-rationalization (bắt lỗi "cắt góc").
5sap-unit-testsrc/ → *.clas.testclasses.abapSinh ABAP Unit test class cho method/action/validation đã scaffold.
5bsap-cds-unit-testsrc/ → *.clas.testclasses.abap (CDS)Test CDS view/RAP BO qua Test Double Framework (CL_CDS_TEST_ENVIRONMENT...) khi cần mock data nguồn thay vì đâm vào DB thật.

🔗 Skill phụ trợ sap-virtual-element (calculated field trong CDS) dùng bổ sung ở bước 3 khi cần field tính runtime. Quy ước đặt tên & bậc thang extensibility dùng chung với Clean Code & Naming / Extensibility Ladder. 🔗 Có sẵn SEGW OData V2 cần nâng cấp? Dùng sap-migrate-segw-to-rap để reverse-engineer sang RAP thay vì scaffold lại từ đầu.

🎯 Quy trình theo mục tiêu đầu ra: Báo cáo / API / Form

Cùng xuất phát từ 1 file FS.docx/Excel, nhưng đầu ra khác nhau (báo cáo, API, form Fiori) thì rẽ nhánh skill khác nhau ở giữa pipeline. Làm đúng theo thứ tự 1 trong 3 quy trình dưới đây — không bỏ bước (*) trừ khi ghi rõ "tuỳ chọn" — là ra đủ end-to-end, không cần tự suy luận thêm bước nào.

💡 Bước 2a/2b (sap-ask-consultant) xuất hiện trong cả 3 quy trình dưới đây — đây là chỗ 2 "AI" trao đổi với nhau: 1 bên viết Technical Spec, 1 bên là chuyên gia nghiệp vụ theo phân hệ (SD/FI/MM/...). Mục đích: giảm lỗi chọn sai CDS view/field/object do chỉ dựa vào suy luận kỹ thuật thuần, không có góc nhìn nghiệp vụ thật — hỏi 1 lần để chọn nguồn, xác nhận lại 1 lần trước khi chốt.

🔒 Bước 2c (sap-deployment-target) hỏi 1 lần duy nhất xem deploy vào package nào trên hệ thống thật (có sẵn hoặc tạo mới package Z), rồi tái sử dụng cho toàn bộ pipeline — tránh phải hỏi lại nhiều lần giữa chừng. Từ bước này trở đi, quy tắc cứng áp dụng xuyên suốt: không bao giờ tạo/sửa/xoá object ngoài namespace Z/Y hoặc ngoài package đã xác nhận; chỗ nào cần thao tác thủ công (approve transport, đăng nhập, activate khi chưa nối MCP...) thì dừng lại, mô tả rõ việc cần làm, và chỉ tiếp tục sau khi có xác nhận từ người dùng. Cách xác minh package ở Bước 2c cũng khác nhau theo chế độ tích hợp: có MCP ADT thì verify tồn tại + đúng namespace customer qua tool thật; không có MCP (ví dụ workflow abapGit clone-về-local) thì hỏi user xác nhận trực tiếp, ghi rõ trong TECHNICAL_SPEC.md là "chưa verify tự động" để sap-finish-ticket đối chiếu lại sau. Ở chế độ không-MCP, hàng rào kỹ thuật (hook chặn tool MCP) cũng không phủ được thao tác ghi file abapGit local — kỷ luật hỏi-xác-nhận này là tuyến phòng thủ duy nhất.

Bước 0
sap-doc-to-md
FS.docx/xlsx → FS.md
↓
Bước 1
sap-analyze-function-spec
FS.md → INTAKE.md
↓
Bước 2
sap-write-technical-spec
→ TECHNICAL_SPEC.md (gồm 2a/2b — sap-ask-consultant hỏi rồi xác nhận lại CDS nguồn)
↓
Bước 2c · bắt buộc
sap-deployment-target
Chọn package deploy + bật rào chắn an toàn Z/Y (verify qua MCP hoặc user tự xác nhận nếu không có MCP)
↓
Bước 2.5* / 2.6* · tuỳ chọn
sap-bootstrap-system-context / sap-cloud-dictionary
Dò hệ thống thật / tạo Domain-Data Element-Table nếu cần
↓
Rẽ nhánh theo mục tiêu đầu ra ▾
🅰️ Báo cáo
Bước 3
sap-scaffold-cds / -cds-analytics
List/detail hoặc KPI/Cube
↓
Bước 4-5
sap-atc-review · sap-cds-unit-test
↓
Bước 6
sap-finish-ticket
↓
📊 Báo cáo (Fiori List/Analytical)
🅱️ API
Bước 3
sap-scaffold-rap
Table → CDS → Behavior → Service
↓
Bước 4-5
sap-odata-service · sap-authorization
↓
Bước 6*/7* · tuỳ chọn
sap-rap-events / sap-badi-enhancement
↓
Bước 8-9
sap-atc-review · sap-unit-test + sap-cds-unit-test
↓
Bước 10
sap-finish-ticket
↓
🔌 API (OData V4)
🅲️ Form chức năng
= toàn bộ nhánh API (bước 3-9), giữ bước 10 lại đến cuối
Bước 11
Fiori Elements / Freestyle UI5
Tư vấn: sap-fiori-consultant-cloud (annotation, Adaptation, Launchpad)
↓
Bước 12
sap-finish-ticket
Chạy sau cùng, khi cả API lẫn UI đều xong
↓
🖥️ Form (Fiori app CRUD)

🅰️ Báo cáo (list/detail hoặc KPI dashboard)

#SkillInput → OutputLàm gì
0sap-doc-to-mdFS.docx/xlsx → FS.mdConvert Word/Excel sang Markdown để AI đọc được nội dung.
1sap-analyze-function-specFS.md → INTAKE.mdChuẩn hoá yêu cầu thành 8 mục cố định, đánh dấu field thiếu nguồn, liệt kê câu hỏi cần làm rõ.
2sap-write-technical-specINTAKE.md → TECHNICAL_SPEC.mdChọn pattern: "3-layer CDS" (list/detail đơn giản) hay "CDS Analytics" (KPI/multi-dimensional).
2asap-ask-consultant→ CDS/field nguồn theo phân hệBên trong bước 2: dispatch tự động tới đúng agent tư vấn phân hệ (SD/FI/MM/...), kể cả nhiều phân hệ cùng lúc (module coupling) — hỏi "CDS view/field nào chuẩn cho nghiệp vụ này". KHÔNG tự đoán CDS view khi chưa hỏi domain expert.
2bsap-ask-consultantDanh sách object dự kiến → xác nhậnBên trong bước 2: sau khi liệt kê xong field/object, gửi lại danh sách cụ thể cho cùng consultant xác nhận lần 2 — "đúng nghiệp vụ chưa, thiếu/thừa field gì" — trước khi chốt TECHNICAL_SPEC.md. Đây là bước 2 AI trao đổi với nhau để bắt lỗi sai mục đích trước khi scaffold code thật.
2csap-deployment-target→ package deploy + rào chắn an toànHỏi user deploy vào package nào (có sẵn hoặc tạo mới package Z) — bắt buộc, chạy 1 lần rồi tái sử dụng xuyên suốt. Từ đây tuyệt đối không tạo/sửa/xoá object ngoài Z/Y hoặc ngoài package đã xác nhận. Có MCP thì verify package thật qua ADT; không có MCP (vd abapGit clone-về-local) thì hỏi xác nhận trực tiếp, ghi rõ "chưa verify tự động" để đối chiếu sau.
2.5*sap-bootstrap-system-contextMCP ADT → system-context.md(Tuỳ chọn) Hệ thống lạ, chưa biết quy ước đặt tên/field admin thật đang dùng.
2.6*sap-cloud-dictionary→ Domain/Data Element/Table(Tuỳ chọn) Chỉ khi báo cáo cần bảng/field hoàn toàn mới (custom fact table), chưa có CDS nguồn nào dùng được — tự kiểm tra reuse trước (Bước 0 của skill này) trước khi tạo mới.
3sap-scaffold-cds hoặc sap-scaffold-cds-analyticsTECHNICAL_SPEC.md → src/List/detail đơn giản dùng sap-scaffold-cds; KPI/aggregate/dashboard dùng sap-scaffold-cds-analytics (Cube/Dimension/Query).
3b*sap-virtual-element→ field tính runtime(Tuỳ chọn) Field tính toán phức tạp (gọi API, lookup, format đặc biệt) không viết được bằng CDS expression thuần.
4sap-atc-reviewsrc/ → ATC_REVIEW.mdLint naming Z*, released API, clean ABAP.
5sap-cds-unit-testsrc/ → *.testclasses.abapTest CDS view bằng Test Double Framework — mock data nguồn, không đâm vào DB thật.
6sap-finish-ticket→ đóng ticketActivate hết, ATC PASS, test xanh, transport sẵn sàng, abapGit push.

💡 Xem trên Fiori Elements (List Report/Analytical List Page) tự sinh từ CDS + annotation — không cần code UI riêng, chỉ cần publish Service Definition/Binding ở bước 3 là đủ. Cần in PDF/xuất file thay vì xem online? Xem pattern @Semantics.largeObject trong sap-scaffold-rap.

🅱️ API (OData service cho hệ thống/app khác gọi, CRUD hoặc read-only)

#SkillInput → OutputLàm gì
0sap-doc-to-mdFS.docx/xlsx → FS.mdConvert Word/Excel sang Markdown để AI đọc được nội dung.
1sap-analyze-function-specFS.md → INTAKE.mdChuẩn hoá yêu cầu, đánh dấu field thiếu nguồn, liệt kê câu hỏi cần làm rõ.
2sap-write-technical-specINTAKE.md → TECHNICAL_SPEC.mdChọn pattern RAP managed/unmanaged thay vì CDS thuần.
2asap-ask-consultant→ CDS/field nguồn theo phân hệBên trong bước 2: dispatch tự động tới đúng agent tư vấn phân hệ (SD/FI/MM/...), kể cả nhiều phân hệ cùng lúc (module coupling) — hỏi "CDS view/field nào chuẩn cho nghiệp vụ này". KHÔNG tự đoán CDS view khi chưa hỏi domain expert.
2bsap-ask-consultantDanh sách object dự kiến → xác nhậnBên trong bước 2: sau khi liệt kê xong field/object (Table + CDS + Behavior), gửi lại danh sách cụ thể cho cùng consultant xác nhận lần 2 trước khi chốt TECHNICAL_SPEC.md.
2csap-deployment-target→ package deploy + rào chắn an toànHỏi user deploy vào package nào (có sẵn hoặc tạo mới package Z) — bắt buộc, chạy 1 lần rồi tái sử dụng xuyên suốt. Từ đây tuyệt đối không tạo/sửa/xoá object ngoài Z/Y hoặc ngoài package đã xác nhận. Có MCP thì verify package thật qua ADT; không có MCP (vd abapGit clone-về-local) thì hỏi xác nhận trực tiếp, ghi rõ "chưa verify tự động" để đối chiếu sau.
2.5*sap-bootstrap-system-contextMCP ADT → system-context.md(Tuỳ chọn) Hệ thống lạ, chưa biết quy ước đặt tên thật.
2.6sap-cloud-dictionary→ Domain/Data Element/TableCần persist dữ liệu mới (API tạo/sửa/xoá record) thì tạo Table + Data Element trước — tự kiểm tra reuse trước (Bước 0 của skill này) trước khi tạo mới.
3sap-scaffold-rapTECHNICAL_SPEC.md → src/Sinh Table → CDS Interface/Reuse/Consumption → Behavior → Service Definition/Binding (RAP 3-layer đầy đủ).
4sap-odata-service→ service bindingChọn V4/V2, đặt tên service (_APIO4/ZAPI_* cho machine-to-machine, _O4/_O2 cho UI). Thay thế SEGW cũ? Dùng sap-migrate-segw-to-rap thay bước 3.
5sap-authorization→ DCLAi được gọi API — instance-based authorization, PFCG/Business role, IAM app.
6*sap-rap-events→ Event Mesh(Tuỳ chọn) API cần publish event khi create/update cho hệ thống khác consume.
7*sap-badi-enhancement→ Cloud BAdI(Tuỳ chọn) API cần cho phép customer/side-by-side mở rộng logic riêng.
8sap-atc-reviewsrc/ → ATC_REVIEW.mdLint naming, released API, clean ABAP.
9sap-unit-test + sap-cds-unit-testsrc/ → *.testclasses.abapTest method/action/validation (class thường) VÀ test CDS/EML qua Test Double Framework.
10sap-finish-ticket→ đóng ticketActivate hết, ATC PASS, test xanh, transport, abapGit push.

🅲️ Form chức năng (Fiori app CRUD cho end-user)

Form luôn cần 1 API/RAP BO bên dưới để CRUD — làm toàn bộ bước 0-9 của quy trình API ở trên (bỏ qua bước 10 sap-finish-ticket — để dành đến cuối, sau khi UI xong), rồi tiếp tục:

#SkillInput → OutputLàm gì
11sap-fiori-consultant-cloudService binding → Fiori appTư vấn kiến trúc Fiori Elements (List Report + Object Page) từ annotation CDS/MDE có sẵn, hoặc Freestyle UI5 nếu cần UI tuỳ biến sâu hơn; chỉ ra Fiori Tools/Business Application Studio, deploy lên Launchpad. Agent chỉ tư vấn (không Write/Edit) — code UI5 do bạn/Claude viết theo hướng dẫn.
12sap-finish-ticket→ đóng ticketGiờ mới chạy — sau khi cả API lẫn UI đều xong: activate hết, ATC PASS, test xanh, transport, abapGit push.

💡 Không có developer / chỉ cần thay đổi đơn giản? Bỏ qua toàn bộ quy trình trên, dùng sap-key-user-toolkit — key user tự thêm Custom Field, tạo Custom Business Object, viết Custom Logic (Cloud BAdI đơn giản), hoặc sửa giao diện qua Adaptation Transaction, hoàn toàn không cần ABAP developer.

📁 Cấu trúc thư mục

Project

📦 sap-abap-agent/ ├── .claude-plugin/ ← Manifest plugin Claude Code ├── commands/ ← /sap-connect, /sync-skills ├── skills/ ← 42 skill (routing, BTP setup, CDS KB, codegen pipeline...) ├── agents/ ← 28 agent (.md) — 25 module consultant + researcher + daily learner + reviewer ├── hooks/ ← Cảnh báo SELECT * + routing discipline (SessionStart) ├── reference/ │ ├── modules/ ← 43 module knowledge bases (S/4HANA + Steampunk) │ ├── mcp-server/ ← MCP server Python (multi-profile) │ │ ├── sap_btp_agent/config/ ← paths, profile, store, secrets │ │ ├── sap_btp_agent/sap/ ← auth (OAuth2), client (REST + auto-reconnect) │ │ ├── sap_btp_agent/tools/ ← registry các tool MCP │ │ ├── sap_btp_agent/cli/ ← wizard setup + quản lý profile │ │ └── pyproject.toml ← entry point mcp-sap-connect │ ├── process/ ← Context engineering: tool-result-trim, scaffold-summary, module-routing │ ├── mcp-guides/ ← MCP setup references: ADT, GUI, SuccessFactors, CData │ ├── scripts/ ← office_to_md, sync_skills, agent_home, cleanup_agent_home... │ └── .vscode-extensions/ ← VS Code extension tự đăng ký MCP server ├── index.html ← Trang hướng dẫn này └── README.md ← Tổng quan dự án

Cấu hình (User folder)

📂 %USERPROFILE%\.mcp-sap-connect\ (Windows) 📂 ~/.mcp-sap-connect/ (macOS/Linux) ├── profiles.json ← Registry (danh sách + active) ├── profiles/ │ └── <profile-id>/ │ ├── config.json ← URL, tenant, client_id... │ └── secrets.json ← Secret đã mã hóa ├── log/ └── cache/
  • Windows: secrets mã hóa bằng DPAPI (gắn với tài khoản Windows)
  • macOS/Linux: AES-256-GCM, key derive từ hostname + username
  • File mode 0o600, chỉ owner đọc/ghi

Cấu hình (State của plugin — khác folder trên)

📂 %USERPROFILE%\.sap-abap-agent\ (Windows) 📂 ~/.sap-abap-agent/ (macOS/Linux) ├── memory/ ← sap-daily-learner: episodic/semantic/procedural ├── cache/ ← sap-context-tool-result-trim: cache output MCP (tự dọn qua 7 ngày) ├── sessions/ ← scaffold/FS working state theo ticket └── handoff/ ← HANDOFF.md ban giao giữa các session

Lưu ý: đây là 2 folder tách biệt tên gần giống nhau — .mcp-sap-connect\ lưu profile kết nối SAP BTP (MCP server), còn .sap-abap-agent\ lưu state riêng của plugin Claude Code (memory học tập, cache, session đang làm). Mặc định luôn ghi vào %USERPROFILE% dù đang mở project SAP nào; override qua SAP_ABAP_AGENT_HOME khi dev/test plugin. Chi tiết: CONTRIBUTING.md.

⚠️ Lỗi thường gặp

❌ 401 Unauthorized

Client_secret sai hoặc hết hạn. Chạy mcp-sap-connect setup <profile-id> để cập nhật thông tin OAuth2.

⚠️ 404 /oauth/token

URL token sai. Vào profiles/<id>/secrets.json, sửa tokenUrl (vd: đổi /oauth/token thành /oauth2/token nếu dùng IAS).

🔒 Không giải mã được secret

Đổi máy / hostname. Chạy lại mcp-sap-connect setup <profile-id> để tạo lại secret.

📭 Chưa có profile nào

Chạy mcp-sap-connect setup <URL> để thêm project SAP đầu tiên.

🔌 MCP tool không xuất hiện

Kiểm tra đã claude mcp add --transport stdio sap-connect -- mcp-sap-connect chưa (claude mcp list để xem). Đảm bảo mcp-sap-connect có trong PATH.

💻 'mcp-sap-connect' is not recognized

PATH thiếu folder chứa entry point — lỗi rất hay gặp trên Windows khi pip cài vào user-scheme site-packages. Chạy python -m mcp_sap_connect.doctor (chạy được dù PATH sai) để tự phát hiện và lấy sẵn lệnh fix.

🐛 Không thấy report lỗi

Error reporter mặc định TẮT (opt-in). Để bật, xem mục Báo cáo lỗi tự động ở trên.

🤝 Đóng góp cho dự án

SAP ABAP Agent là dự án open-source (MIT License). Mọi đóng góp đều được chào đón — dù là sửa lỗi chính tả, thêm skill mới, cải thiện documentation, hay báo cáo lỗi bảo mật.

Trước khi đóng góp, vui lòng đọc các tài liệu sau:

FileMục đích
CONTRIBUTING.md Hướng dẫn đóng góp skill, agent, docs
CODE_OF_CONDUCT.md Quy tắc ứng xử của cộng đồng
SECURITY.md Hướng dẫn báo cáo lỗi bảo mật
SKILL_TEMPLATE.md Template chuẩn để tạo skill / agent / reference module

Xem thêm GitHub Repository để biết chi tiết.

🐙 About GitHub (Actions, Pages, Releases)

GitHub là nơi lưu trữ source code, chạy CI/CD tự động và phát hành bản cập nhật cho plugin này. Nếu bạn chưa từng dùng GitHub, đây là 4 khái niệm cốt lõi bạn sẽ gặp:

📦

Repository (Repo)

Thư mục dự án chứa toàn bộ code, docs, scripts. Repo này: github.com/StormShynn/sap-abap-agent. Bạn có thể xem code, mở Issue báo lỗi, tạo Pull Request đóng góp — tất cả qua trình duyệt, không cần cài gì.

🤖

GitHub Actions (CI/CD)

Workflow tự động chạy mỗi khi có push lên nhánh main. Repo này có 4 workflow: deploy.yml (deploy site lên GitHub Pages), sync-index.yml (đồng bộ version/counts vào index.html), version-bump.yml (auto-bump plugin.json + build wheel + tạo Release), jekyll-gh-pages.yml (build Jekyll).

🌐

GitHub Pages

Dịch vụ host web tĩnh miễn phí từ GitHub. Trang bạn đang đọc chính là GitHub Pages của repo này, URL: stormshynn.github.io/sap-abap-agent. Mỗi lần deploy.yml chạy xong, site tự cập nhật trong vài chục giây.

🏷️

Releases & Tags

Mỗi lần plugin version được bump (v1.3.3, v1.3.2...), CI tạo git tag + GitHub Release kèm file .whl cho MCP server. Claude Code marketplace đọc tag mới → tự nhắc bạn cập nhật plugin. Xem tất cả tại trang Releases.

🛠️ Workflows đang chạy trong repo này

WorkflowFileKhi nào chạyViệc làm
Deploydeploy.ymlpush mainĐẩy toàn bộ repo (gồm index.html) lên GitHub Pages.
Sync indexsync-index.ymlpush main khi đổi CHANGELOG.md / README.md / agents/ / skills/Tự cập nhật version badge + counts trong index.html, commit lại.
Version bumpversion-bump.ymlpush mainAuto bump plugin.json theo commit message (feat: → minor, fix: → patch), build wheel MCP server, tạo git tag + GitHub Release.
Jekylljekyll-gh-pages.ymlpush mainBuild site qua Jekyll (dự phòng nếu deploy.yml lỗi).

🚀 Bắt đầu nhanh với GitHub (cho SAP consultant)

  1. Tạo tài khoản miễn phí tại github.com/signup — chỉ cần email.
  2. Xem source trên web: mở link repo ở trên, nhấn phím . (dấu chấm) để mở VS Code online, hoặc > để vào GitHub Codespaces (IDE cloud).
  3. Mở Issue khi gặp lỗi: vào tab Issues → New issue. Có template sẵn cho bug report và feature request.
  4. Đóng góp code: nhánh main là "production". Bạn tạo nhánh riêng (VD: git checkout -b fix/typo) → sửa → push → mở Pull Request. CI sẽ tự chạy test.
  5. Cài Git desktop client (tùy chọn): desktop.github.com — dùng GUI thay vì dòng lệnh.

📚 Tài liệu GitHub chính thức (tiếng Việt có một số)

Mẹo: bạn có thể Watch repo (nút 👁 ở góc phải trên) → chọn All activity để nhận email mỗi khi có Release mới hoặc Issue quan trọng.