abapgit-agent 1.1.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +3 -1
- package/API.md +261 -0
- package/CLAUDE.md +384 -0
- package/README.md +16 -2
- package/RELEASE_NOTES.md +93 -8
- package/abap/CLAUDE.md +282 -6
- package/abap/copilot-instructions.md +79 -0
- package/abap/zcl_abgagt_agent.clas.abap +2 -2
- package/abap/zcl_abgagt_cmd_factory.clas.abap +2 -0
- package/abap/zcl_abgagt_command_inspect.clas.abap +255 -36
- package/abap/zcl_abgagt_command_tree.clas.abap +237 -0
- package/abap/zcl_abgagt_command_tree.clas.xml +15 -0
- package/abap/zcl_abgagt_command_view.clas.abap +240 -0
- package/abap/zcl_abgagt_command_view.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_tree.clas.abap +70 -0
- package/abap/zcl_abgagt_resource_tree.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_view.clas.abap +68 -0
- package/abap/zcl_abgagt_resource_view.clas.xml +15 -0
- package/abap/zcl_abgagt_rest_handler.clas.abap +2 -0
- package/abap/zcl_abgagt_util.clas.abap +2 -2
- package/abap/zcl_abgagt_viewer_clas.clas.abap +58 -0
- package/abap/zcl_abgagt_viewer_clas.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_ddls.clas.abap +83 -0
- package/abap/zcl_abgagt_viewer_ddls.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_dtel.clas.abap +98 -0
- package/abap/zcl_abgagt_viewer_dtel.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_factory.clas.abap +41 -0
- package/abap/zcl_abgagt_viewer_factory.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_intf.clas.abap +58 -0
- package/abap/zcl_abgagt_viewer_intf.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_stru.clas.abap +59 -0
- package/abap/zcl_abgagt_viewer_stru.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_tabl.clas.abap +59 -0
- package/abap/zcl_abgagt_viewer_tabl.clas.xml +15 -0
- package/abap/zcl_abgagt_viewer_ttyp.clas.abap +93 -0
- package/abap/zcl_abgagt_viewer_ttyp.clas.xml +15 -0
- package/abap/zif_abgagt_command.intf.abap +3 -1
- package/abap/zif_abgagt_viewer.intf.abap +12 -0
- package/abap/zif_abgagt_viewer.intf.xml +15 -0
- package/bin/abapgit-agent +605 -38
- package/docs/commands.md +27 -8
- package/docs/tree-command.md +303 -0
- package/docs/view-command.md +501 -0
- package/package.json +1 -1
- package/src/abap-client.js +22 -0
- package/src/agent.js +27 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
# view Command Requirements
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
View ABAP object source code directly from the ABAP system. This command retrieves and displays source code for objects that may not exist locally in your git repository, enabling developers to understand class definitions, method signatures, structure components, and data element types without pulling the entire object.
|
|
6
|
+
|
|
7
|
+
**This is the PRIMARY way to explore unfamiliar ABAP objects.**
|
|
8
|
+
|
|
9
|
+
## Use Cases
|
|
10
|
+
|
|
11
|
+
- **Understand unfamiliar code**: View a class definition from a dependency package
|
|
12
|
+
- **Check method signatures**: See method parameters and return types before calling
|
|
13
|
+
- **Inspect data structures**: View table or structure field definitions
|
|
14
|
+
- **Review interface definitions**: Check interface methods and constants
|
|
15
|
+
- **Quick reference**: Look up definitions without opening SE80 or ADT
|
|
16
|
+
|
|
17
|
+
## Command
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# View single object (auto-detect type from TADIR)
|
|
21
|
+
abapgit-agent view --objects ZCL_MY_CLASS
|
|
22
|
+
abapgit-agent view --objects ZIF_MY_INTERFACE
|
|
23
|
+
abapgit-agent view --objects ZMY_TABLE
|
|
24
|
+
|
|
25
|
+
# View with explicit type
|
|
26
|
+
abapgit-agent view --objects ZCL_MY_CLASS --type CLAS
|
|
27
|
+
abapgit-agent view --objects ZIF_MY_INT --type INTF
|
|
28
|
+
abapgit-agent view --objects ZMY_STRUCT --type STRU
|
|
29
|
+
abapgit-agent view --objects ZMY_TABLE --type TABL
|
|
30
|
+
abapgit-agent view --objects ZMY_DTEL --type DTEL
|
|
31
|
+
abapgit-agent view --objects ZMY_TTYP --type TTYP
|
|
32
|
+
abapgit-agent view --objects ZC_MY_CDS_VIEW --type DDLS
|
|
33
|
+
|
|
34
|
+
# View multiple objects
|
|
35
|
+
abapgit-agent view --objects ZCL_CLASS1,ZCL_CLASS2,ZIF_INTERFACE1
|
|
36
|
+
|
|
37
|
+
# Lowercase names and types are supported
|
|
38
|
+
abapgit-agent view --objects zcl_my_class --type clas
|
|
39
|
+
|
|
40
|
+
# Output as JSON (for scripting/AI processing)
|
|
41
|
+
abapgit-agent view --objects ZCL_MY_CLASS --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Prerequisite
|
|
45
|
+
|
|
46
|
+
- `.abapGitAgent` exists with valid credentials
|
|
47
|
+
- Object must exist in the ABAP system
|
|
48
|
+
|
|
49
|
+
## Parameters
|
|
50
|
+
|
|
51
|
+
| Parameter | Required | Description |
|
|
52
|
+
|-----------|----------|-------------|
|
|
53
|
+
| `--objects` | Yes | Comma-separated list of object names (e.g., `ZCL_MY_CLASS,ZIF_MY_INTERFACE`) |
|
|
54
|
+
| `--type` | No | Object type for all objects (CLAS, INTF, TABL, STRU, DTEL, TTYP, DDLS). Auto-detected from TADIR if not specified |
|
|
55
|
+
| `--json` | No | Output raw JSON only (for scripting) |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Tasks
|
|
60
|
+
|
|
61
|
+
### 1. Validate Parameters
|
|
62
|
+
|
|
63
|
+
- `--objects` must be specified
|
|
64
|
+
- Object names are converted to uppercase automatically
|
|
65
|
+
|
|
66
|
+
### 2. Load Configuration
|
|
67
|
+
|
|
68
|
+
Read `.abapGitAgent` for credentials
|
|
69
|
+
|
|
70
|
+
### 3. Fetch CSRF Token
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
GET /health (with X-CSRF-Token: fetch)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Make View Request
|
|
77
|
+
|
|
78
|
+
**Endpoint:** `POST /view`
|
|
79
|
+
|
|
80
|
+
**Request Body:**
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"objects": ["ZCL_MY_CLASS", "ZIF_MY_INTERFACE"],
|
|
84
|
+
"type": "CLAS"
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 5. Display Results
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Output
|
|
93
|
+
|
|
94
|
+
### Class Definition (CLAS)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
📖 ZCL_MY_CLASS (Class)
|
|
98
|
+
Class ZCL_MY_CLASS in $PACKAGE_NAME
|
|
99
|
+
|
|
100
|
+
CLASS zcl_my_class DEFINITION PUBLIC.
|
|
101
|
+
|
|
102
|
+
PUBLIC SECTION.
|
|
103
|
+
INTERFACES: if_interface.
|
|
104
|
+
|
|
105
|
+
METHODS:
|
|
106
|
+
constructor
|
|
107
|
+
IMPORTING
|
|
108
|
+
!iv_name TYPE string OPTIONAL,
|
|
109
|
+
get_value
|
|
110
|
+
RETURNING
|
|
111
|
+
VALUE(rv_result) TYPE string.
|
|
112
|
+
ENDCLASS.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Interface Definition (INTF)
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
📖 ZIF_MY_INTERFACE (Interface)
|
|
119
|
+
Interface ZIF_MY_INTERFACE in $PACKAGE_NAME
|
|
120
|
+
|
|
121
|
+
INTERFACE zif_my_interface PUBLIC.
|
|
122
|
+
|
|
123
|
+
CONSTANTS:
|
|
124
|
+
gc_value TYPE string VALUE 'test'.
|
|
125
|
+
|
|
126
|
+
METHODS:
|
|
127
|
+
process
|
|
128
|
+
IMPORTING
|
|
129
|
+
!iv_data TYPE any
|
|
130
|
+
RETURNING
|
|
131
|
+
VALUE(rv_result) TYPE abap_bool,
|
|
132
|
+
get_status
|
|
133
|
+
RETURNING
|
|
134
|
+
VALUE(rv_status) TYPE string.
|
|
135
|
+
|
|
136
|
+
ENDINTERFACE.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Table Definition (TABL)
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
📖 SFLIGHT (Table)
|
|
143
|
+
Table SFLIGHT in SAPBC_DATAMODEL
|
|
144
|
+
|
|
145
|
+
TABLE SFLIGHT:
|
|
146
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
147
|
+
| Field | Key | Type | Length | Data Elem | Description |
|
|
148
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
149
|
+
| MANDT | X | CLNT | 3 | MANDT | Client |
|
|
150
|
+
| CARRID | X | CHAR | 3 | S_CARR_ID | Airline Code |
|
|
151
|
+
| CONNID | X | NUMC | 4 | S_CONN_ID | Connection Number |
|
|
152
|
+
| FLDATE | X | DATS | 8 | S_DATE | Flight Date |
|
|
153
|
+
| PRICE | | CURR | 16 | S_PRICE | Airfare |
|
|
154
|
+
| CURRENCY | | CUKY | 5 | S_CURR | Airline Currency |
|
|
155
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Structure Definition (STRU)
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
📖 SFLIGHT (Structure)
|
|
162
|
+
Structure SFLIGHT in SAPBC_DATAMODEL
|
|
163
|
+
|
|
164
|
+
STRUCTURE SFLIGHT:
|
|
165
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
166
|
+
| Field | Key | Type | Length | Data Elem | Description |
|
|
167
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
168
|
+
| MANDT | X | CLNT | 3 | MANDT | Client |
|
|
169
|
+
| CARRID | X | CHAR | 3 | S_CARR_ID | Airline Code |
|
|
170
|
+
|------------------+-----+----------+----------+--------------------------------+--------------------------------------------------------------|
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Data Element Definition (DTEL)
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
📖 S_CARR_ID (Data Element)
|
|
177
|
+
Airline Code
|
|
178
|
+
|
|
179
|
+
DATA ELEMENT S_CARR_ID:
|
|
180
|
+
┌────────────────────┬──────────────────────────────────────────┐
|
|
181
|
+
│ Property │ Value │
|
|
182
|
+
├────────────────────┼──────────────────────────────────────────┤
|
|
183
|
+
│ Data Type │ CHAR │
|
|
184
|
+
│ Length │ 3 │
|
|
185
|
+
│ Description │ Airline Code │
|
|
186
|
+
│ Domain │ S_CARR_ID │
|
|
187
|
+
└────────────────────┴──────────────────────────────────────────┘
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Table Type Definition (TTYP)
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
📖 DDL2DDICWARNINGS (Table Type)
|
|
194
|
+
Table Type DDL2DDICWARNINGS in SDDL_BASIC_FUNCTIONS
|
|
195
|
+
|
|
196
|
+
Line Type: DDL2DDICERR
|
|
197
|
+
Access Mode: STANDARD
|
|
198
|
+
Key Definition: WITH KEY
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### CDS View Definition (DDLS)
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
📖 ZC_MY_CDS_VIEW (CDS View)
|
|
205
|
+
CDS View ZC_MY_CDS_VIEW in $PACKAGE
|
|
206
|
+
|
|
207
|
+
@AbapCatalog.sqlViewName: 'ZCMYVIEW'
|
|
208
|
+
@AbapCatalog.compiler.compareFilter: true
|
|
209
|
+
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
|
210
|
+
@EndUserText.label: 'My CDS View'
|
|
211
|
+
define view ZC_MY_CDS_VIEW as select from tdevc
|
|
212
|
+
{
|
|
213
|
+
key devclass as Devclass,
|
|
214
|
+
parentcl as ParentPackage,
|
|
215
|
+
ctext as Description
|
|
216
|
+
}
|
|
217
|
+
where devclass not like '$%'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Multiple Objects
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
📖 Viewing 3 Objects
|
|
224
|
+
|
|
225
|
+
1️⃣ ZCL_CLASS1 (Class)
|
|
226
|
+
└─ Class ZCL_CLASS1 in $PACKAGE
|
|
227
|
+
|
|
228
|
+
2️⃣ ZIF_INTERFACE1 (Interface)
|
|
229
|
+
└─ Interface ZIF_INTERFACE1 in $PACKAGE
|
|
230
|
+
|
|
231
|
+
3️⃣ ZMY_TABLE (Table)
|
|
232
|
+
└─ Table ZMY_TABLE in $PACKAGE
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### JSON Output (Pure Scripting)
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"SUCCESS": true,
|
|
240
|
+
"COMMAND": "VIEW",
|
|
241
|
+
"MESSAGE": "Retrieved 1 object(s)",
|
|
242
|
+
"OBJECTS": [
|
|
243
|
+
{
|
|
244
|
+
"NAME": "ZCL_MY_CLASS",
|
|
245
|
+
"TYPE": "CLAS",
|
|
246
|
+
"TYPE_TEXT": "Class",
|
|
247
|
+
"DESCRIPTION": "Class ZCL_MY_CLASS in $PACKAGE",
|
|
248
|
+
"SOURCE": "CLASS zcl_my_class DEFINITION PUBLIC.\n ...",
|
|
249
|
+
"DEFINITION": "",
|
|
250
|
+
"COMPONENTS": []
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"SUMMARY": {
|
|
254
|
+
"TOTAL": 1,
|
|
255
|
+
"BY_TYPE": ["CLAS"]
|
|
256
|
+
},
|
|
257
|
+
"ERROR": ""
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Response Structure
|
|
264
|
+
|
|
265
|
+
### JSON Response Schema
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"SUCCESS": boolean,
|
|
270
|
+
"COMMAND": "VIEW",
|
|
271
|
+
"MESSAGE": "string",
|
|
272
|
+
"OBJECTS": [
|
|
273
|
+
{
|
|
274
|
+
"NAME": "string",
|
|
275
|
+
"TYPE": "CLAS|INTF|TABL|STRU|DTEL|TTYP|DDLS",
|
|
276
|
+
"TYPE_TEXT": "string",
|
|
277
|
+
"DESCRIPTION": "string",
|
|
278
|
+
"DOMAIN": "string", // For DTEL
|
|
279
|
+
"DOMAIN_TYPE": "string", // For DTEL
|
|
280
|
+
"DOMAIN_LENGTH": number, // For DTEL
|
|
281
|
+
"DOMAIN_DECIMALS": number, // For DTEL
|
|
282
|
+
"SOURCE": "string", // Full ABAP source (CLAS/INTF)
|
|
283
|
+
"NOT_FOUND": boolean, // true if object does not exist
|
|
284
|
+
"COMPONENTS": [ // For TABL/STRU
|
|
285
|
+
{
|
|
286
|
+
"FIELD": "string",
|
|
287
|
+
"KEY": boolean,
|
|
288
|
+
"TYPE": "string",
|
|
289
|
+
"LENGTH": number,
|
|
290
|
+
"DATAELEMENT": "string",
|
|
291
|
+
"DESCRIPTION": "string"
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"SUMMARY": {
|
|
297
|
+
"TOTAL": number,
|
|
298
|
+
"BY_TYPE": ["string"]
|
|
299
|
+
},
|
|
300
|
+
"ERROR": "string"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Error Handling
|
|
307
|
+
|
|
308
|
+
| Error | Message |
|
|
309
|
+
|-------|---------|
|
|
310
|
+
| Object not found | `Object not found: ZCL_NONEXISTENT` |
|
|
311
|
+
| Invalid object type | `Unsupported object type: INVALID` |
|
|
312
|
+
|
|
313
|
+
### Error Output
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
❌ Object not found: ZCL_NONEXISTENT
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Object Type Detection
|
|
322
|
+
|
|
323
|
+
### Auto-Detection Rules
|
|
324
|
+
|
|
325
|
+
| Object Name Pattern | Default Type |
|
|
326
|
+
|---------------------|--------------|
|
|
327
|
+
| `ZCL_*` or `zcl_*` | CLAS (Class) |
|
|
328
|
+
| `ZIF_*` or `zif_*` | INTF (Interface) |
|
|
329
|
+
| `ZTY_*` or `zty_*` | DTEL (Data Element) |
|
|
330
|
+
| `ZS__*` or `zs__*` | DTEL (Data Element) |
|
|
331
|
+
| Other `Z*` | CLAS (default fallback) |
|
|
332
|
+
|
|
333
|
+
### Supported Object Types
|
|
334
|
+
|
|
335
|
+
| Type Code | Type Text | Description |
|
|
336
|
+
|-----------|-----------|-------------|
|
|
337
|
+
| `CLAS` | Class | Global ABAP class |
|
|
338
|
+
| `INTF` | Interface | Global interface |
|
|
339
|
+
| `TABL` | Table | Database table |
|
|
340
|
+
| `STRU` | Structure | Structure type |
|
|
341
|
+
| `DTEL` | Data Element | Data element/domain type |
|
|
342
|
+
| `TTYP` | Table Type | Table type definition |
|
|
343
|
+
| `DDLS` | CDS View | CDS View/Entity definition |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Example
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# View a class definition
|
|
351
|
+
abapgit-agent view --objects ZCL_ABGAGT_AGENT
|
|
352
|
+
|
|
353
|
+
# View interface
|
|
354
|
+
abapgit-agent view --objects ZIF_ABGAGT_COMMAND
|
|
355
|
+
|
|
356
|
+
# View table structure
|
|
357
|
+
abapgit-agent view --objects SFLIGHT --type TABL
|
|
358
|
+
|
|
359
|
+
# View data element
|
|
360
|
+
abapgit-agent view --objects S_CARR_ID --type DTEL
|
|
361
|
+
|
|
362
|
+
# View CDS view definition
|
|
363
|
+
abapgit-agent view --objects ZC_MY_CDS_VIEW --type DDLS
|
|
364
|
+
|
|
365
|
+
# View multiple objects
|
|
366
|
+
abapgit-agent view --objects ZCL_CONFIG,ZIF_LOGGER,ZCL_UTILS
|
|
367
|
+
|
|
368
|
+
# JSON for programmatic use
|
|
369
|
+
abapgit-agent view --objects ZCL_MY_CLASS --json
|
|
370
|
+
|
|
371
|
+
# Lowercase support
|
|
372
|
+
abapgit-agent view --objects zcl_my_class
|
|
373
|
+
abapgit-agent view --objects sflight --type tabl
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Implementation
|
|
379
|
+
|
|
380
|
+
### ABAP Tables Used
|
|
381
|
+
|
|
382
|
+
| Table | Purpose |
|
|
383
|
+
|-------|---------|
|
|
384
|
+
| **TADIR** | Object directory (devclass, object type) |
|
|
385
|
+
| **SEOCLASS** | Class/interface metadata |
|
|
386
|
+
| **SEOCOMPODF** | Component definitions |
|
|
387
|
+
| **DD02L** | Table/structure definitions |
|
|
388
|
+
| **DD03L** | Table/structure fields |
|
|
389
|
+
| **DD04L** | Data element definitions |
|
|
390
|
+
| **DD40L** | Table type definitions |
|
|
391
|
+
|
|
392
|
+
### Class Source Retrieval (CLAS)
|
|
393
|
+
|
|
394
|
+
```abap
|
|
395
|
+
" Get class info from TADIR
|
|
396
|
+
SELECT SINGLE obj_name, devclass FROM tadir
|
|
397
|
+
INTO (lv_obj_name, lv_devclass)
|
|
398
|
+
WHERE obj_name = iv_name
|
|
399
|
+
AND object = 'CLAS'.
|
|
400
|
+
|
|
401
|
+
" Get public section source
|
|
402
|
+
CALL METHOD cl_oo_classname_service=>get_pubsec_name
|
|
403
|
+
EXPORTING clsname = lv_name
|
|
404
|
+
RECEIVING result = lv_prog.
|
|
405
|
+
|
|
406
|
+
READ REPORT lv_prog INTO lt_source.
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Interface Source Retrieval (INTF)
|
|
410
|
+
|
|
411
|
+
```abap
|
|
412
|
+
" Get interface info from TADIR
|
|
413
|
+
SELECT SINGLE obj_name, devclass FROM tadir
|
|
414
|
+
INTO (lv_obj_name, lv_devclass)
|
|
415
|
+
WHERE obj_name = iv_name
|
|
416
|
+
AND object = 'INTF'.
|
|
417
|
+
|
|
418
|
+
" Get interface section source
|
|
419
|
+
CALL METHOD cl_oo_classname_service=>get_intfsec_name
|
|
420
|
+
EXPORTING clsname = lv_name
|
|
421
|
+
RECEIVING result = lv_prog.
|
|
422
|
+
|
|
423
|
+
READ REPORT lv_prog INTO lt_source.
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Table/Structure Retrieval (TABL/STRU)
|
|
427
|
+
|
|
428
|
+
```abap
|
|
429
|
+
" Get fields from DD03L
|
|
430
|
+
SELECT fieldname, keyflag AS key, datatype AS type, leng AS length,
|
|
431
|
+
rollname AS dataelement, ddtext AS description
|
|
432
|
+
FROM dd03l
|
|
433
|
+
INTO TABLE lt_components
|
|
434
|
+
WHERE tabname = iv_name
|
|
435
|
+
AND as4local = 'A'
|
|
436
|
+
ORDER BY position.
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Data Element Retrieval (DTEL)
|
|
440
|
+
|
|
441
|
+
```abap
|
|
442
|
+
" Get domain info from DD04V
|
|
443
|
+
SELECT SINGLE rollname, ddtext, datatype, leng, decimals
|
|
444
|
+
FROM dd04v
|
|
445
|
+
INTO (lv_domain, lv_desc, lv_type, lv_len, lv_decimals)
|
|
446
|
+
WHERE rollname = iv_name.
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Table Type Retrieval (TTYP)
|
|
450
|
+
|
|
451
|
+
```abap
|
|
452
|
+
" Get TTYP details from DD40L
|
|
453
|
+
SELECT SINGLE rowtype accessmode keydef FROM dd40l
|
|
454
|
+
INTO (lv_linetype, lv_tabprottype, lv_keydef)
|
|
455
|
+
WHERE typename = iv_name
|
|
456
|
+
AND as4local = 'A'.
|
|
457
|
+
|
|
458
|
+
" Convert codes to text:
|
|
459
|
+
" - Access mode: T=STANDARD, S=SORTED, H=HASHED
|
|
460
|
+
" - Key definition: D=WITH KEY, N=NO KEY
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### CDS View Retrieval (DDLS)
|
|
464
|
+
|
|
465
|
+
```abap
|
|
466
|
+
" Use DDL handler to read CDS view source
|
|
467
|
+
lo_handler = cl_dd_ddl_handler_factory=>create( ).
|
|
468
|
+
|
|
469
|
+
" First try to read inactive version (get_state = 'M')
|
|
470
|
+
TRY.
|
|
471
|
+
lo_handler->read(
|
|
472
|
+
EXPORTING
|
|
473
|
+
name = lv_ddls_name
|
|
474
|
+
get_state = 'M'
|
|
475
|
+
IMPORTING
|
|
476
|
+
ddddlsrcv_wa = ls_ddlsrcv ).
|
|
477
|
+
|
|
478
|
+
IF ls_ddlsrcv-source IS NOT INITIAL.
|
|
479
|
+
lv_found = abap_true.
|
|
480
|
+
ENDIF.
|
|
481
|
+
|
|
482
|
+
CATCH cx_dd_ddl_check.
|
|
483
|
+
" Ignore - will try active version
|
|
484
|
+
ENDTRY.
|
|
485
|
+
|
|
486
|
+
" If no inactive version, try active version
|
|
487
|
+
IF lv_found = abap_false.
|
|
488
|
+
TRY.
|
|
489
|
+
lo_handler->read(
|
|
490
|
+
EXPORTING
|
|
491
|
+
name = lv_ddls_name
|
|
492
|
+
get_state = 'A'
|
|
493
|
+
IMPORTING
|
|
494
|
+
ddddlsrcv_wa = ls_ddlsrcv ).
|
|
495
|
+
CATCH cx_dd_ddl_check.
|
|
496
|
+
" Not found
|
|
497
|
+
ENDTRY.
|
|
498
|
+
ENDIF.
|
|
499
|
+
|
|
500
|
+
" Source code is in ls_ddlsrcv-source
|
|
501
|
+
```
|
package/package.json
CHANGED
package/src/abap-client.js
CHANGED
|
@@ -356,6 +356,28 @@ class ABAPClient {
|
|
|
356
356
|
|
|
357
357
|
return await this.request('POST', '/import', data, { csrfToken: this.csrfToken });
|
|
358
358
|
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Get package hierarchy tree
|
|
362
|
+
* @param {string} packageName - ABAP package name
|
|
363
|
+
* @param {number} depth - Maximum depth to traverse (default: 3, max: 10)
|
|
364
|
+
* @param {boolean} includeObjects - Include object counts breakdown
|
|
365
|
+
* @returns {object} Tree result with hierarchy and summary
|
|
366
|
+
*/
|
|
367
|
+
async tree(packageName, depth = 3, includeObjects = false) {
|
|
368
|
+
// Fetch CSRF token first
|
|
369
|
+
await this.fetchCsrfToken();
|
|
370
|
+
|
|
371
|
+
const data = {
|
|
372
|
+
package: packageName,
|
|
373
|
+
depth: Math.min(Math.max(1, depth), 10),
|
|
374
|
+
include_objects: includeObjects
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
logger.info('Getting package tree', { package: packageName, depth: data.depth, includeObjects, service: 'abapgit-agent' });
|
|
378
|
+
|
|
379
|
+
return await this.request('POST', '/tree', data, { csrfToken: this.csrfToken });
|
|
380
|
+
}
|
|
359
381
|
}
|
|
360
382
|
|
|
361
383
|
// Singleton instance
|
package/src/agent.js
CHANGED
|
@@ -164,6 +164,33 @@ class ABAPGitAgent {
|
|
|
164
164
|
throw new Error(`Import failed: ${error.message}`);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get package hierarchy tree
|
|
170
|
+
* @param {string} packageName - ABAP package name
|
|
171
|
+
* @param {number} depth - Maximum depth to traverse (default: 3)
|
|
172
|
+
* @param {boolean} includeObjects - Include object counts breakdown
|
|
173
|
+
* @returns {object} Tree result with hierarchy, summary, and metadata
|
|
174
|
+
*/
|
|
175
|
+
async tree(packageName, depth = 3, includeObjects = false) {
|
|
176
|
+
logger.info('Getting package tree', { package: packageName, depth, includeObjects });
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
const result = await this.abap.tree(packageName, depth, includeObjects);
|
|
180
|
+
return {
|
|
181
|
+
success: result.SUCCESS === 'X' || result.success === 'X' || result.success === true,
|
|
182
|
+
command: result.COMMAND || result.command || 'TREE',
|
|
183
|
+
package: result.PACKAGE || result.package,
|
|
184
|
+
message: result.MESSAGE || result.message || '',
|
|
185
|
+
hierarchy: result.HIERARCHY || result.hierarchy || null,
|
|
186
|
+
summary: result.SUMMARY || result.summary || null,
|
|
187
|
+
error: result.ERROR || result.error || null
|
|
188
|
+
};
|
|
189
|
+
} catch (error) {
|
|
190
|
+
logger.error('Tree command failed', { error: error.message });
|
|
191
|
+
throw new Error(`Tree command failed: ${error.message}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
167
194
|
}
|
|
168
195
|
|
|
169
196
|
module.exports = {
|