abapgit-agent 1.8.0 → 1.8.2

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 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
- # Inspect source file for issues
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
@@ -73,30 +73,38 @@ The folder is configured in `.abapGitAgent` (property: `folder`):
73
73
 
74
74
  **Each ABAP object requires an XML metadata file for abapGit to understand how to handle it.**
75
75
 
76
- | Object Type | ABAP File (if folder=/src/) | XML File |
77
- |-------------|------------------------------|----------|
78
- | Class | `src/zcl_*.clas.abap` | `src/zcl_*.clas.xml` |
79
- | Interface | `src/zif_*.intf.abap` | `src/zif_*.intf.xml` |
80
- | Program | `src/z*.prog.abap` | `src/z*.prog.xml` |
81
- | Table | `src/z*.tabl.abap` | `src/z*.tabl.xml` |
82
- | CDS View | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` |
76
+ | Object Type | ABAP File (if folder=/src/) | XML File | Details |
77
+ |-------------|------------------------------|----------|---------|
78
+ | Class | `src/zcl_*.clas.abap` | `src/zcl_*.clas.xml` | See `guidelines/08_abapgit.md` |
79
+ | Interface | `src/zif_*.intf.abap` | `src/zif_*.intf.xml` | See `guidelines/08_abapgit.md` |
80
+ | Program | `src/z*.prog.abap` | `src/z*.prog.xml` | See `guidelines/08_abapgit.md` |
81
+ | Table | `src/z*.tabl.abap` | `src/z*.tabl.xml` | See `guidelines/08_abapgit.md` |
82
+ | **CDS View Entity** | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | **Use by default** - See `guidelines/04_cds.md` |
83
+ | CDS View (legacy) | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | Only if explicitly requested - See `guidelines/04_cds.md` |
83
84
 
84
- **Use `ref --topic abapgit` for complete XML templates.**
85
+ **IMPORTANT: When user says "create CDS view", create CDS View Entity by default.**
86
+
87
+ **Why:** Modern S/4HANA standard, simpler (no SQL view), no namespace conflicts.
88
+
89
+ **For complete XML templates, DDL examples, and detailed comparison:**
90
+ - **CDS Views**: `guidelines/04_cds.md`
91
+ - **XML templates**: `guidelines/08_abapgit.md`
85
92
 
86
93
  ---
87
94
 
88
- ### 4. Use Syntax Command Before Commit (for CLAS, INTF, PROG)
95
+ ### 4. Use Syntax Command Before Commit (for CLAS, INTF, PROG, DDLS)
89
96
 
90
97
  ```
91
98
  ❌ WRONG: Make changes → Commit → Push → Pull → Find errors → Fix → Repeat
92
99
  ✅ CORRECT: Make changes → Run syntax → Fix locally → Commit → Push → Pull → Done
93
100
  ```
94
101
 
95
- **For CLAS, INTF, PROG files**: Run `syntax` command BEFORE commit to catch errors early.
102
+ **For CLAS, INTF, PROG, DDLS files**: Run `syntax` command BEFORE commit to catch errors early.
96
103
 
97
104
  ```bash
98
105
  # Check syntax of local code (no commit/push needed)
99
106
  abapgit-agent syntax --files src/zcl_my_class.clas.abap
107
+ abapgit-agent syntax --files src/zc_my_view.ddls.asddls
100
108
 
101
109
  # Check multiple INDEPENDENT files
102
110
  abapgit-agent syntax --files src/zcl_utils.clas.abap,src/zcl_logger.clas.abap
@@ -260,15 +268,15 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
260
268
  3. Write code → place in correct folder (e.g., src/zcl_*.clas.abap)
261
269
 
262
270
 
263
- 4. Syntax check (for CLAS, INTF, PROG only)
271
+ 4. Syntax check (for CLAS, INTF, PROG, DDLS only)
264
272
 
265
- ├─► CLAS/INTF/PROG → abapgit-agent syntax --files <file>
273
+ ├─► CLAS/INTF/PROG/DDLS → abapgit-agent syntax --files <file>
266
274
  │ │
267
275
  │ ├─► Errors? → Fix locally (no commit needed), re-run syntax
268
276
  │ │
269
277
  │ └─► Clean ✅ → Proceed to commit
270
278
 
