abapgit-agent 1.8.0 → 1.8.1
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/README.md +19 -1
- package/abap/CLAUDE.md +6 -5
- package/abap/guidelines/01_sql.md +20 -0
- package/abap/guidelines/04_cds.md +143 -36
- package/abap/guidelines/08_abapgit.md +44 -3
- package/abap/guidelines/10_common_errors.md +95 -0
- package/package.json +1 -1
- package/src/commands/syntax.js +52 -2
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: abapGit Agent
|
|
3
|
+
nav_order: 1
|
|
4
|
+
permalink: /
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# abapGit Agent
|
|
2
8
|
|
|
3
9
|
A local agent that enables AI coding tools (Claude, Copilot, etc.) to automatically pull and activate ABAP code from git repositories using REST API.
|
|
@@ -87,7 +93,18 @@ abapgit-agent import --message "feat: add new feature"
|
|
|
87
93
|
### Validation Commands
|
|
88
94
|
|
|
89
95
|
```bash
|
|
90
|
-
#
|
|
96
|
+
# Check syntax of local source files BEFORE commit (fast, no activation)
|
|
97
|
+
# Supported: CLAS, INTF, PROG, DDLS (CDS Views)
|
|
98
|
+
abapgit-agent syntax --files src/zcl_my_class.clas.abap
|
|
99
|
+
abapgit-agent syntax --files src/zc_my_view.ddls.asddls
|
|
100
|
+
|
|
101
|
+
# Syntax check with ABAP Cloud mode
|
|
102
|
+
abapgit-agent syntax --files src/zcl_my_class.clas.abap --cloud
|
|
103
|
+
|
|
104
|
+
# Syntax check multiple files
|
|
105
|
+
abapgit-agent syntax --files src/zcl_class.clas.abap,src/zc_view.ddls.asddls
|
|
106
|
+
|
|
107
|
+
# Inspect source file for issues (after activation)
|
|
91
108
|
abapgit-agent inspect --files src/zcl_my_class.clas.abap
|
|
92
109
|
|
|
93
110
|
# Run AUnit tests for test classes
|
|
@@ -158,6 +175,7 @@ npm run pull -- --url <git-url> --branch main
|
|
|
158
175
|
| delete Command | [docs/delete-command.md](docs/delete-command.md) |
|
|
159
176
|
| import Command | [docs/import-command.md](docs/import-command.md) |
|
|
160
177
|
| pull Command | [docs/pull-command.md](docs/pull-command.md) |
|
|
178
|
+
| syntax Command | [docs/syntax-command.md](docs/syntax-command.md) |
|
|
161
179
|
| inspect Command | [docs/inspect-command.md](docs/inspect-command.md) |
|
|
162
180
|
| unit Command | [docs/unit-command.md](docs/unit-command.md) |
|
|
163
181
|
| tree Command | [docs/tree-command.md](docs/tree-command.md) |
|
package/abap/CLAUDE.md
CHANGED
|
@@ -294,15 +294,16 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
|
|
|
294
294
|
| CLAS (test classes: .testclasses.abap) | ✅ Supported | Run `syntax` before commit |
|
|
295
295
|
| INTF (interfaces) | ✅ Supported | Run `syntax` before commit |
|
|
296
296
|
| PROG (programs) | ✅ Supported | Run `syntax` before commit |
|
|
297
|
-
| DDLS (CDS views) |
|
|
297
|
+
| DDLS (CDS views) | ✅ Supported | Run `syntax` before commit (requires annotations) |
|
|
298
298
|
| FUGR (function groups) | ❌ Not supported | Skip syntax, use `pull` then `inspect` |
|
|
299
299
|
| TABL/DTEL/DOMA/MSAG/SHLP | ❌ Not supported | Skip syntax, just `pull` |
|
|
300
300
|
| All other types | ❌ Not supported | Skip syntax, just `pull` |
|
|
301
301
|
|
|
302
302
|
**IMPORTANT**:
|
|
303
|
-
- **Use `syntax` BEFORE commit** for CLAS/INTF/PROG
|
|
303
|
+
- **Use `syntax` BEFORE commit** for CLAS/INTF/PROG/DDLS - catches errors early, no git pollution
|
|
304
304
|
- **Syntax checks files INDEPENDENTLY** - no cross-file dependency support (e.g., interface definition not available when checking implementing class)
|
|
305
305
|
- **For dependent files** (interface + class, class + using class): Skip `syntax`, use `pull` directly
|
|
306
|
+
- **DDLS requires proper annotations** - CDS views need `@AbapCatalog.sqlViewName`, view entities don't
|
|
306
307
|
- **ALWAYS push to git BEFORE running pull** - abapGit reads from git
|
|
307
308
|
- **Use `inspect` AFTER pull** for unsupported types or if pull fails
|
|
308
309
|
|
|
@@ -340,7 +341,7 @@ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,
|
|
|
340
341
|
├─ .clas.abap or .clas.testclasses.abap → CLAS ✅ syntax supported (if independent)
|
|
341
342
|
├─ .intf.abap → INTF ✅ syntax supported (if independent)
|
|
342
343
|
├─ .prog.abap → PROG ✅ syntax supported
|
|
343
|
-
├─ .ddls.asddls → DDLS
|
|
344
|
+
├─ .ddls.asddls → DDLS ✅ syntax supported (requires proper annotations)
|
|
344
345
|
└─ All other extensions → ❌ syntax not supported
|
|
345
346
|
|
|
346
347
|
2. Check for dependencies:
|
|
@@ -349,11 +350,11 @@ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,
|
|
|
349
350
|
├─ New objects that don't exist in ABAP system? → Check if they depend on each other
|
|
350
351
|
└─ Unrelated bug fixes across files? → No dependencies
|
|
351
352
|
|
|
352
|
-
3. For SUPPORTED types (CLAS/INTF/PROG):
|
|
353
|
+
3. For SUPPORTED types (CLAS/INTF/PROG/DDLS):
|
|
353
354
|
├─ Independent files → Run syntax → Fix errors → Commit → Push → Pull
|
|
354
355
|
└─ Dependent files → Skip syntax → Commit → Push → Pull
|
|
355
356
|
|
|
356
|
-
4. For UNSUPPORTED types (
|
|
357
|
+
4. For UNSUPPORTED types (FUGR, TABL, etc.):
|
|
357
358
|
Write code → Skip syntax → Commit → Push → Pull → (if errors: inspect)
|
|
358
359
|
|
|
359
360
|
5. For MIXED types (some supported + some unsupported):
|
|
@@ -90,6 +90,26 @@ SELECT object obj_name FROM tadir ...
|
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
93
|
+
## 6. Modern ABAP SQL (with FIXPT)
|
|
94
|
+
|
|
95
|
+
When `<FIXPT>X</FIXPT>` is in class XML (default for modern ABAP):
|
|
96
|
+
|
|
97
|
+
```abap
|
|
98
|
+
" ✅ Required syntax
|
|
99
|
+
SELECT carrid, connid, fldate " Commas required
|
|
100
|
+
FROM sflight
|
|
101
|
+
INTO TABLE @lt_result " @ for host variables
|
|
102
|
+
WHERE carrid = @lv_carrier. " @ for parameters
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Common errors**:
|
|
106
|
+
- Missing commas → Add between all SELECT fields
|
|
107
|
+
- Missing @ → Add to all ABAP variables (not DB columns)
|
|
108
|
+
|
|
109
|
+
**Why FIXPT**: Without it, decimals treated as integers in calculations.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
93
113
|
## See Also
|
|
94
114
|
- **Constructor Expressions** (05_classes.md) - for VALUE #(), FILTER, FOR loops
|
|
95
115
|
- **Internal Tables** - for filtering and iteration patterns
|
|
@@ -21,6 +21,77 @@ grand_parent: ABAP Development
|
|
|
21
21
|
|
|
22
22
|
CDS views (Data Definition Language Source) require specific file naming and structure for abapGit.
|
|
23
23
|
|
|
24
|
+
### CDS View vs View Entity: When to Use Which
|
|
25
|
+
|
|
26
|
+
**IMPORTANT**: When creating CDS views, use **View Entity** by default unless explicitly requested otherwise.
|
|
27
|
+
|
|
28
|
+
| User Request | Create Type | Why |
|
|
29
|
+
|--------------|-------------|-----|
|
|
30
|
+
| "Create CDS view" | CDS View Entity (modern) | Default for new development |
|
|
31
|
+
| "Create CDS view for..." | CDS View Entity (modern) | Recommended approach |
|
|
32
|
+
| "Create legacy CDS view" | CDS View (legacy) | Only if explicitly requested |
|
|
33
|
+
| "Create CDS view with sqlViewName" | CDS View (legacy) | Explicit legacy request |
|
|
34
|
+
|
|
35
|
+
### Key Differences
|
|
36
|
+
|
|
37
|
+
| Aspect | CDS View (Legacy) | CDS View Entity (Modern) |
|
|
38
|
+
|--------|-------------------|-------------------------|
|
|
39
|
+
| **Syntax** | `define view` | `define view entity` |
|
|
40
|
+
| **@AbapCatalog.sqlViewName** | ✅ Required | ❌ Not allowed (will fail) |
|
|
41
|
+
| **Creates SQL View** | Yes (DDLS + SQL view) | No (DDLS only) |
|
|
42
|
+
| **XML SOURCE_TYPE** | `V` | `W` |
|
|
43
|
+
| **ABAP Version** | 7.40+ | 7.55+ / S/4HANA Cloud |
|
|
44
|
+
| **Parameter Syntax** | `:param` or `$parameters.param` | `$parameters.param` only |
|
|
45
|
+
| **Use For** | Legacy systems, existing code | New development, S/4HANA |
|
|
46
|
+
|
|
47
|
+
### XML Metadata: The Key Difference
|
|
48
|
+
|
|
49
|
+
The XML metadata differs only in the `SOURCE_TYPE` field:
|
|
50
|
+
|
|
51
|
+
**CDS View Entity XML (RECOMMENDED - use by default):**
|
|
52
|
+
```xml
|
|
53
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
54
|
+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
|
55
|
+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
56
|
+
<asx:values>
|
|
57
|
+
<DDLS>
|
|
58
|
+
<DDLNAME>ZC_MY_ENTITY</DDLNAME>
|
|
59
|
+
<DDLANGUAGE>E</DDLANGUAGE>
|
|
60
|
+
<DDTEXT>My CDS View Entity</DDTEXT>
|
|
61
|
+
<SOURCE_TYPE>W</SOURCE_TYPE>
|
|
62
|
+
</DDLS>
|
|
63
|
+
</asx:values>
|
|
64
|
+
</asx:abap>
|
|
65
|
+
</abapGit>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**CDS View XML (Legacy - only if explicitly requested):**
|
|
69
|
+
```xml
|
|
70
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
71
|
+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
|
72
|
+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
73
|
+
<asx:values>
|
|
74
|
+
<DDLS>
|
|
75
|
+
<DDLNAME>ZC_MY_VIEW</DDLNAME>
|
|
76
|
+
<DDLANGUAGE>E</DDLANGUAGE>
|
|
77
|
+
<DDTEXT>My CDS View</DDTEXT>
|
|
78
|
+
<SOURCE_TYPE>V</SOURCE_TYPE>
|
|
79
|
+
</DDLS>
|
|
80
|
+
</asx:values>
|
|
81
|
+
</asx:abap>
|
|
82
|
+
</abapGit>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**SOURCE_TYPE values:**
|
|
86
|
+
- `W` = View Entity (modern, no SQL view created)
|
|
87
|
+
- `V` = View (legacy, creates SQL view)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Creating CDS Views (DDLS)
|
|
92
|
+
|
|
93
|
+
CDS views (Data Definition Language Source) require specific file naming and structure for abapGit.
|
|
94
|
+
|
|
24
95
|
### File Naming
|
|
25
96
|
|
|
26
97
|
CDS views require **two files**:
|
|
@@ -34,6 +105,20 @@ CDS views require **two files**:
|
|
|
34
105
|
|
|
35
106
|
### DDL Source File (`.ddls.asddls`)
|
|
36
107
|
|
|
108
|
+
**CDS View Entity (RECOMMENDED - use by default):**
|
|
109
|
+
```abap
|
|
110
|
+
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
|
111
|
+
@EndUserText.label: 'My CDS View Entity'
|
|
112
|
+
define view entity ZC_My_Entity as select from tdevc
|
|
113
|
+
{
|
|
114
|
+
key devclass as Devclass,
|
|
115
|
+
parentcl as ParentPackage,
|
|
116
|
+
ctext as Description
|
|
117
|
+
}
|
|
118
|
+
where devclass not like '$%'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**CDS View (Legacy - only if explicitly requested):**
|
|
37
122
|
```abap
|
|
38
123
|
@AbapCatalog.sqlViewName: 'ZCMYVIEW'
|
|
39
124
|
@AbapCatalog.compiler.compareFilter: true
|
|
@@ -48,55 +133,34 @@ define view ZC_My_View as select from tdevc
|
|
|
48
133
|
where devclass not like '$%'
|
|
49
134
|
```
|
|
50
135
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
55
|
-
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
|
56
|
-
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
57
|
-
<asx:values>
|
|
58
|
-
<DDLS>
|
|
59
|
-
<DDLNAME>ZC_MY_VIEW</DDLNAME>
|
|
60
|
-
<DDLANGUAGE>E</DDLANGUAGE>
|
|
61
|
-
<DDTEXT>My CDS View</DDTEXT>
|
|
62
|
-
</DDLS>
|
|
63
|
-
</asx:values>
|
|
64
|
-
</asx:abap>
|
|
65
|
-
</abapGit>
|
|
66
|
-
```
|
|
136
|
+
**Note the key differences:**
|
|
137
|
+
- View Entity: No `@AbapCatalog.sqlViewName`, uses `define view entity`
|
|
138
|
+
- View (legacy): Has `@AbapCatalog.sqlViewName`, uses `define view`
|
|
67
139
|
|
|
68
140
|
### Key Points
|
|
69
141
|
|
|
70
142
|
1. **Avoid reserved words** - Field names like `PACKAGE`, `CLASS`, `INTERFACE` are reserved in CDS. Use alternatives like `PackageName`, `ClassName`.
|
|
71
143
|
|
|
72
|
-
2. **
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
144
|
+
2. **Workflow for creating CDS views** - See `../CLAUDE.md` for complete workflow guidance:
|
|
145
|
+
- Independent CDS views: `syntax → commit → pull --files`
|
|
146
|
+
- Dependent CDS views (with associations to NEW views): Create underlying view first, then dependent view
|
|
147
|
+
- See CLAUDE.md section on "Working with dependent objects"
|
|
76
148
|
|
|
77
149
|
3. **System support** - CDS views require SAP systems with CDS capability (S/4HANA, SAP BW/4HANA, or ABAP 7.51+). Older systems will show error: "Object type DDLS is not supported by this system"
|
|
78
150
|
|
|
79
|
-
###
|
|
80
|
-
|
|
81
|
-
When pull shows generic errors like "Activation cancelled. Check the inactive objects":
|
|
151
|
+
### Activating CDS Views
|
|
82
152
|
|
|
83
|
-
|
|
84
|
-
2. **Pull all files** - Sometimes `abapgit-agent pull` (all files) works better than single file for CDS views
|
|
153
|
+
**For standard workflow, see `../CLAUDE.md`**
|
|
85
154
|
|
|
86
|
-
|
|
155
|
+
**CDS-specific notes:**
|
|
156
|
+
- Single independent DDLS file: `abapgit-agent pull --files src/zc_view.ddls.asddls`
|
|
157
|
+
- CDS views with associations to OTHER NEW views: Create target view first (see `../CLAUDE.md` for workflow)
|
|
87
158
|
|
|
88
|
-
CDS View
|
|
159
|
+
## CDS View Entity Features
|
|
89
160
|
|
|
90
|
-
|
|
161
|
+
CDS View Entities are the modern replacement for CDS Views with enhanced features like **associations for OData navigation**.
|
|
91
162
|
|
|
92
|
-
|
|
93
|
-
|--------|----------|-------------|
|
|
94
|
-
| Syntax | `define view` | `define view entity` |
|
|
95
|
-
| Associations | No | Yes (exposed for navigation) |
|
|
96
|
-
| OData/Navigation | Requires separate service | Auto-exposes associations |
|
|
97
|
-
| ABAP Version | 7.40+ | 7.55+ / S/4HANA Cloud |
|
|
98
|
-
|
|
99
|
-
### DDL Source File with Association
|
|
163
|
+
### Associations in View Entities
|
|
100
164
|
|
|
101
165
|
```abap
|
|
102
166
|
@EndUserText.label: 'Package Hierarchy'
|
|
@@ -138,6 +202,49 @@ When working with CDS view syntax (arithmetic, built-in functions, aggregations,
|
|
|
138
202
|
|
|
139
203
|
---
|
|
140
204
|
|
|
205
|
+
## Selecting from CDS Views in Classes
|
|
206
|
+
|
|
207
|
+
### Best Practice: Use CDS View Entity as Type
|
|
208
|
+
|
|
209
|
+
```abap
|
|
210
|
+
" ✅ RECOMMENDED - Use view entity directly
|
|
211
|
+
TYPES ty_results TYPE STANDARD TABLE OF zc_my_view WITH DEFAULT KEY.
|
|
212
|
+
|
|
213
|
+
METHOD get_data.
|
|
214
|
+
SELECT * FROM zc_my_view INTO TABLE @rt_results.
|
|
215
|
+
ENDMETHOD.
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Benefits**: No field mismatches, 33% less code, auto-sync with CDS changes.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### Alternative: Manual Structure Definition
|
|
223
|
+
|
|
224
|
+
Only when you need to hide/transform fields:
|
|
225
|
+
|
|
226
|
+
```abap
|
|
227
|
+
" Use data elements from underlying tables
|
|
228
|
+
TYPES: BEGIN OF ty_custom,
|
|
229
|
+
carrierid TYPE s_carr_id, " ✅ Data element
|
|
230
|
+
connid TYPE s_conn_id, " ✅ NOT: TYPE c LENGTH 3
|
|
231
|
+
END OF ty_custom.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Find data elements**:
|
|
235
|
+
```bash
|
|
236
|
+
abapgit-agent view --objects SFLIGHT --type TABL
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Match field names**:
|
|
240
|
+
```bash
|
|
241
|
+
abapgit-agent preview --objects ZC_MY_VIEW --limit 1
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Calculated fields**: Use `TYPE decfloat34` for division/complex math.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
141
248
|
## See Also
|
|
142
249
|
- **Unit Testing** (03_testing.md) - for CDS Test Double Framework
|
|
143
250
|
- **abapGit** (08_abapgit.md) - for CDS XML metadata templates
|
|
@@ -65,6 +65,7 @@ abapGit needs XML files to:
|
|
|
65
65
|
<EXPOSURE>2</EXPOSURE>
|
|
66
66
|
<STATE>1</STATE>
|
|
67
67
|
<UNICODE>X</UNICODE>
|
|
68
|
+
<FIXPT>X</FIXPT>
|
|
68
69
|
</VSEOCLASS>
|
|
69
70
|
</asx:values>
|
|
70
71
|
</asx:abap>
|
|
@@ -77,6 +78,9 @@ abapGit needs XML files to:
|
|
|
77
78
|
- `EXPOSURE`: Exposure (2 = Public, 3 = Protected, 4 = Private)
|
|
78
79
|
- `STATE`: State (1 = Active)
|
|
79
80
|
- `UNICODE`: Unicode encoding (X = Yes)
|
|
81
|
+
- `FIXPT`: Fixed-point arithmetic (X = Yes) - **Always include for correct decimal arithmetic**
|
|
82
|
+
|
|
83
|
+
**Note**: `<FIXPT>X</FIXPT>` is default for modern ABAP. Without it, decimals treated as integers.
|
|
80
84
|
|
|
81
85
|
**Local Classes**: If the class has local classes (e.g., test doubles), add:
|
|
82
86
|
- `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` - for test classes
|
|
@@ -171,7 +175,41 @@ abapGit needs XML files to:
|
|
|
171
175
|
|
|
172
176
|
---
|
|
173
177
|
|
|
174
|
-
### CDS View (DDLS)
|
|
178
|
+
### CDS View Entity (DDLS) - RECOMMENDED
|
|
179
|
+
|
|
180
|
+
**Use by default when user says "create CDS view"**
|
|
181
|
+
|
|
182
|
+
**Filename**: `src/zc_my_entity.ddls.xml`
|
|
183
|
+
|
|
184
|
+
```xml
|
|
185
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
186
|
+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
|
187
|
+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
188
|
+
<asx:values>
|
|
189
|
+
<DDLS>
|
|
190
|
+
<DDLNAME>ZC_MY_ENTITY</DDLNAME>
|
|
191
|
+
<DDLANGUAGE>E</DDLANGUAGE>
|
|
192
|
+
<DDTEXT>My CDS View Entity</DDTEXT>
|
|
193
|
+
<SOURCE_TYPE>W</SOURCE_TYPE>
|
|
194
|
+
</DDLS>
|
|
195
|
+
</asx:values>
|
|
196
|
+
</asx:abap>
|
|
197
|
+
</abapGit>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Key Points for CDS View Entities**:
|
|
201
|
+
1. **ABAP file extension**: Use `.ddls.asddls` (NOT `.ddls.abap`)
|
|
202
|
+
2. **XML file**: Use `.ddls.xml`
|
|
203
|
+
3. **DDLNAME**: Must match the CDS view entity name in the source
|
|
204
|
+
4. **SOURCE_TYPE**: `W` = View Entity (modern, recommended)
|
|
205
|
+
5. **Serializer**: Use `LCL_OBJECT_DDLS`
|
|
206
|
+
6. **Source file**: Use `define view entity` (no `@AbapCatalog.sqlViewName`)
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### CDS View (DDLS) - Legacy Only
|
|
211
|
+
|
|
212
|
+
**Only use when explicitly requested (e.g., "create legacy CDS view")**
|
|
175
213
|
|
|
176
214
|
**Filename**: `src/zc_my_view.ddls.xml`
|
|
177
215
|
|
|
@@ -191,12 +229,15 @@ abapGit needs XML files to:
|
|
|
191
229
|
</abapGit>
|
|
192
230
|
```
|
|
193
231
|
|
|
194
|
-
**Key Points for CDS Views**:
|
|
232
|
+
**Key Points for CDS Views (Legacy)**:
|
|
195
233
|
1. **ABAP file extension**: Use `.ddls.asddls` (NOT `.ddls.abap`)
|
|
196
234
|
2. **XML file**: Use `.ddls.xml`
|
|
197
235
|
3. **DDLNAME**: Must match the CDS view name in the source
|
|
198
|
-
4. **SOURCE_TYPE**: V = View
|
|
236
|
+
4. **SOURCE_TYPE**: `V` = View (legacy)
|
|
199
237
|
5. **Serializer**: Use `LCL_OBJECT_DDLS`
|
|
238
|
+
6. **Source file**: Must include `@AbapCatalog.sqlViewName` annotation
|
|
239
|
+
|
|
240
|
+
**For detailed comparison and usage guidance, see `guidelines/04_cds.md`**
|
|
200
241
|
|
|
201
242
|
---
|
|
202
243
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Common ABAP Errors
|
|
4
|
+
nav_order: 11
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Common ABAP Errors - Quick Fixes
|
|
10
|
+
|
|
11
|
+
**Searchable keywords**: error, syntax error, field mismatch, fixed point, comma, host variable, @ prefix, type incompatible
|
|
12
|
+
|
|
13
|
+
## Fixed Point Arithmetic Error
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
This ABAP SQL statement uses additions that can only be used when
|
|
17
|
+
the fixed point arithmetic flag is activated
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Fix**: Add `<FIXPT>X</FIXPT>` to class XML.
|
|
21
|
+
|
|
22
|
+
```xml
|
|
23
|
+
<VSEOCLASS>
|
|
24
|
+
...
|
|
25
|
+
<FIXPT>X</FIXPT>
|
|
26
|
+
</VSEOCLASS>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Field Name Mismatch
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
The field 'CARRIERID' does not have a corresponding field in the work area
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Fix**: Match structure field names with CDS view.
|
|
38
|
+
|
|
39
|
+
Check actual names: `abapgit-agent preview --objects <VIEW> --limit 1`
|
|
40
|
+
|
|
41
|
+
**Better fix**: Use CDS as type: `TYPE STANDARD TABLE OF zc_view WITH DEFAULT KEY`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Missing Commas in SELECT
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
The elements in the 'SELECT LIST' list must be separated using commas
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Fix**: `SELECT carrid, connid, fldate` (add commas between fields)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Missing @ Escape
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Either 'LT_RESULT' has to be escaped using '@' or qualified by a table name
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Fix**: `INTO TABLE @lt_result WHERE field = @lv_param` (add @ prefix)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Type Incompatible
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
The data type of the component 'OCCUPANCYPERCENT' is not compatible
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Fix for calculated CDS fields**: Use `TYPE decfloat34`
|
|
72
|
+
|
|
73
|
+
**Fix for other fields**: Use correct data element.
|
|
74
|
+
|
|
75
|
+
Find: `abapgit-agent view --objects <TABLE> --type TABL`
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Using Raw Types
|
|
80
|
+
|
|
81
|
+
```abap
|
|
82
|
+
❌ carrierid TYPE c LENGTH 3,
|
|
83
|
+
✅ carrierid TYPE s_carr_id,
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Rule**: Always use data elements, never raw types (c, n, p without reference).
|
|
87
|
+
|
|
88
|
+
Find data elements: `abapgit-agent view --objects <TABLE> --type TABL`
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## See Also
|
|
93
|
+
- **ABAP SQL** (01_sql.md) - for SQL syntax rules
|
|
94
|
+
- **CDS Views** (04_cds.md) - for CDS selection patterns
|
|
95
|
+
- **abapGit** (08_abapgit.md) - for XML metadata templates
|
package/package.json
CHANGED
package/src/commands/syntax.js
CHANGED
|
@@ -79,6 +79,10 @@ module.exports = {
|
|
|
79
79
|
} else if (baseName.includes('.prog.')) {
|
|
80
80
|
objType = 'PROG';
|
|
81
81
|
objName = baseName.split('.')[0].toUpperCase();
|
|
82
|
+
} else if (baseName.includes('.ddls.asddls')) {
|
|
83
|
+
objType = 'DDLS';
|
|
84
|
+
objName = baseName.split('.')[0].toUpperCase();
|
|
85
|
+
fileKind = 'main';
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
// Read source from file
|
|
@@ -103,11 +107,35 @@ module.exports = {
|
|
|
103
107
|
classFiles[fileKind] = source;
|
|
104
108
|
}
|
|
105
109
|
} else {
|
|
106
|
-
|
|
110
|
+
const obj = {
|
|
107
111
|
type: objType,
|
|
108
112
|
name: objName,
|
|
109
113
|
source: source
|
|
110
|
-
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Read FIXPT from XML metadata for INTF and PROG
|
|
117
|
+
if (objType === 'INTF' || objType === 'PROG') {
|
|
118
|
+
const dir = pathModule.dirname(filePath);
|
|
119
|
+
let xmlFile;
|
|
120
|
+
if (objType === 'INTF') {
|
|
121
|
+
xmlFile = pathModule.join(dir, `${objName.toLowerCase()}.intf.xml`);
|
|
122
|
+
} else if (objType === 'PROG') {
|
|
123
|
+
xmlFile = pathModule.join(dir, `${objName.toLowerCase()}.prog.xml`);
|
|
124
|
+
}
|
|
125
|
+
if (xmlFile && fs.existsSync(xmlFile)) {
|
|
126
|
+
const xmlContent = fs.readFileSync(xmlFile, 'utf8');
|
|
127
|
+
// Simple regex to extract FIXPT value
|
|
128
|
+
const fixptMatch = xmlContent.match(/<FIXPT>([^<]+)<\/FIXPT>/);
|
|
129
|
+
if (fixptMatch && fixptMatch[1] === 'X') {
|
|
130
|
+
obj.fixpt = 'X';
|
|
131
|
+
} else {
|
|
132
|
+
// No FIXPT tag means FIXPT=false (blank)
|
|
133
|
+
obj.fixpt = '';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
objects.push(obj);
|
|
111
139
|
}
|
|
112
140
|
}
|
|
113
141
|
|
|
@@ -180,6 +208,28 @@ module.exports = {
|
|
|
180
208
|
if (files.locals_def) obj.locals_def = files.locals_def;
|
|
181
209
|
if (files.locals_imp) obj.locals_imp = files.locals_imp;
|
|
182
210
|
if (files.testclasses) obj.testclasses = files.testclasses;
|
|
211
|
+
|
|
212
|
+
// Read FIXPT from XML metadata
|
|
213
|
+
const mainFile = syntaxFiles.find(f => {
|
|
214
|
+
const bn = pathModule.basename(f).toUpperCase();
|
|
215
|
+
return bn.startsWith(className) && bn.includes('.CLAS.ABAP') && !bn.includes('LOCALS') && !bn.includes('TESTCLASSES');
|
|
216
|
+
});
|
|
217
|
+
if (mainFile) {
|
|
218
|
+
const dir = pathModule.dirname(mainFile);
|
|
219
|
+
const xmlFile = pathModule.join(dir, `${className.toLowerCase()}.clas.xml`);
|
|
220
|
+
if (fs.existsSync(xmlFile)) {
|
|
221
|
+
const xmlContent = fs.readFileSync(xmlFile, 'utf8');
|
|
222
|
+
// Simple regex to extract FIXPT value
|
|
223
|
+
const fixptMatch = xmlContent.match(/<FIXPT>([^<]+)<\/FIXPT>/);
|
|
224
|
+
if (fixptMatch && fixptMatch[1] === 'X') {
|
|
225
|
+
obj.fixpt = 'X';
|
|
226
|
+
} else {
|
|
227
|
+
// No FIXPT tag means FIXPT=false (blank)
|
|
228
|
+
obj.fixpt = '';
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
183
233
|
objects.push(obj);
|
|
184
234
|
} else {
|
|
185
235
|
console.error(` Warning: No main class file for ${className}, skipping local files`);
|