SAP Object Explorer
📦 Browse SAP objects and jump between related objects from static, abapGit-exported files — no live ADT, BTP, or backend connection required.
✨ What this is (English summary)
SAP Object Explorer turns an abapGit-cloned repo (.abapgit.xml + src/) into a live ADT-like workbench inside VSCode — no SAP system, no ADT, no internet required.
- Catalog & tree view of every CLAS / DDLS / BDEF / TABL / MSAG / ... by ADT category.
- Go to Definition, Hover, References, Workspace Symbols, Outline, Folding for
abap, abap_cds, abap_bdef, abap_xml — full language-server coverage.
- Cross-file completion for
TYPE REF TO, INTO, DATA ... LIKE, JOIN ... ON etc.
- Find References (Where-Used) — outgoing + incoming edges of the cross-reference graph, with direction arrows.
- Git history & diff for any SAP object — commit list, show at revision, diff against any ref.
- Refactor / Rename — atomically rewrites an object name across every file in its reference graph (with confirm modal).
- Diagnostics — flags duplicate names, missing descriptions, orphan objects, no-callers, malformed metadata.
- DEVC (package) properties pane — software component, transport layer, correction number, responsible user, homepage, suppression flags.
- Catalog export, structure report, statistics, search — for offline documentation and sharing.
- 24 custom SVG icons mirroring ADT's colour-coded package-explorer style.
Inspired by abaplint's static-analysis ideas, but ships in-process as a single extension — no Node-side tooling required beyond npm install.
📥 Cài đặt
Cách 1: Cài từ file VSIX (khuyên dùng)
- Build file VSIX — chạy
build.bat (xem mục Build bên dưới), hoặc tải file đã build sẵn sap-object-explorer-<version>.vsix
- Mở VS Code → Mở tab Extensions (
Ctrl+Shift+X)
- Click vào
... (góc phải) → Install from VSIX...
- Chọn file
.vsix vừa build/tải
Hoặc dùng terminal:
code --install-extension sap-object-explorer-<version>.vsix
Cách 3: Cài từ VS Code Marketplace
Một khi đã publish (xem PUBLISHING.md), chỉ cần search "SAP Object Explorer" trong tab Extensions và bấm Install — từ đó VS Code tự động cập nhật lên bản mới mỗi khi publisher publish version mới (mặc định extensions.autoUpdate = true, không cần làm gì thêm).
Cách 2: Build từ source
cd vscode-extension
npm install
npm run compile
npx vsce package --allow-missing-repository --skip-license
# Hoặc chạy build.bat (Windows)
🚀 Bắt đầu nhanh
- Mở folder chứa code abapGit đã clone về (thường là
src/ hoặc zfpt_*/) → File > Open Folder...
- Mở SAP Objects View: Click icon
SAP ở Activity Bar bên trái
- Quét catalog: Bấm nút Refresh Catalog 🔄 trên thanh title của view — mặc định view không tự quét khi mở (đổi qua
sapExplorer.autoScanOnFirstView nếu muốn tự quét lại lần đầu mở view)
- Click vào object để xem chi tiết (files, source, cross-references)
💡 Project lớn, nhiều package không liên quan? Bấm Scan From Folder... 📂 trên thanh title để chọn đúng thư mục con cần quét (vd. zfpt_report) thay vì quét cả workspace — nhanh hơn nhiều trên repo lớn. Bấm Reset Scan Path để quay lại quét cả workspace root. Muốn loại trừ thêm thư mục cụ thể (không đổi hẳn scan path) thì dùng sapExplorer.excludeFolders.
🎨 Syntax highlighting & editor experience
- Colorized bracket pairs cho khối lệnh ABAP —
IF/ENDIF, METHOD/ENDMETHOD, CLASS/ENDCLASS, LOOP/ENDLOOP, TRY/ENDTRY, DO/ENDDO, FORM/ENDFORM, FUNCTION/ENDFUNCTION, INTERFACE/ENDINTERFACE (cả hoa/thường) được bracket-matching/colorize như dấu ngoặc thật.
- Auto-indent khi gõ Enter sau các khối trên, tự dedent khi gõ
ENDIF./ENDMETHOD./... (case-insensitive).
- Auto-close cho string template
|...| và backtick `...`.
- Region folding thủ công qua comment
* #region / * #endregion (ABAP) hoặc // #region / // #endregion (CDS/BDEF).
- Field symbol (
<fs>) giờ có scope highlighting riêng (variable.other.field-symbol.abap, in nghiêng) thay vì lẫn vào scope preprocessor chung — hoạt động trong mọi khối (IF/LOOP/FORM/FUNCTION/METHOD...).
🎯 Tính năng
🌲 Hai chế độ xem cây thư mục
Click nút Toggle View Mode (📋) trên thanh title của SAP Objects view để chuyển đổi:
| Chế độ |
Mô tả |
| Category View (mặc định) |
Nhóm objects theo category ADT (Core Data Services, Business Services, Dictionary...) — giống Package Explorer |
| Folder View |
Hiển thị cấu trúc filesystem thực tế — giống GitHub file tree |
📤 Export & Structure Report
- Export Catalog as JSON (💾) — Xuất toàn bộ catalog ra file JSON để chia sẻ / tái tạo cấu trúc
- Generate Structure Report — Tạo báo cáo dạng tree hierarchy (package → object types → objects)
- Show Statistics (📊) — Thống kê chi tiết objects theo type, package, cross-references
📋 Copy nhanh
- Copy Object Path — Click chuột phải vào object → copy đường dẫn file
- Copy Object Key — Click chuột phải → copy key
name.type
🎨 Icons chuyên nghiệp
24 icons được thiết kế theo phong cách SAP ADT, phân loại bằng màu sắc:
| Màu |
Nhóm |
Ví dụ |
| 🔵 Xanh dương |
Source Code + Services |
CLAS (class diagram), SRVD (document) |
| 🟢 Xanh lá |
Dictionary |
TABL (grid), DTEL (tag) |
| 🟣 Tím |
CDS/RAP + IAM |
DDLS (CDS doc), BDEF (gear), DCLS (shield) |
| 🟠 Cam |
Authorizations |
SUSH (lock) |
| ⚪ Xám |
Miscellaneous |
MSAG (speech bubble) |
| 🟡 Vàng |
Package |
DEVC (3D box) |
⚙️ Cài đặt mới
| Setting |
Default |
Mô tả |
sapExplorer.viewMode |
"category" |
"category" hoặc "folder" — chế độ xem cây |
sapExplorer.showObjectCounts |
true |
Hiển thị số lượng objects bên cạnh tên folder/category |
📋 Danh sách commands
| Command |
Mô tả |
| Refresh Catalog 🔄 |
Quét lại folder, rebuild tree + identifier index |
| Scan From Folder... 📂 |
Mở popup chọn thư mục con cụ thể để quét, thay vì cả workspace |
Reset Scan Path $(root-folder) |
Xoá scan path đã chọn, quay về quét cả workspace root |
| Toggle View Mode 📋 |
Chuyển Category/Folder view |
| Export Catalog as JSON 💾 |
Xuất catalog ra JSON |
| Show Statistics 📊 |
Thống kê objects |
| Search Objects 🔎 |
QuickPick tìm object theo name/type/package |
Find References $(references) |
Where-Used cho object dưới caret |
Run Diagnostics $(checklist) |
Lint catalog: duplicate names, missing descr, orphans |
Command palette (right-click on a file/object too)
| Command |
Mô tả |
| Show Object Overview |
Mở panel chi tiết object |
| Go to Related Object |
Mở danh sách object liên quan |
| Open File |
Mở file của object đang chọn |
| Generate Structure Report |
Render cây package hierarchy ra Markdown |
Show Object History $(history) |
Git commit list cho object |
Diff Object Against Git Ref $(diff) |
git diff object's folder vs ref |
Rename Object (Refactor) $(edit) |
Đổi tên + rewrite references toàn graph |
Language-server features (auto)
| Phím tắt |
Hoạt động |
| F12 / Ctrl+Click |
Go to Definition |
| Hover |
Hiện Type / Name / Package / file path |
| Shift+F12 |
References (graph + in-file occurrences) |
| Ctrl+T |
Workspace Symbol - tìm object toàn workspace |
| Ctrl+Shift+O |
Document Symbol - outline CLASS / METHOD / FORM / IF |
| Ctrl+Space |
Cross-file completion cho CLAS / TABL / DTEL / INTF |
| Folding |
IF/ENDIF, DO/ENDDO, METHOD/ENDMETHOD, CLASS/ENDCLASS, XML tags |
🔍 Tính năng có sẵn
Package Explorer-style tree
Packages và sub-packages nested by on-disk folder, grouped vào category/subcategory giống ADT (Business Services, Core Data Services, Dictionary, Cloud Communication Management...), kèm object counts.
Cross-reference navigation
Objects mà metadata/source có chứa tên của object khác sẽ tự động linked. Dùng Go to Related Object từ file đang mở, hoặc mở rộng object trong tree để xem references.
Object overview panel
Click object (bất kỳ, kể cả object chỉ có 1 file) → panel bên cạnh mở ra, hiển thị:
- Files (click để mở)
- Type-specific detail:
- BDEF — operations (entity/alias/lock/authorization/associations/validations/determinations)
- DDLS — keys, associations, compositions
- CLAS — Types / Data / Methods theo từng class (kể cả local class)
- TABL — table header (DD02V), Technical Settings (DD09L), Fields (DD03P), Extras/TDDAT (authorization group)
- DOMA — header + bảng Fixed values (value/text)
- DTEL — domain/type tham chiếu, độ dài field label
- TTYP — row type/kind, access mode
- NROB — number range attributes + text
- MSAG — danh sách messages
- Related objects list
Muốn mở file XML thô thay vì panel: bấm mũi tên expand ở node object trong tree, file con nằm sẵn trong đó.
ABAP CDS / RAP syntax highlighting
Cho .asddls, .asdcls, .asbdef, .srvdsrv, .asddlxs files.
Outline/breadcrumb cho CDS view entities và Behavior Definitions.
JSON Schema validation
Cho AFF *.uiad.json, *.nont.json, *.ront.json files — hover docs và autocomplete.
⚙️ Settings
| Setting |
Default |
Mô tả |
sapExplorer.scanPath |
"" (whole workspace) |
Folder to scan, relative tới workspace root. Set nhanh qua command Scan From Folder... (liệt kê sẵn các folder trong workspace) thay vì sửa tay trong Settings |
sapExplorer.viewMode |
"category" |
"category" / "folder" |
sapExplorer.showObjectCounts |
true |
Show/hide object counts in tree |
sapExplorer.autoScanOnFirstView |
false |
Tự scan workspace khi mở SAP Object Explorer view lần đầu. Mặc định tắt — bấm Refresh Catalog khi cần quét |
sapExplorer.enableScanCache |
true |
Cache kết quả scan để mở lại nhanh hơn (xem ghi chú lưu trữ bên dưới) |
sapExplorer.excludeFolders |
[] |
Thêm tên thư mục muốn bỏ qua khi quét, cộng dồn với danh sách mặc định (.git, node_modules, .vscode, .github, .gitlab, __pycache__, .nyc_output, coverage, .next, target, build, dist, .cache, .svn). Match theo tên thư mục chính xác, không phải path/glob |
sapExplorer.maxReferenceGraphObjects |
5000 |
Ngưỡng số object tối đa để build cross-reference graph (phần "Related"/Where-Used) — vượt ngưỡng thì bỏ qua vì thuật toán O(n²) sẽ chậm trên repo rất lớn |
🧠 How scanning works
- Mỗi file được nhóm theo
<name>.<type> (bỏ qua extension variant), giống cách abapGit lưu objects trên disk
- Một file
.xml hoặc .json là metadata; các file còn lại là companion source
- Một số types được parse thêm: BDEF operations, DDLS fields/associations, CLAS types/data/methods
- Cross-references: dựa trên evidence — một edge chỉ được tạo khi tên object xuất hiện trong file của object khác
- Thư mục trong danh sách mặc định (
.git, node_modules, .vscode, build, dist, ...) + bất kỳ thư mục nào thêm qua sapExplorer.excludeFolders luôn bị bỏ qua khi đi bộ cây thư mục — kể cả ở bước kiểm tra cache
- Nếu catalog có hơn
sapExplorer.maxReferenceGraphObjects objects (mặc định 5000), bước build cross-reference graph bị bỏ qua để tránh chậm trên repo rất lớn — tree/panel vẫn hiển thị bình thường, chỉ thiếu "Related"/Where-Used
Chạy in-process bằng TypeScript (src/sapReader.ts). Python script tools/sap_reader.py có sẵn nếu muốn dùng CLI.
Lưu trữ cache: file cache của scan nằm trong thư mục global storage riêng của extension (do VS Code quản lý, ngoài workspace) — không ghi bất kỳ file nào vào trong repo/workspace đang scan, kể cả khi đó là abapGit repo thật của bạn.
⚠️ Known limitations
- Category placement cho types ít gặp là best-effort — xem
src/categories.ts. Types không map được sẽ vào Other bucket
- BDEF/DDLS/CLAS parsing và cross-reference graph là best-effort regex, không phải full grammar
- Không track trạng thái object (activation, transport, v.v.)
- Tested trên static export snapshots, không phải live system
🏗️ Project structure
vscode-extension/
├── src/ # TypeScript source
│ ├── extension.ts # Entry point
│ ├── sapReader.ts # Scan & parse abapGit files
│ ├── objectTreeProvider.ts # Tree view data provider
│ ├── objectPanel.ts # Object detail webview
│ ├── exportFeature.ts # Export & structure features ✨
│ ├── categories.ts # Type → category mapping
│ ├── icons.ts # Type → icon file mapping
│ ├── catalog.ts # Data types
│ ├── xmlParse.ts # XML parser
│ └── symbolProvider.ts # CDS/BDEF outline
├── resources/
│ └── icons/ # 24 SVG icons
├── syntaxes/ # CDS textmate grammar
├── schemas/ # JSON validation schemas
├── tools/
│ └── sap_reader.py # Python CLI (optional)
├── out/ # Compiled JS
└── package.json
🤝 Contributing
Pull requests welcome! Report issues on GitHub.
📝 License
MIT — Author: Bùi Hoàng Trí Nghĩa (StormShyn) — nghiabht@fpt.com
| |