271
- └─► Other types (DDLS, FUGR, TABL, etc.) → Skip syntax, go to commit
279
+ └─► Other types (FUGR, TABL, etc.) → Skip syntax, go to commit
272
280
 
273
281
 
274
282
  5. Commit and push → git add . && git commit && git push
@@ -294,40 +302,95 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
294
302
  | CLAS (test classes: .testclasses.abap) | ✅ Supported | Run `syntax` before commit |
295
303
  | INTF (interfaces) | ✅ Supported | Run `syntax` before commit |
296
304
  | PROG (programs) | ✅ Supported | Run `syntax` before commit |
297
- | DDLS (CDS views) | Not supported | Skip syntax, use `pull` then `inspect` |
305
+ | DDLS (CDS views) | Supported | Run `syntax` before commit (requires annotations) |
298
306
  | FUGR (function groups) | ❌ Not supported | Skip syntax, use `pull` then `inspect` |
299
307
  | TABL/DTEL/DOMA/MSAG/SHLP | ❌ Not supported | Skip syntax, just `pull` |
300
308
  | All other types | ❌ Not supported | Skip syntax, just `pull` |
301
309
 
302
310
  **IMPORTANT**:
303
- - **Use `syntax` BEFORE commit** for CLAS/INTF/PROG (including test classes) - catches errors early, no git pollution
304
- - **Syntax checks files INDEPENDENTLY** - no cross-file dependency support (e.g., interface definition not available when checking implementing class)
305
- - **For dependent files** (interface + class, class + using class): Skip `syntax`, use `pull` directly
311
+ - **Use `syntax` BEFORE commit** for CLAS/INTF/PROG/DDLS - catches errors early, no git pollution
312
+ - **Syntax checks files INDEPENDENTLY** - syntax checker doesn't have access to uncommitted files
313
+ - **For dependent files** (interface + class): Create/activate underlying object FIRST, then dependent object (see workflow below)
314
+ - **DDLS requires proper annotations** - CDS views need `@AbapCatalog.sqlViewName`, view entities don't
306
315
  - **ALWAYS push to git BEFORE running pull** - abapGit reads from git
307
316
  - **Use `inspect` AFTER pull** for unsupported types or if pull fails
308
317
 
318
+ **Working with dependent objects (RECOMMENDED APPROACH):**
319
+
320
+ When creating objects with dependencies (e.g., interface → class), create and activate the underlying object FIRST:
321
+
322
+ ```bash
323
+ # Step 1: Create interface, syntax check, commit, activate
324
+ vim src/zif_my_interface.intf.abap
325
+ abapgit-agent syntax --files src/zif_my_interface.intf.abap # ✅ Works (no dependencies)
326
+ git add src/zif_my_interface.intf.abap src/zif_my_interface.intf.xml
327
+ git commit -m "feat: add interface"
328
+ git push
329
+ abapgit-agent pull --files src/zif_my_interface.intf.abap # Interface now activated
330
+
331
+ # Step 2: Create class, syntax check, commit, activate
332
+ vim src/zcl_my_class.clas.abap
333
+ abapgit-agent syntax --files src/zcl_my_class.clas.abap # ✅ Works (interface already activated)
334
+ git add src/zcl_my_class.clas.abap src/zcl_my_class.clas.xml
335
+ git commit -m "feat: add class implementing interface"
336
+ git push
337
+ abapgit-agent pull --files src/zcl_my_class.clas.abap
338
+ ```
339
+
340
+ **Benefits:**
341
+ - ✅ Syntax checking works for both objects
342
+ - ✅ Each step is validated independently
343
+ - ✅ Easier to debug if something fails
344
+ - ✅ Cleaner workflow
345
+
346
+ **Alternative approach (when interface design is uncertain):**
347
+
348
+ If the interface might need changes while implementing the class, commit both together:
349
+
350
+ ```bash
351
+ # Create both files
352
+ vim src/zif_my_interface.intf.abap
353
+ vim src/zcl_my_class.clas.abap
354
+
355
+ # Skip syntax (files depend on each other), commit together
356
+ git add src/zif_my_interface.intf.abap src/zif_my_interface.intf.xml
357
+ git add src/zcl_my_class.clas.abap src/zcl_my_class.clas.xml
358
+ git commit -m "feat: add interface and implementing class"
359
+ git push
360
+
361
+ # Pull both together
362
+ abapgit-agent pull --files src/zif_my_interface.intf.abap,src/zcl_my_class.clas.abap
363
+
364
+ # Use inspect if errors occur
365
+ abapgit-agent inspect --files src/zcl_my_class.clas.abap
366
+ ```
367
+
368
+ **Use this approach when:**
369
+ - ❌ Interface design is still evolving
370
+ - ❌ Multiple iterations expected
371
+
309
372
  **Working with mixed file types:**
