abapgit-agent 1.11.1 → 1.11.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/abap/.github/copilot-instructions.md +9 -9
- package/abap/CLAUDE.md +48 -539
- package/abap/guidelines/{08_abapgit.md → abapgit.md} +1 -1
- package/abap/guidelines/branch-workflow.md +137 -0
- package/abap/guidelines/cds-testing.md +25 -0
- package/abap/guidelines/{04_cds.md → cds.md} +4 -4
- package/abap/guidelines/{10_common_errors.md → common-errors.md} +3 -3
- package/abap/guidelines/debug-dump.md +33 -0
- package/abap/guidelines/debug-session.md +280 -0
- package/abap/guidelines/index.md +50 -0
- package/abap/guidelines/object-creation.md +51 -0
- package/abap/guidelines/{06_objects.md → objects.md} +2 -2
- package/abap/guidelines/{01_sql.md → sql.md} +2 -2
- package/abap/guidelines/{03_testing.md → testing.md} +3 -3
- package/abap/guidelines/workflow-detailed.md +255 -0
- package/package.json +1 -1
- package/src/commands/debug.js +54 -20
- package/src/commands/inspect.js +5 -3
- package/src/commands/pull.js +4 -1
- package/src/commands/transport.js +3 -1
- package/src/commands/unit.js +10 -10
- package/src/commands/view.js +238 -1
- package/src/utils/abap-http.js +6 -1
- package/src/utils/abap-reference.js +4 -4
- package/src/utils/adt-http.js +6 -1
- package/src/utils/format-error.js +89 -0
- package/abap/guidelines/00_index.md +0 -44
- /package/abap/guidelines/{05_classes.md → classes.md} +0 -0
- /package/abap/guidelines/{02_exceptions.md → exceptions.md} +0 -0
- /package/abap/guidelines/{07_json.md → json.md} +0 -0
- /package/abap/guidelines/{09_unit_testable_code.md → unit-testable-code.md} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Branch Workflow
|
|
4
|
+
nav_order: 14
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Branch Workflow
|
|
10
|
+
|
|
11
|
+
#### Starting a New Feature
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 1. Create and switch to feature branch from default branch
|
|
15
|
+
git checkout main # or master/develop (auto-detected)
|
|
16
|
+
git pull origin main
|
|
17
|
+
git checkout -b feature/user-authentication
|
|
18
|
+
|
|
19
|
+
# 2. Make your changes
|
|
20
|
+
edit src/zcl_auth_handler.clas.abap
|
|
21
|
+
|
|
22
|
+
# 3. Check syntax (CLAS/INTF/PROG/DDLS only, if independent)
|
|
23
|
+
abapgit-agent syntax --files src/zcl_auth_handler.clas.abap
|
|
24
|
+
|
|
25
|
+
# 4. Commit
|
|
26
|
+
git add src/zcl_auth_handler.clas.abap
|
|
27
|
+
git commit -m "feat: add authentication handler"
|
|
28
|
+
|
|
29
|
+
# 5. Push feature branch
|
|
30
|
+
git push origin feature/user-authentication
|
|
31
|
+
|
|
32
|
+
# 6. **CRITICAL**: Rebase before pull
|
|
33
|
+
git fetch origin main
|
|
34
|
+
git rebase origin/main
|
|
35
|
+
git push origin feature/user-authentication --force-with-lease
|
|
36
|
+
|
|
37
|
+
# 7. Pull to ABAP system
|
|
38
|
+
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### During Development: Always Rebase Before Pull
|
|
42
|
+
|
|
43
|
+
**CRITICAL**: Before every `pull` command, rebase to default branch to avoid activating outdated code.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Before EVERY pull, always do this:
|
|
47
|
+
git fetch origin main # main/master/develop (auto-detected)
|
|
48
|
+
git rebase origin/main
|
|
49
|
+
|
|
50
|
+
# If no conflicts:
|
|
51
|
+
git push origin feature/user-authentication --force-with-lease
|
|
52
|
+
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
53
|
+
|
|
54
|
+
# If conflicts:
|
|
55
|
+
# 1. Fix conflicts in files
|
|
56
|
+
# 2. git add <resolved-files>
|
|
57
|
+
# 3. git rebase --continue
|
|
58
|
+
# 4. git push origin feature/user-authentication --force-with-lease
|
|
59
|
+
# 5. abapgit-agent pull --files ...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Completing the Feature
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 1. Final rebase and push
|
|
66
|
+
git fetch origin main
|
|
67
|
+
git rebase origin/main
|
|
68
|
+
git push origin feature/user-authentication --force-with-lease
|
|
69
|
+
|
|
70
|
+
# 2. Final activation and test
|
|
71
|
+
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
72
|
+
abapgit-agent unit --files src/zcl_auth_handler.clas.testclasses.abap
|
|
73
|
+
|
|
74
|
+
# 3. Create PR (squash merge enabled on GitHub/GitLab)
|
|
75
|
+
# Go to GitHub and create PR from feature/user-authentication to main
|
|
76
|
+
# Select "Squash and merge" option to combine all commits into one
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Why Rebase Before Pull?
|
|
80
|
+
|
|
81
|
+
ABAP is a **centralized system**. Multiple developers may modify the same files:
|
|
82
|
+
|
|
83
|
+
| Without Rebase | With Rebase |
|
|
84
|
+
|----------------|-------------|
|
|
85
|
+
| ✗ Your branch is based on old main | ✓ Your branch includes latest changes |
|
|
86
|
+
| ✗ Activate outdated code in ABAP | ✓ Activate current code |
|
|
87
|
+
| ✗ May overwrite others' work | ✓ Conflicts caught before activation |
|
|
88
|
+
| ✗ Hard to debug issues | ✓ Clear what changed |
|
|
89
|
+
|
|
90
|
+
**Example Scenario:**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Situation:
|
|
94
|
+
- You: working on feature/auth (based on main commit A)
|
|
95
|
+
- Colleague: pushed to main (now at commit B)
|
|
96
|
+
- Both modified: src/zcl_auth_handler.clas.abap
|
|
97
|
+
|
|
98
|
+
Without rebase:
|
|
99
|
+
feature/auth pull → activates version from commit A ✗
|
|
100
|
+
|
|
101
|
+
With rebase:
|
|
102
|
+
git rebase origin/main → either:
|
|
103
|
+
- No conflict: includes colleague's changes ✓
|
|
104
|
+
- Conflict: you see it and resolve ✓
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Complete Example Workflow (Branch Mode)
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Day 1: Start feature
|
|
111
|
+
git checkout main && git pull origin main
|
|
112
|
+
git checkout -b feature/user-authentication
|
|
113
|
+
edit src/zcl_auth_handler.clas.abap
|
|
114
|
+
abapgit-agent syntax --files src/zcl_auth_handler.clas.abap
|
|
115
|
+
git add . && git commit -m "wip: add basic auth logic"
|
|
116
|
+
git push origin feature/user-authentication
|
|
117
|
+
git fetch origin main && git rebase origin/main
|
|
118
|
+
git push origin feature/user-authentication --force-with-lease
|
|
119
|
+
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
120
|
+
|
|
121
|
+
# Day 2: Continue (colleague pushed to main overnight)
|
|
122
|
+
git fetch origin main && git rebase origin/main
|
|
123
|
+
# If conflicts: resolve, git add, git rebase --continue
|
|
124
|
+
git push origin feature/user-authentication --force-with-lease
|
|
125
|
+
edit src/zcl_auth_handler.clas.abap
|
|
126
|
+
git add . && git commit -m "feat: complete auth logic"
|
|
127
|
+
git push origin feature/user-authentication
|
|
128
|
+
git fetch origin main && git rebase origin/main
|
|
129
|
+
git push origin feature/user-authentication --force-with-lease
|
|
130
|
+
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
131
|
+
|
|
132
|
+
# Day 3: Finish feature
|
|
133
|
+
abapgit-agent unit --files src/zcl_auth_handler.clas.testclasses.abap
|
|
134
|
+
git fetch origin main && git rebase origin/main
|
|
135
|
+
git push origin feature/user-authentication --force-with-lease
|
|
136
|
+
# Create PR on GitHub/GitLab (squash 3 commits into 1)
|
|
137
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: CDS Testing
|
|
4
|
+
nav_order: 17
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# CDS Testing
|
|
10
|
+
|
|
11
|
+
### Use CDS Test Double Framework for CDS View Tests
|
|
12
|
+
|
|
13
|
+
**When creating unit tests for CDS views, use the CDS Test Double Framework (`CL_CDS_TEST_ENVIRONMENT`).**
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
❌ WRONG: Use regular AUnit test class without test doubles
|
|
17
|
+
✅ CORRECT: Use CL_CDS_TEST_ENVIRONMENT to create test doubles for CDS views
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Why**: CDS views read from database tables. Using test doubles allows:
|
|
21
|
+
- Injecting test data without affecting production data
|
|
22
|
+
- Testing specific scenarios that may not exist in production
|
|
23
|
+
- Fast, isolated tests that don't depend on database state
|
|
24
|
+
|
|
25
|
+
See `guidelines/testing.md` for code examples.
|
|
@@ -19,7 +19,7 @@ grand_parent: ABAP Development
|
|
|
19
19
|
- Key Field Ordering (STRICT RULE) - line 198
|
|
20
20
|
- Currency/Amount Field Aggregation - line 230
|
|
21
21
|
- Choosing Currency Fields for Aggregation - line 255
|
|
22
|
-
6. CDS Test Doubles - see
|
|
22
|
+
6. CDS Test Doubles - see testing.md
|
|
23
23
|
|
|
24
24
|
## Creating CDS Views (DDLS)
|
|
25
25
|
|
|
@@ -354,6 +354,6 @@ abapgit-agent preview --objects ZC_MY_VIEW --limit 1
|
|
|
354
354
|
---
|
|
355
355
|
|
|
356
356
|
## See Also
|
|
357
|
-
- **Unit Testing** (
|
|
358
|
-
- **abapGit** (
|
|
359
|
-
- **ABAP SQL** (
|
|
357
|
+
- **Unit Testing** (testing.md) - for CDS Test Double Framework
|
|
358
|
+
- **abapGit** (abapgit.md) - for CDS XML metadata templates
|
|
359
|
+
- **ABAP SQL** (sql.md) - for SQL functions used in CDS
|
|
@@ -90,6 +90,6 @@ Find data elements: `abapgit-agent view --objects <TABLE> --type TABL`
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
92
|
## See Also
|
|
93
|
-
- **ABAP SQL** (
|
|
94
|
-
- **CDS Views** (
|
|
95
|
-
- **abapGit** (
|
|
93
|
+
- **ABAP SQL** (sql.md) - for SQL syntax rules
|
|
94
|
+
- **CDS Views** (cds.md) - for CDS selection patterns
|
|
95
|
+
- **abapGit** (abapgit.md) - for XML metadata templates
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Dump Analysis Guide
|
|
4
|
+
nav_order: 13
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Dump Analysis Guide
|
|
10
|
+
|
|
11
|
+
#### When Something Goes Wrong — Start with `dump`
|
|
12
|
+
|
|
13
|
+
**First reflex** for any HTTP 500, runtime error, or user-reported crash:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
abapgit-agent dump --date TODAY # list today's dumps
|
|
17
|
+
abapgit-agent dump --date TODAY --detail 1 # full detail: call stack + source
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `--detail` output shows the exact failing line (`>>>>>` marker), call stack,
|
|
21
|
+
and SAP's error analysis. Use it before asking the user to open ST22.
|
|
22
|
+
|
|
23
|
+
Common filters:
|
|
24
|
+
```bash
|
|
25
|
+
abapgit-agent dump --user DEVELOPER --date TODAY # specific user
|
|
26
|
+
abapgit-agent dump --error TIME_OUT # specific error type
|
|
27
|
+
abapgit-agent dump --program ZMY_PROGRAM --detail 1 # specific program, full detail
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
After identifying the failing class/method, use `view` for broader context:
|
|
31
|
+
```bash
|
|
32
|
+
abapgit-agent view --objects ZCL_MY_CLASS
|
|
33
|
+
```
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Debug Session Guide
|
|
4
|
+
nav_order: 12
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Debug Session Guide
|
|
10
|
+
|
|
11
|
+
#### When There Is No Dump — Use `debug`
|
|
12
|
+
|
|
13
|
+
Use `debug` when:
|
|
14
|
+
- The bug is a logic error (wrong output, no crash)
|
|
15
|
+
- You need to inspect variable values mid-execution
|
|
16
|
+
- You want to verify which branch of code runs
|
|
17
|
+
|
|
18
|
+
**Step 1 — set a breakpoint** on the first executable statement you want to inspect:
|
|
19
|
+
|
|
20
|
+
Use `view --objects ZCL_MY_CLASS --full --lines` to see the full source with **both** global assembled-source line numbers and include-relative `[N]` numbers:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
abapgit-agent view --objects ZCL_MY_CLASS --full --lines
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> **Tip**: `view --full` (without `--lines`) shows the same full source as clean readable code without line numbers — useful for understanding logic. Add `--lines` when you need line numbers for breakpoints.
|
|
27
|
+
|
|
28
|
+
Each line is shown as `G [N] code` where:
|
|
29
|
+
- **G** = assembled-source global line → use with `debug set --objects CLASS:G` or `debug set --files src/cls.clas.abap:G`
|
|
30
|
+
- **[N]** = include-relative (restarts at 1 per method) → for code navigation only, not for breakpoints
|
|
31
|
+
|
|
32
|
+
The method header shows the ready-to-use `debug set` command pointing to the first executable line:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
1 CLASS zcl_my_class DEFINITION.
|
|
36
|
+
2 PUBLIC SECTION.
|
|
37
|
+
3 ENDCLASS.
|
|
38
|
+
* ---- Method: EXECUTE (CM002) — breakpoint: debug set --objects ZCL_MY_CLASS:9 ----
|
|
39
|
+
7 [ 1] METHOD execute.
|
|
40
|
+
8 [ 2] DATA lv_x TYPE i.
|
|
41
|
+
9 [ 3] lv_x = 1.
|
|
42
|
+
10 [ 4] ENDMETHOD.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Two scenarios:**
|
|
46
|
+
|
|
47
|
+
| Scenario | Command |
|
|
48
|
+
|---|---|
|
|
49
|
+
| Source available locally (your own classes) | `debug set --files src/zcl_my_class.clas.abap:9` |
|
|
50
|
+
| No local source (abapGit library, SAP standard) | `debug set --objects ZCL_MY_CLASS:9` |
|
|
51
|
+
|
|
52
|
+
Both use the same assembled-source global line number **G** shown in the output. To set a breakpoint at `lv_x = 1.` (global line 9):
|
|
53
|
+
```bash
|
|
54
|
+
# With local file:
|
|
55
|
+
abapgit-agent debug set --files src/zcl_my_class.clas.abap:9
|
|
56
|
+
# Without local file:
|
|
57
|
+
abapgit-agent debug set --objects ZCL_MY_CLASS:9
|
|
58
|
+
abapgit-agent debug list # confirm it was registered
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Line number must point to an executable statement.** The method header hint already skips the `METHOD` line, blank lines, and `DATA`/`FINAL`/`TYPES`/`CONSTANTS` declarations automatically. Two cases still require manual attention when picking a line from the output:
|
|
62
|
+
>
|
|
63
|
+
> 1. **Comment lines** — lines starting with `"` are never executable. ADT silently rejects the breakpoint.
|
|
64
|
+
> Pick the next non-comment line instead.
|
|
65
|
+
> ```
|
|
66
|
+
> 95 [ 70] " --- Conflict detection --- ← NOT valid (comment)
|
|
67
|
+
> 96 [ 71] " Build remote file entries… ← NOT valid (comment)
|
|
68
|
+
> 97 [ 73] DATA(lt_file_entries) = … ← valid ✅ (use global 97)
|
|
69
|
+
> ```
|
|
70
|
+
>
|
|
71
|
+
> 2. **First line of a multi-line inline `DATA(x) = call(`** — the ABAP debugger treats the
|
|
72
|
+
> `DATA(x) =` line as a declaration, not an executable step. Set the breakpoint on the
|
|
73
|
+
> **next standalone executable statement** after the closing `).` instead.
|
|
74
|
+
> ```
|
|
75
|
+
> 100 [ 92] DATA(ls_checks) = prepare_deserialize_checks( ← NOT valid (inline decl)
|
|
76
|
+
> 101 [ 93] it_files = it_files ← NOT valid (continuation)
|
|
77
|
+
> 104 [ 96] io_repo_desc = lo_repo_desc1 ). ← NOT valid (continuation)
|
|
78
|
+
> 106 [ 98] mo_repo->create_new_log( ). ← valid ✅ (use global 106)
|
|
79
|
+
> ```
|
|
80
|
+
>
|
|
81
|
+
> Other non-executable lines: blank lines, `METHOD`/`ENDMETHOD`, `DATA:` declarations,
|
|
82
|
+
> `CLASS`/`ENDCLASS`. When in doubt, prefer a simple method call or assignment.
|
|
83
|
+
|
|
84
|
+
**Step 2 — attach and trigger**
|
|
85
|
+
|
|
86
|
+
Best practice: individual sequential calls. Once the daemon is running and
|
|
87
|
+
the session is saved to the state file, each `vars/stack/step` command is a
|
|
88
|
+
plain standalone call — no `--session` flag needed.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Start attach listener in background (spawns a daemon, saves session to state file)
|
|
92
|
+
abapgit-agent debug attach --json > /tmp/attach.json 2>&1 &
|
|
93
|
+
|
|
94
|
+
# Rule 1: wait for "Listener active" in the output, THEN fire the trigger.
|
|
95
|
+
# attach --json prints "Listener active" to stderr (captured in attach.json) the
|
|
96
|
+
# moment the long-poll POST is about to be sent to ADT. Waiting for this marker
|
|
97
|
+
# is reliable under any system load; a blind sleep may fire the trigger before
|
|
98
|
+
# ADT has a registered listener, causing the breakpoint hit to be missed.
|
|
99
|
+
until grep -q "Listener active" /tmp/attach.json 2>/dev/null; do sleep 0.3; done
|
|
100
|
+
sleep 1 # brief extra window for the POST to reach ADT
|
|
101
|
+
|
|
102
|
+
# Trigger in background — MUST stay alive for the whole session
|
|
103
|
+
abapgit-agent unit --files src/zcl_my_class.clas.testclasses.abap > /tmp/trigger.json 2>&1 &
|
|
104
|
+
|
|
105
|
+
# Poll until breakpoint fires and session JSON appears in attach output
|
|
106
|
+
SESSION=""
|
|
107
|
+
for i in $(seq 1 30); do
|
|
108
|
+
sleep 0.5
|
|
109
|
+
SESSION=$(grep -o '"session":"[^"]*"' /tmp/attach.json 2>/dev/null | head -1 | cut -d'"' -f4)
|
|
110
|
+
[ -n "$SESSION" ] && break
|
|
111
|
+
done
|
|
112
|
+
|
|
113
|
+
# Inspect and step — each is an individual call, no --session needed
|
|
114
|
+
abapgit-agent debug stack --json
|
|
115
|
+
abapgit-agent debug vars --json
|
|
116
|
+
abapgit-agent debug vars --expand LS_OBJECT --json
|
|
117
|
+
abapgit-agent debug step --type over --json
|
|
118
|
+
abapgit-agent debug vars --json
|
|
119
|
+
|
|
120
|
+
# ALWAYS release the ABAP work process before finishing
|
|
121
|
+
abapgit-agent debug step --type continue --json
|
|
122
|
+
|
|
123
|
+
# Check trigger result
|
|
124
|
+
cat /tmp/trigger.json
|
|
125
|
+
rm -f /tmp/attach.json /tmp/trigger.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **Four rules for scripted mode:**
|
|
129
|
+
> 1. Wait for `"Listener active"` in the attach output before firing the trigger — this message is printed to stderr (captured in `attach.json`) the moment the listener POST is about to reach ADT. A blind `sleep` is not reliable under system load.
|
|
130
|
+
> 2. Keep the trigger process alive in the background for the entire session — if it exits, the ABAP work process is released and the session ends
|
|
131
|
+
> 3. Always finish with `step --type continue` — this releases the frozen work process so the trigger can complete normally
|
|
132
|
+
> 4. **Never pass `--session` to `step/vars/stack`** — it bypasses the daemon IPC and causes `noSessionAttached`. Omit it and let commands auto-load from the saved state file.
|
|
133
|
+
|
|
134
|
+
**Step 3 — step through and inspect**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
abapgit-agent debug vars --json # all variables
|
|
138
|
+
abapgit-agent debug vars --name LV_RESULT --json # one variable
|
|
139
|
+
abapgit-agent debug vars --expand LT_DATA --json # drill into table/structure
|
|
140
|
+
abapgit-agent debug step --type over --json # step over
|
|
141
|
+
abapgit-agent debug step --type into --json # step into
|
|
142
|
+
abapgit-agent debug step --type continue --json # continue to next breakpoint / finish
|
|
143
|
+
abapgit-agent debug stack --json # call stack (shows which test method is active)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> **`step --type continue` return values:**
|
|
147
|
+
> - `{"continued":true,"finished":true}` — program ran to **completion** (ADT returned HTTP 500, session is over). Do not re-attach.
|
|
148
|
+
> - `{"continued":true}` (no `finished` field) — program hit the **next breakpoint** and is still paused. You must re-attach to receive the suspension and continue inspecting:
|
|
149
|
+
> ```bash
|
|
150
|
+
> abapgit-agent debug attach --json > /tmp/attach2.json 2>&1 &
|
|
151
|
+
> until grep -q "Listener active" /tmp/attach2.json 2>/dev/null; do sleep 0.3; done
|
|
152
|
+
> # session auto-resumes — no trigger needed (trigger is still running in background)
|
|
153
|
+
> SESSION=""
|
|
154
|
+
> for i in $(seq 1 30); do
|
|
155
|
+
> sleep 0.5
|
|
156
|
+
> SESSION=$(grep -o '"session":"[^"]*"' /tmp/attach2.json 2>/dev/null | head -1 | cut -d'"' -f4)
|
|
157
|
+
> [ -n "$SESSION" ] && break
|
|
158
|
+
> done
|
|
159
|
+
> abapgit-agent debug vars --json # inspect at next breakpoint
|
|
160
|
+
> abapgit-agent debug step --type continue --json # release again
|
|
161
|
+
> ```
|
|
162
|
+
> Missing this re-attach step causes the session to appear dead when it is actually paused at the next breakpoint.
|
|
163
|
+
|
|
164
|
+
**Clean up** when done:
|
|
165
|
+
```bash
|
|
166
|
+
abapgit-agent debug delete --all
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> **If the stale debug daemon holds an ABAP lock** (symptom: `Requested object EZABAPGIT is currently locked by user CAIS`):
|
|
170
|
+
> ```bash
|
|
171
|
+
> pkill -f "debug-daemon" # kills daemon, SIGTERM triggers session.terminate() internally
|
|
172
|
+
> ```
|
|
173
|
+
> Wait ~10 seconds for the lock to release, then retry.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Debugged Pull Flow Architecture
|
|
178
|
+
|
|
179
|
+
The following call chain was traced by live debugging (2026-03), verified with two breakpoints firing successfully. Use as a reference for setting breakpoints when investigating pull issues:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
HTTP Request
|
|
183
|
+
→ SAPMHTTP (%_HTTP_START) [frame 1]
|
|
184
|
+
→ SAPLHTTP_RUNTIME (HTTP_DISPATCH_REQUEST) [frame 2]
|
|
185
|
+
→ CL_HTTP_SERVER (EXECUTE_REQUEST) [frame 3]
|
|
186
|
+
→ CL_REST_HTTP_HANDLER (IF_HTTP_EXTENSION~HANDLE_REQUEST) [frame 4]
|
|
187
|
+
→ CL_REST_ROUTER (IF_REST_HANDLER~HANDLE) [frame 5]
|
|
188
|
+
→ CL_REST_RESOURCE (IF_REST_HANDLER~HANDLE, DO_HANDLE_CONDITIONAL, DO_HANDLE) [frames 6-8]
|
|
189
|
+
→ ZCL_ABGAGT_RESOURCE_BASE (IF_REST_RESOURCE~POST, CM004:84) [frame 9]
|
|
190
|
+
→ ZCL_ABGAGT_COMMAND_PULL (ZIF_ABGAGT_COMMAND~EXECUTE, CM001:21) [frame 10]
|
|
191
|
+
→ ZCL_ABGAGT_AGENT (ZIF_ABGAGT_AGENT~PULL, CM00D) [frame 11]
|
|
192
|
+
CM00D: build_file_entries_from_remote() — fetch remote files + acquire EZABAPGIT lock
|
|
193
|
+
CM00D: check_conflicts() — abort if conflicts found (LT_CONFLICTS)
|
|
194
|
+
CM00D: prepare_deserialize_checks() — transport + requirements; returns LS_CHECKS
|
|
195
|
+
(LS_CHECKS-OVERWRITE[n] = objects to overwrite)
|
|
196
|
+
CM00D: mo_repo->create_new_log() :207 — init abapGit log object
|
|
197
|
+
CM00D: RTTI check (lv_deser_has_filter) — does ZIF_ABAPGIT_REPO~DESERIALIZE have
|
|
198
|
+
II_OBJ_FILTER parameter? (X = yes)
|
|
199
|
+
CM00D: CALL METHOD mo_repo->('DESERIALIZE') :236 — dynamic dispatch with PARAMETER-TABLE
|
|
200
|
+
(IS_CHECKS, II_LOG, II_OBJ_FILTER)
|
|
201
|
+
→ ZCL_ABAPGIT_REPO (ZIF_ABAPGIT_REPO~DESERIALIZE, CM00L) [frame 12]
|
|
202
|
+
CM00L: find_remote_dot_abapgit() :525 — fetch .abapgit from remote; COMMIT WORK
|
|
203
|
+
AND WAIT inside → releases EZABAPGIT lock
|
|
204
|
+
CM00L: find_remote_dot_apack() :526 — fetch .apack-manifest
|
|
205
|
+
CM00L: check_write_protect() :528 — package write-protect check
|
|
206
|
+
CM00L: check_language() :529 — language check
|
|
207
|
+
CM00L: (requirements/dependencies checks) :531 — abort if not met
|
|
208
|
+
CM00L: deserialize_dot_abapgit() :543 — update .abapgit config in ABAP
|
|
209
|
+
populates LT_UPDATED_FILES (e.g. .abapgit.xml)
|
|
210
|
+
CM00L: deserialize_objects(is_checks, ii_log, ii_obj_filter) :545
|
|
211
|
+
→ ZCL_ABAPGIT_REPO (DESERIALIZE_OBJECTS, CM007:258) [frame 13]
|
|
212
|
+
CM007: zcl_abapgit_objects=>deserialize(ii_repo=me, ..., ii_obj_filter=...) :259
|
|
213
|
+
→ ZCL_ABAPGIT_OBJECTS (DESERIALIZE static, CM00A) [frame 14]
|
|
214
|
+
CM00A: lt_steps = get_deserialize_steps() :617 — 4-step pipeline
|
|
215
|
+
CM00A: lv_package = ii_repo->get_package() :619
|
|
216
|
+
CM00A: lt_remote = get_files_remote(ii_obj_filter=...) :628 — filtered remote files
|
|
217
|
+
CM00A: lt_results = zcl_abapgit_file_deserialize=>get_results(...) :631
|
|
218
|
+
CM00A: zcl_abapgit_objects_check=>checks_adjust(...) :640
|
|
219
|
+
CM00A: check_objects_locked(lt_items) :657
|
|
220
|
+
CM00A: LOOP steps → LOOP objects → call type handler:
|
|
221
|
+
Step 1 Pre-process: ZCL_ABGAGT_VIEWER_CLAS imported
|
|
222
|
+
Step 2 DDIC: (nothing for CLAS)
|
|
223
|
+
Step 3 Non-DDIC: ZCL_ABGAGT_VIEWER_CLAS imported + activated
|
|
224
|
+
Step 4 Post-process: ZCL_ABGAGT_VIEWER_CLAS imported
|
|
225
|
+
CM00A: returns RT_ACCESSED_FILES
|
|
226
|
+
← back in CM00L:
|
|
227
|
+
CM00L: checksums()->update()
|
|
228
|
+
CM00L: update_last_deserialize()
|
|
229
|
+
CM00L: COMMIT WORK AND WAIT — commit the whole transaction
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Key variables observed during trace** (for `pull --files abap/zcl_abgagt_viewer_clas.clas.abap`):
|
|
233
|
+
|
|
234
|
+
| Variable at BP1 (CM00D:207) | Value |
|
|
235
|
+
|---|---|
|
|
236
|
+
| `IT_FILES[1]` | `abap/zcl_abgagt_viewer_clas.clas.abap` |
|
|
237
|
+
| `LI_REPO` (class) | `ZCL_ABAPGIT_REPO_ONLINE` |
|
|
238
|
+
| `LO_OBJ_FILTER` (class) | `ZCL_ABAPGIT_OBJECT_FILTER_OBJ` |
|
|
239
|
+
| `LT_CONFLICTS` | empty (no conflicts) |
|
|
240
|
+
| `LS_CHECKS-OVERWRITE[1]` | CLAS `ZCL_ABGAGT_VIEWER_CLAS`, DEVCLASS `$ABAP_AI_BRIDGE`, DECISION=Y |
|
|
241
|
+
| `LV_DESER_HAS_FILTER` | `X` (II_OBJ_FILTER supported) |
|
|
242
|
+
|
|
243
|
+
| Variable at BP2 (CM00L:545) | Value |
|
|
244
|
+
|---|---|
|
|
245
|
+
| `II_OBJ_FILTER` (class) | `ZCL_ABAPGIT_OBJECT_FILTER_OBJ` |
|
|
246
|
+
| `LT_UPDATED_FILES[1]` | `/.abapgit.xml` (from deserialize_dot_abapgit) |
|
|
247
|
+
|
|
248
|
+
**Verified breakpoint locations** (assembled-source global line numbers, confirmed accepted by ADT):
|
|
249
|
+
|
|
250
|
+
| Location | Command |
|
|
251
|
+
|---|---|
|
|
252
|
+
| Before DESERIALIZE call | `debug set --objects ZCL_ABGAGT_AGENT:207` (create_new_log) |
|
|
253
|
+
| abapGit DESERIALIZE entry | `debug set --objects ZCL_ABAPGIT_REPO:545` (deserialize_objects call) |
|
|
254
|
+
| abapGit objects pipeline entry | `debug set --objects ZCL_ABAPGIT_OBJECTS:<CM00A first exec line>` |
|
|
255
|
+
|
|
256
|
+
> **Note**: The EZABAPGIT lock is acquired during `build_file_entries_from_remote()` and released
|
|
257
|
+
> inside `find_remote_dot_abapgit()` via `COMMIT WORK AND WAIT` — i.e., the lock is released before
|
|
258
|
+
> BP2 fires. There is no active lock between BP1 and the end of CM00L.
|
|
259
|
+
|
|
260
|
+
### Known Limitations and Planned Improvements
|
|
261
|
+
|
|
262
|
+
The following issues were identified during a live debugging session (2026-03) and should be fixed to make future debugging easier:
|
|
263
|
+
|
|
264
|
+
#### ~~1. `view --full` global line numbers don't match ADT line numbers~~ ✅ Fixed
|
|
265
|
+
|
|
266
|
+
**Fixed**: `view --full --lines` now shows dual line numbers per line: `G [N] code` where G is the assembled-source global line (usable directly with `--objects CLASS:G` or `--files src/cls.clas.abap:G`) and `[N]` is the include-relative counter for navigation. Method headers show the ready-to-use `debug set --objects CLASS:G` command pointing to the first executable statement. `view --full` (without `--lines`) shows the same full source as clean readable code without line numbers.
|
|
267
|
+
|
|
268
|
+
Global line numbers are computed **client-side** in Node.js, not in ABAP:
|
|
269
|
+
- **Own classes** (local `.clas.abap` file exists): reads the local file — guaranteed exact match with ADT
|
|
270
|
+
- **Library classes** (no local file, e.g. abapGit): fetches assembled source from `/sap/bc/adt/oo/classes/<name>/source/main`
|
|
271
|
+
|
|
272
|
+
Both strategies scan for `METHOD <name>.` as the first token on the line to find `global_start`. The method header hint automatically points to the **first executable statement** (skipping the `METHOD` line, blank lines, and `DATA`/`FINAL`/`TYPES`/`CONSTANTS` declarations) so it can be used directly without adjustment.
|
|
273
|
+
|
|
274
|
+
#### ~~2. Include-relative breakpoint form (`=====CMxxx:N`) not implemented in the CLI~~ ✅ Superseded
|
|
275
|
+
|
|
276
|
+
**Superseded**: The `/programs/includes/` ADT endpoint was found to not accept breakpoints for OO class method includes — ADT only accepts the `/oo/classes/.../source/main` URI with assembled-source line numbers. The `=====CMxxx:N` approach was dropped. Instead, `view --full --lines` now provides the correct assembled-source global line number G directly, and both `--objects CLASS:G` and `--files src/cls.clas.abap:G` work reliably.
|
|
277
|
+
|
|
278
|
+
#### ~~3. `stepContinue` re-attach pattern missing from docs~~ ✅ Fixed
|
|
279
|
+
|
|
280
|
+
**Fixed**: Step 3 of the debug guide now documents the two possible return values of `step --type continue` and includes the re-attach pattern for when the program hits a second breakpoint instead of finishing.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Overview
|
|
4
|
+
nav_order: 1
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# ABAP Coding Guidelines Index
|
|
10
|
+
|
|
11
|
+
This folder contains detailed ABAP coding guidelines that can be searched using the `ref` command.
|
|
12
|
+
|
|
13
|
+
## Guidelines Available
|
|
14
|
+
|
|
15
|
+
| File | Topic |
|
|
16
|
+
|------|-------|
|
|
17
|
+
| `sql.md` | ABAP SQL Best Practices |
|
|
18
|
+
| `exceptions.md` | Exception Handling |
|
|
19
|
+
| `testing.md` | Unit Testing (including CDS) |
|
|
20
|
+
| `cds.md` | CDS Views |
|
|
21
|
+
| `classes.md` | ABAP Classes and Objects |
|
|
22
|
+
| `objects.md` | Object Naming Conventions |
|
|
23
|
+
| `json.md` | JSON Handling |
|
|
24
|
+
| `abapgit.md` | abapGit XML Metadata Templates |
|
|
25
|
+
| `unit-testable-code.md` | Unit Testable Code Guidelines (Dependency Injection) |
|
|
26
|
+
| `common-errors.md` | Common ABAP Errors - Quick Fixes |
|
|
27
|
+
| `debug-session.md` | Debug Session Guide |
|
|
28
|
+
| `debug-dump.md` | Dump Analysis Guide |
|
|
29
|
+
| `branch-workflow.md` | Branch Workflow |
|
|
30
|
+
| `workflow-detailed.md` | Development Workflow (Detailed) |
|
|
31
|
+
| `object-creation.md` | Object Creation (XML metadata, local classes) |
|
|
32
|
+
| `cds-testing.md` | CDS Testing (Test Double Framework) |
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
These guidelines are automatically searched by the `ref` command:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Search across all guidelines
|
|
40
|
+
abapgit-agent ref "CORRESPONDING"
|
|
41
|
+
|
|
42
|
+
# List all topics
|
|
43
|
+
abapgit-agent ref --list-topics
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Adding Custom Guidelines
|
|
47
|
+
|
|
48
|
+
To add your own guidelines:
|
|
49
|
+
1. Create a new `.md` file in this folder
|
|
50
|
+
2. Export to reference folder: `abapgit-agent ref export`
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Object Creation
|
|
4
|
+
nav_order: 16
|
|
5
|
+
parent: ABAP Coding Guidelines
|
|
6
|
+
grand_parent: ABAP Development
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Object Creation
|
|
10
|
+
|
|
11
|
+
### Create XML Metadata for Each ABAP Object
|
|
12
|
+
|
|
13
|
+
**Each ABAP object requires an XML metadata file for abapGit to understand how to handle it.**
|
|
14
|
+
|
|
15
|
+
| Object Type | ABAP File (if folder=/src/) | XML File | Details |
|
|
16
|
+
|-------------|------------------------------|----------|---------|
|
|
17
|
+
| Class | `src/zcl_*.clas.abap` | `src/zcl_*.clas.xml` | See `guidelines/abapgit.md` |
|
|
18
|
+
| Interface | `src/zif_*.intf.abap` | `src/zif_*.intf.xml` | See `guidelines/abapgit.md` |
|
|
19
|
+
| Program | `src/z*.prog.abap` | `src/z*.prog.xml` | See `guidelines/abapgit.md` |
|
|
20
|
+
| Table | `src/z*.tabl.abap` | `src/z*.tabl.xml` | See `guidelines/abapgit.md` |
|
|
21
|
+
| **CDS View Entity** | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | **Use by default** - See `guidelines/cds.md` |
|
|
22
|
+
| CDS View (legacy) | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | Only if explicitly requested - See `guidelines/cds.md` |
|
|
23
|
+
|
|
24
|
+
**IMPORTANT: When user says "create CDS view", create CDS View Entity by default.**
|
|
25
|
+
|
|
26
|
+
**Why:** Modern S/4HANA standard, simpler (no SQL view), no namespace conflicts.
|
|
27
|
+
|
|
28
|
+
**For complete XML templates, DDL examples, and detailed comparison:**
|
|
29
|
+
- **CDS Views**: `guidelines/cds.md`
|
|
30
|
+
- **XML templates**: `guidelines/abapgit.md`
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### Local Classes (Test Doubles, Helpers)
|
|
35
|
+
|
|
36
|
+
When a class needs local helper classes or test doubles, use separate files:
|
|
37
|
+
|
|
38
|
+
| File | Purpose |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| `zcl_xxx.clas.locals_def.abap` | Local class definitions |
|
|
41
|
+
| `zcl_xxx.clas.locals_imp.abap` | Local class implementations |
|
|
42
|
+
|
|
43
|
+
**XML Configuration**: Add `<CLSCCINCL>X</CLSCCINCL>` to the class XML to include local class definitions:
|
|
44
|
+
|
|
45
|
+
```xml
|
|
46
|
+
<VSEOCLASS>
|
|
47
|
+
<CLSNAME>ZCL_XXX</CLSNAME>
|
|
48
|
+
...
|
|
49
|
+
<CLSCCINCL>X</CLSCCINCL>
|
|
50
|
+
</VSEOCLASS>
|
|
51
|
+
```
|
|
@@ -13,7 +13,7 @@ grand_parent: ABAP Development
|
|
|
13
13
|
## TOPICS IN THIS FILE
|
|
14
14
|
1. Naming Conventions
|
|
15
15
|
2. ABAP Object Types
|
|
16
|
-
3. XML Metadata (see guidelines/
|
|
16
|
+
3. XML Metadata (see guidelines/abapgit.md)
|
|
17
17
|
|
|
18
18
|
## Naming Conventions
|
|
19
19
|
|
|
@@ -51,7 +51,7 @@ Common object types in this project:
|
|
|
51
51
|
|
|
52
52
|
## XML Metadata
|
|
53
53
|
|
|
54
|
-
**See guidelines/
|
|
54
|
+
**See guidelines/abapgit.md for XML templates.**
|
|
55
55
|
|
|
56
56
|
Each ABAP object requires an XML metadata file for abapGit. Quick reference:
|
|
57
57
|
|
|
@@ -111,6 +111,6 @@ SELECT carrid, connid, fldate " Commas required
|
|
|
111
111
|
---
|
|
112
112
|
|
|
113
113
|
## See Also
|
|
114
|
-
- **Constructor Expressions** (
|
|
114
|
+
- **Constructor Expressions** (classes.md) - for VALUE #(), FILTER, FOR loops
|
|
115
115
|
- **Internal Tables** - for filtering and iteration patterns
|
|
116
|
-
- **abapGit** (
|
|
116
|
+
- **abapGit** (abapgit.md) - for XML metadata templates
|
|
@@ -330,6 +330,6 @@ abapgit-agent ref --topic unit-tests
|
|
|
330
330
|
---
|
|
331
331
|
|
|
332
332
|
## See Also
|
|
333
|
-
- **CDS Views** (
|
|
334
|
-
- **abapGit** (
|
|
335
|
-
- **ABAP SQL** (
|
|
333
|
+
- **CDS Views** (cds.md) - for CDS view definitions and syntax
|
|
334
|
+
- **abapGit** (abapgit.md) - for WITH_UNIT_TESTS in XML metadata
|
|
335
|
+
- **ABAP SQL** (sql.md) - for SELECT statements in tests
|