来源资料待手动核验
ABAP AI Code
It is like a Claude Code/Codex but inside SAP system ) - Chat + agentic loop for SAP ABAP.
项目简介
It is like a Claude Code/Codex but inside SAP system ) - Chat + agentic loop for SAP ABAP.
It is like a Claude Code/Codex but inside SAP system ) - Chat + agentic loop for SAP ABAP.
It is like a Claude Code/Codex but inside SAP system ) - Chat + agentic loop for SAP ABAP.
ABAP AI Code main window
An agentic AI coding assistant that runs inside the SAP system. Written in ABAP with an HTML UI, it reads, explains, reviews and — with the optional write add-on — creates, changes and deletes ABAP repository objects. No code export, no laptop toolchain, no ADT required.
Demos: ZABAPAICODE2 walkthrough · Combobulating
Claude Code, Codex CLI and friends are excellent — if your code is on a laptop, in Git, and you are allowed to send it to a vendor from there. In a lot of SAP shops none of those three is true: the code lives only in the system, ADT/abapGit may not be installed, and exporting sources to a developer machine is a compliance conversation nobody wants to have.
ABAP AI Code is that class of tool, re-implemented where the ABAP code actually is. You start a report in SAP GUI, type a question in your own language, and an agentic loop (LLM → tool call → ABAP execution → result → LLM → …) works on live repository objects.
| | Claude Code / Codex CLI | ABAP AI Code | |---|---|---| | Where it runs | Your laptop / a container | Inside the SAP system, SAP GUI report ZABAPAICODE2 | | What it sees | Files in a Git working copy | Live repository objects (READ REPORT, SEO, TADIR) — always the current version | | How it changes code | Writes files; you commit | Writes via standard SAP APIs (RPY, SEO), with syntax check, transport entry (RSCORRINSERT) and activation | | Reviewing a change | git diff in a terminal | Built-in HTML diff with per-hunk approve / decline, decline notes and an AI discussion thread per hunk | | Prerequisites | Node.js, Git, code exported to disk | An SAP system. Nothing else — no ADT, no Eclipse, no Git working copy | | Auth / secrets | Vendor account or API key on the laptop | API key AES-256 encrypted per SAP user in ZAICODEAPIKEY, unlocked by a password that is never stored | | Model choice | Vendor's own models | 8 preconfigured providers (Anthropic, OpenAI, Mistral, Gemini, Groq, Cerebras, OpenRouter, NVIDIA); model list pulled live from /v1/models | | Extending it | MCP servers, hooks — all outside SAP | ABAP plugin classes implementing ZIFAITOOL, discovered automatically; they run in the system with full ABAP API access | | Write access | Always on | Opt-in: the base package is read-only; write tools ship as a separate package you install only where changes are intended | | ABAP awareness | Generic code model | ABAP-native: class/method-level reads, structure tree, McCabe + Halstead metrics, breakpoints, "run this program" | | Data leaving the system | The whole working tree is reachable | Only what a tool explicitly sends: one object's source, one method, one diff |
allows a cloud agent to read that repository. The tooling around it is richer.
SAP GUI, when there is no abapGit mirror, or when you want AI assistance bound to SAP authorizations, transports and user identity.
running both.
Concrete capabilities, from a user's point of view:
Ask about code in plain language. "What does ZCLX do?", "Where is the bug in ZREPORT?", "Make me a table of the methods and what they do." Answers come back in your language — the answer language follows the question language.
Read at the right granularity. A whole class, a single method (ZCLX=>METHOD), a program, several objects in one call (comma-separated), or everything matching a pattern (ZCLAITOOL). Over-broad requests ask you for confirmation instead of quietly reading half the system.
Get a real code review. reviewsapcode runs a dedicated reviewer prompt (15 KB of ABAP-specific review rules) against the live source and returns findings — not a generic "looks fine to me".
See the object, not just the text. Answers that resolve to one object open in a real ABAP editor pane with syntax highlighting, a structure tree (sections / attributes / methods, or events / forms / modules), breakpoints you can set, and a "Run" button that starts the program via its selection screen.
Measure it. One click gives McCabe cyclomatic complexity and full Halstead metrics (η1/η2, volume, difficulty, effort, estimated bugs) per method and per class.
Approve changes hunk by hunk. When the write add-on is installed, a change never lands silently: you get a diff, you approve or decline each hunk, you can leave a note or argue with the AI about a specific hunk, and only then is it saved, transported and activated.
Keep the receipts. Every LLM request, response, thinking block, tool call and tool result is written to a per-session log folder, plus a per-question token table and a Claude-Code-compatible session.jsonl.
Bring your own model. Switch provider and model on the selection screen; the model dropdown is filled from the provider's live /v1/models, so a new model is available the day it ships. Anthropic extended thinking is supported with a configurable budget.
The platform is split into two abapGit repositories along a single line: can it change your code?
| Repository | Package contents | Install it when | |---|---|---| | ABAP-AI-Code (this repo) | Engine, agentic runner, UI, diff/review cluster, metrics, crypto, key management, and the read-only tools (readsapobject, reviewsapcode, showcodeexample) | Always — it is the base | | ABAP-AI-CODE-TOOLS | The write tools (createsapobject, modifysapobject, deletesapobject) and ZCLCODEOBJECTSAVER, which performs the actual write / delete / activate | Only on systems where AI-assisted code changes are intended |
This split is possible because every tool is a plugin:
Layer 1 <tool_name>.json OpenAI function definition — the contract the LLM sees
Layer 2 <tool_name>.md prompt fragment — behaviour rules for that tool
Layer 3 ZCL_AITOOL_<X> ABAP class implementing ZIF_AI_TOOL — does the workZCLAITOOLFACTORY discovers implementers at runtime by querying SEOMETAREL for classes that implement ZIFAITOOL or inherit from ZCLAITOOLBASE. Both the tools JSON array and the tool section of the system prompt are assembled from that same registry, so:
code is touched;
attempt it and then fail;
call the saver purely by dynamic name (CALL METHOD ('ZCLCODEOBJECTSAVER')=>…), and write paths fail gracefully with "read-only platform" when it is absent.
Registration is fail-closed: a tool whose .json or .md companion file is missing from the prompt folder is not registered, and a message names the missing file. A forgotten file surfaces as an explicit warning instead of a tool that silently misbehaves.
Design rationale and the full envelope specification: FABLENEWARCHITECTURE.md.
Prerequisites
setup is described step by step in this SAP Community post.
> Note: AVE / ABAP Code Reviewer is no longer a > required dependency. The diff/review cluster it used to provide now lives in this > repository (ZCLCODEACR, ZCLCODEPOPUPDIFF). Install AVE only if you want it as > a standalone tool.
Steps
Pull and activate.
second package. abapGit does not resolve dependencies, so the base must be installed first.
e.g. C:\soft\GITHUB\ABAP-AI-CODE\TOOLS. These .json / .md files are read from the frontend at runtime; they are deliberately not abapGit objects, so prompts can be edited in a text editor without a transport.
modifysapobject., deletesapobject.) into the same folder.
or change the default in the program's INITIALIZATION block.
Providers are pure customizing — table ZAICODEPROVIDER, maintainable in SM30/SE16. On first run of ZABAPAIKEYS it is seeded with:
| Provider | Base URL | Wire format | |---|---|---| | ANTHROPIC | https://api.anthropic.com/v1 | Anthropic (ANTHROPIC flag set) | | OPENAI | https://api.openai.com/v1 | OpenAI (CACHEKEY flag set) | | MISTRAL | https://api.mistral.ai/v1 | OpenAI-compatible | | GEMINI | https://generativelanguage.googleapis.com/v1beta/openai | OpenAI-compatible | | GROQ | https://api.groq.com/openai/v1 | OpenAI-compatible | | CEREBRAS | https://api.cerebras.ai/v1 | OpenAI-compatible | | OPENROUTER | https://openrouter.ai/api/v1 | OpenAI-compatible | | NVIDIA | https://integrate.api.nvidia.com/v1 | OpenAI-compatible |
Three fields drive behaviour: URL (base endpoint), ANTHROPIC (speak the Anthropic wire format instead of OpenAI), CACHEKEY (provider accepts OpenAI's promptcachekey). Adding any other OpenAI-compatible provider is one table row — no code change.
Run ZABAPAIKEYS to store a key:
The key is AES-256 encrypted into ZAICODEAPIKEY, with the AES key derived from the password and sy-uname. See Security model.
ptools on the selection screen points at the frontend folder holding .json and .md. It also holds two files the runner reads directly:
modify, delete-vs-modify, read-only vs write, answer in the user's language…). Per-tool fragments are appended to it by the factory.
to modifysapobject when the user only asked to remove part of an object.
Edit any of these in a text editor and the change takes effect on the next run. This is the main tuning surface of the whole system.
ZABAPAICODE2 opens with only the password visible. Enter it and press Enter — that unlocks the rest of the screen. The staged reveal is deliberate: without the password nothing can be decrypted, so nothing else is worth showing.
| Field | Meaning | |---|---| | ppwd | Password for your stored key. Masked. Mandatory | | pprov | Provider. Only providers you have a key for are listed; a single-key user is snapped straight to theirs | | pname | Which of your named keys to use (auto-selected when you have exactly one) | | pmodel | Model. Filled live from the provider's /v1/models, refreshed only when provider / key / password changes. Defaults to a haiku model when available | | ptools | Frontend folder with the .json / .md tool files | | ptemp | Temperature (also changeable at runtime from the toolbar) | | pmaxt / pnomax | Max output tokens, or no limit |
为保持页面易读性,当前仅展示 README 的前半部分。请打开原始 README 阅读完整内容。