310
373
  When modifying multiple files of different types (e.g., 1 class + 1 CDS view):
311
- 1. Run `syntax` on supported files only (CLAS, INTF, PROG) - **only if they're independent**
374
+ 1. Run `syntax` on independent supported files (CLAS, INTF, PROG, DDLS)
312
375
  2. Commit ALL files together (including unsupported types)
313
376
  3. Push and pull ALL files together
314
377
 
315
378
  Example:
316
379
  ```bash
317
- # Check syntax on independent class and interface only (skip CDS, skip if dependent)
318
- abapgit-agent syntax --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap
380
+ # Check syntax on independent files only
381
+ abapgit-agent syntax --files src/zcl_my_class.clas.abap,src/zc_my_view.ddls.asddls
319
382
 
320
- # Commit and push all files including CDS
321
- git add src/zcl_my_class.clas.abap src/zif_my_intf.intf.abap src/zc_my_view.ddls.asddls
322
- git commit -m "feat: add class, interface, and CDS view"
383
+ # Commit and push all files
384
+ git add src/zcl_my_class.clas.abap src/zc_my_view.ddls.asddls
385
+ git commit -m "feat: add class and CDS view"
323
386
  git push
324
387
 
325
388
  # Pull all files together
326
- abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,src/zc_my_view.ddls.asddls
389
+ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zc_my_view.ddls.asddls
327
390
  ```
328
391
 
329
392
  **When to use syntax vs inspect vs view**:
330
- - **syntax**: Check LOCAL code BEFORE commit (CLAS, INTF, PROG only)
393
+ - **syntax**: Check LOCAL code BEFORE commit (CLAS, INTF, PROG, DDLS)
331
394
  - **inspect**: Check ACTIVATED code AFTER pull (all types, runs Code Inspector)
332
395
  - **view**: Understand object STRUCTURE (not for debugging errors)
333
396
 
@@ -337,29 +400,63 @@ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,
337
400
 
338
401
  ```
339
402
  1. Identify file extension(s) AND dependencies
340
- ├─ .clas.abap or .clas.testclasses.abap → CLAS ✅ syntax supported (if independent)
341
- ├─ .intf.abap → INTF ✅ syntax supported (if independent)
403
+ ├─ .clas.abap or .clas.testclasses.abap → CLAS ✅ syntax supported
404
+ ├─ .intf.abap → INTF ✅ syntax supported
342
405
  ├─ .prog.abap → PROG ✅ syntax supported
343
- ├─ .ddls.asddls → DDLS syntax not supported
406
+ ├─ .ddls.asddls → DDLS syntax supported (requires proper annotations)
344
407
  └─ All other extensions → ❌ syntax not supported
345
408
 
346
409
  2. Check for dependencies:
347
- ├─ Interface + implementing class? → Dependencies exist
348
- ├─ Class A uses class B? → Dependencies exist
349
- ├─ New objects that don't exist in ABAP system? → Check if they depend on each other
350
- └─ Unrelated bug fixes across files? → No dependencies
351
-
352
- 3. For SUPPORTED types (CLAS/INTF/PROG):
353
- ├─ Independent files → Run syntax → Fix errors → Commit → Push → Pull
354
- └─ Dependent files → Skip syntax → Commit → Push → Pull
410
+ ├─ Interface + implementing class? → DEPENDENT (interface is underlying)
411
+ ├─ Class A uses class B? → DEPENDENT (class B is underlying)
412
+ ├─ CDS view uses table? → INDEPENDENT (table already exists)
413
+ └─ Unrelated bug fixes across files? → INDEPENDENT
414
+
415
+ 3. For SUPPORTED types (CLAS/INTF/PROG/DDLS):
416
+ ├─ INDEPENDENT files → Run syntax → Fix errors → Commit → Push → Pull
417
+
418
+ └─ DEPENDENT files (NEW objects):
419
+ ├─ RECOMMENDED: Create underlying object first (interface, base class, etc.)
420
+ │ 1. Create underlying object → Syntax → Commit → Push → Pull
421
+ │ 2. Create dependent object → Syntax (works!) → Commit → Push → Pull
422
+ │ ✅ Benefits: Both syntax checks work, cleaner workflow
423
+
424
+ └─ ALTERNATIVE: If interface design uncertain, commit both together
425
+ → Skip syntax → Commit both → Push → Pull → (if errors: inspect)
355
426
 
356
- 4. For UNSUPPORTED types (DDLS, FUGR, TABL, etc.):
427
+ 4. For UNSUPPORTED types (FUGR, TABL, etc.):
357
428
  Write code → Skip syntax → Commit → Push → Pull → (if errors: inspect)
358
429
 
359
430
  5. For MIXED types (some supported + some unsupported):
360
431
  Write all code → Run syntax on independent supported files ONLY → Commit ALL → Push → Pull ALL
361
432
  ```
362
433
 
434
+ **Example workflows:**
435
+
436
+ **Scenario 1: Interface + Class (RECOMMENDED)**
437
+ ```bash
438
+ # Step 1: Interface first
439
+ vim src/zif_calculator.intf.abap
440
+ abapgit-agent syntax --files src/zif_calculator.intf.abap # ✅ Works
441
+ git commit -am "feat: add calculator interface" && git push
442
+ abapgit-agent pull --files src/zif_calculator.intf.abap # Interface activated
443
+
444
+ # Step 2: Class next
445
+ vim src/zcl_calculator.clas.abap
446
+ abapgit-agent syntax --files src/zcl_calculator.clas.abap # ✅ Works (interface exists!)
447
+ git commit -am "feat: implement calculator" && git push
448
+ abapgit-agent pull --files src/zcl_calculator.clas.abap
449
+ ```
450
+
451
+ **Scenario 2: Multiple independent classes**
452
+ ```bash
453
+ # All syntax checks work (no dependencies)
454
+ vim src/zcl_class1.clas.abap src/zcl_class2.clas.abap
455
+ abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
456
+ git commit -am "feat: add utility classes" && git push
457
+ abapgit-agent pull --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
458
+ ```
459
+
363
460
  **Error indicators after pull:**
364
461
  - ❌ **"Error updating where-used list"** → SYNTAX ERROR - run `inspect` for details
365
462
  - ❌ **Objects in "Failed Objects Log"** → SYNTAX ERROR - run `inspect`
@@ -369,9 +466,10 @@ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,
369
466
  ### Commands
370
467
 
371
468
  ```bash
372
- # 1. Syntax check LOCAL code BEFORE commit (CLAS, INTF, PROG only)
469
+ # 1. Syntax check LOCAL code BEFORE commit (CLAS, INTF, PROG, DDLS)
373
470
  abapgit-agent syntax --files src/zcl_my_class.clas.abap
374
- abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zif_intf1.intf.abap
471
+ abapgit-agent syntax --files src/zc_my_view.ddls.asddls
472
+ abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zif_intf1.intf.abap,src/zc_view.ddls.asddls
375
473
 
376
474
  # 2. Pull/activate AFTER pushing to git
377
475
  abapgit-agent pull --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
@@ -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
- ### XML Metadata File (`.ddls.xml`)
52
-
53
- ```xml
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. **Pull all files to activate** - When activating CDS views, use `abapgit-agent pull` (not single file) to ensure proper activation:
73
- ```bash
74
- abapgit-agent pull # Pull all files
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
- ### Debugging Activation Errors
80
-
81
- When pull shows generic errors like "Activation cancelled. Check the inactive objects":
151
+ ### Activating CDS Views
82
152
 
83
- 1. **Check in ADT/Eclipse** - Open the DDL source in ADT and run syntax check for detailed errors
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
- ## Creating CDS View Entities
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 Entities (`define view entity`) are the modern replacement for CDS Views with additional features like **associations for OData navigation**.
159
+ ## CDS View Entity Features
89
160
 
90
- ### Differences from CDS Views
161
+ CDS View Entities are the modern replacement for CDS Views with enhanced features like **associations for OData navigation**.
91
162
 
92
- | Aspect | CDS View | View Entity |
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, C = Consumption
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abapgit-agent",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -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
- objects.push({
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`);