abapgit-agent 1.15.2 → 1.15.3

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.
@@ -36,8 +36,14 @@ The folder is configured in `.abapGitAgent` (property: `folder`):
36
36
 
37
37
  Each ABAP object needs an XML metadata file. Local helper/test-double classes use separate `.locals_def.abap` / `.locals_imp.abap` files.
38
38
 
39
+ **Name length limits** (verify before naming anything):
40
+ - CLAS, INTF: name **30 chars** | method names: **30 chars**
41
+ - TABL, STRU: name **30 chars** | **field names: 16 chars** ← most common mistake
42
+ - DDLS (CDS view entity): **40 chars** | field alias: 30 | FUGR: 26 | MSAG: 20 | PROG/DTEL/DOMA/TTYP: 30
43
+
39
44
  ```bash
40
- abapgit-agent ref --topic object-creation # XML templates and local class setup
45
+ abapgit-agent ref --topic naming-limits # full length reference
46
+ abapgit-agent ref --topic object-creation # XML templates and local class setup
41
47
  ```
42
48
 
43
49
  ### 4. Use Syntax Command Before Commit (for CLAS, INTF, PROG, DDLS)
@@ -65,6 +71,24 @@ abapgit-agent ref --topic debug-session # full debug guide
65
71
  abapgit-agent ref --topic debug-dump # dump analysis guide
66
72
  ```
67
73
 
74
+ ### 7. Never Run `run` Command Proactively
75
+
76
+ Never call `abapgit-agent run` unless the user explicitly asks — it can modify data or trigger RFCs.
77
+
78
+ ### 8. Probe and PoC Objects — Always Z/Y, Never in SAP Packages
79
+
80
+ When `objects.local.md` shows SAP namespace (`CL_*`, `IF_*`, `/NAMESPACE/*`) and the user asks to create a new object, always ask first: *"Is this a production object, a PoC, or a probe?"*
81
+
82
+ → `abapgit-agent ref --topic probe-poc`
83
+
84
+ ### 9. abaplint — Optional, Project-Controlled
85
+
86
+ Only run if `.abaplint.json` exists. Run after `syntax`, before commit. Always check `ref --topic abaplint` before applying any quickfix.
87
+
88
+ ```bash
89
+ ls .abaplint.json 2>/dev/null && abapgit-agent lint
90
+ ```
91
+
68
92
  ---
69
93
 
70
94
  ## Development Workflow
@@ -77,6 +101,8 @@ Checked into the repository — applies to all developers. **Read this file at t
77
101
  |---------|--------|
78
102
  | `safeguards.requireFilesForPull: true` | Always include `--files` in every `pull` |
79
103
  | `safeguards.disablePull: true` | Do not run `abapgit-agent pull` at all |
104
+ | `safeguards.disableRun: true` | Do not run `abapgit-agent run` at all |
105
+ | `safeguards.disableProbeClasses: true` | Use `scratchWorkspace` for probe classes instead |
80
106
  | `conflictDetection.mode: "abort"` | Abort pull on conflict — inform user |
81
107
  | `transports.allowCreate/allowRelease: false` | Blocked — inform user |
82
108
 
@@ -97,10 +123,15 @@ abapgit-agent ref --topic branch-workflow
97
123
  ```
98
124
  Modified ABAP files?
99
125
  ├─ CLAS/INTF/PROG/DDLS files?
100
- │ ├─ Independent files? → syntax → commit → push → pull
101
- │ └─ Dependent files? → skip syntax → commit → push → pull
126
+ │ ├─ Independent files? → syntax → [abaplint] → commit → push → pull --sync-xml
127
+ │ └─ Dependent files? → skip syntax → [abaplint] → commit → push → pull --sync-xml
102
128
  └─ Other types (FUGR, TABL, etc.)?
103
- skip syntax commit push → pull → (if errors: inspect)
129
+ ├─ XML-only (TABL, STRU, DTEL, TTYP, DOMA, MSAG)?
130
+ │ → skip syntax → [abaplint] → commit → push → pull --files <name>.tabl.xml --sync-xml
131
+ └─ FUGR and others?
132
+ → skip syntax → [abaplint] → commit → push → pull --sync-xml → (if errors: inspect)
133
+
134
+ [abaplint] = run lint only if .abaplint.json exists; ref --topic abaplint before any quickfix
104
135
  ```
105
136
 
106
137
  ```bash
package/abap/CLAUDE.md CHANGED
@@ -99,6 +99,20 @@ Never assume Z/Y prefix without checking.
99
99
  XML-only objects (TABL, STRU, DTEL, TTYP, DOMA, MSAG) need ONLY the XML file
100
100
  ```
101
101
 
102
+ **Before choosing a name, verify the length limit for the object type:**
103
+
104
+ | Object type | Name limit | Field/sub-element limit |
105
+ |---|---|---|
106
+ | CLAS, INTF | **30 chars** | method names: **30 chars** |
107
+ | TABL, STRU | **30 chars** | **field names: 16 chars** |
108
+ | DDLS (CDS view entity) | **40 chars** | field alias: **30 chars** |
109
+ | DCLS (CDS access control) | **40 chars** | — (name must match its DDLS view) |
110
+ | FUGR (function group) | **26 chars** | function module name: **30 chars** |
111
+ | MSAG (message class) | **20 chars** | — |
112
+ | PROG, DTEL, DOMA, TTYP | **30 chars** | — |
113
+
114
+ → Full length reference: `abapgit-agent ref --topic naming-limits`
115
+
102
116
  Use the object name from `objects.local.md` (or `objects.md` as fallback) in place of `<name>`:
103
117
 
104
118
  | Object Type | Source File | XML File |
@@ -110,7 +124,7 @@ Use the object name from `objects.local.md` (or `objects.md` as fallback) in pla
110
124
  | CDS Access Control (DCLS) | `<name>.dcls.asdcls` | `<name>.dcls.xml` |
111
125
  | Function Group (FUGR) | `<name>.fugr.abap` + includes | `<name>.fugr.xml` |
112
126
  | Table (TABL) | *(none)* | `<name>.tabl.xml` |
113
- | Structure (STRU) | *(none)* | `<name>.stru.xml` |
127
+ | Structure (STRU) | *(none)* | `<name>.tabl.xml` ⚠️ NOT `.stru.xml` |
114
128
  | Data Element (DTEL) | *(none)* | `<name>.dtel.xml` |
115
129
  | Table Type (TTYP) | *(none)* | `<name>.ttyp.xml` |
116
130
  | Domain (DOMA) | *(none)* | `<name>.doma.xml` |
@@ -143,7 +157,7 @@ Anything else (SAP namespace object, or SAP-delivered package)?
143
157
 
144
158
  Object: <NAME> (<Type>)
145
159
  Package: <PACKAGE>
146
- Files: <folder>/<name>.<ext>.abap
160
+ Files: <folder>/<name>.<ext>.abap ← omit this line for XML-only types (TABL/STRU/DTEL/TTYP/DOMA/MSAG)
147
161
  <folder>/<name>.<ext>.xml
148
162
 
149
163
  Shall I proceed?"
@@ -716,6 +730,9 @@ Modified ABAP files?
716
730
  └─ Other types (FUGR, TABL, STRU, DTEL, TTYP, etc.)?
717
731
  ├─ XML-only objects (TABL, STRU, DTEL, TTYP, DOMA, MSAG)?
718
732
  │ └─ ✅ Use: skip syntax → [abaplint] → commit → push → pull --files abap/ztable.tabl.xml --sync-xml
733
+ ├─ DCLS (CDS access control)?
734
+ │ └─ ✅ Use: skip syntax → [abaplint] → commit → push → pull --files abap/zc_view.dcls.xml --sync-xml
735
+ │ ⚠️ Pass the .xml file — pull --files does NOT accept .asdcls extensions
719
736
  └─ FUGR and other complex objects?
720
737
  └─ ✅ Use: skip syntax → [abaplint] → commit → push → pull --sync-xml → (if errors: inspect)
721
738
 
@@ -736,6 +753,7 @@ Modified ABAP files?
736
753
  | `ref --topic exceptions` | Exception Handling |
737
754
  | `ref --topic classes` | ABAP Classes and Objects |
738
755
  | `ref --topic objects` | Object Naming Conventions (defaults) |
756
+ | `ref --topic naming-limits` | Naming Length Limits — 30/16/40 char rules per type (CRITICAL before naming anything) |
739
757
  | `ref --topic comments` | Documentation Comments (ABAP DOC, shorttext, @parameter, CDS `//`, program `*&---`) |
740
758
  | `ref --topic testing` | Unit Testing |
741
759
  | `ref --topic unit-testable-code` | Unit Testable Code (Dependency Injection) |
@@ -22,10 +22,13 @@ A FUGR with group name `ZMY_FUGR` and one FM `ZMY_MY_FUNCTION` requires these fi
22
22
  | `zmy_fugr.fugr.xml` | Main XML: group description, includes list, FM interfaces |
23
23
  | `zmy_fugr.fugr.lzmy_fugrtop.abap` | TOP include source |
24
24
  | `zmy_fugr.fugr.lzmy_fugrtop.xml` | TOP include metadata (`SUBC=I`) |
25
- | `zmy_fugr.fugr.saplzmy_fugr.abap` | Main include source |
25
+ | `zmy_fugr.fugr.saplzmy_fugr.abap` | Main include source (lists all U-includes) |
26
26
  | `zmy_fugr.fugr.saplzmy_fugr.xml` | Main include metadata (`SUBC=F`) |
27
+ | `zmy_fugr.fugr.lzmy_fugru01.abap` | FM implementation include (one per FM: U01, U02, …) |
27
28
  | `zmy_fugr.fugr.zmy_my_function.abap` | FM source (one file per FM, named after FM in lowercase) |
28
29
 
30
+ > **7 files total for one FM** (6 without the U01 include causes a pull error — the SAPL source references `LZMY_FUGRU01` which abapGit can't find). For a second FM, add `lzmy_fugru02.abap` and `zmy_second_function.abap`.
31
+
29
32
  ---
30
33
 
31
34
  ### `zmy_fugr.fugr.xml`
@@ -145,15 +148,28 @@ FUNCTION zmy_my_function.
145
148
  ENDFUNCTION.
146
149
  ```
147
150
 
151
+ ### `zmy_fugr.fugr.lzmy_fugru01.abap`
152
+
153
+ The FM implementation include — **always required**. The SAPL source references `INCLUDE LZMY_FUGRU01.` so this file must exist or the pull fails.
154
+
155
+ ```abap
156
+ *----------------------------------------------------------------------*
157
+ ***INCLUDE LZMY_FUGRU01.
158
+ *----------------------------------------------------------------------*
159
+ ```
160
+
161
+ For a second FM, create `zmy_fugr.fugr.lzmy_fugru02.abap` with the same pattern (replacing `U01` with `U02`).
162
+
148
163
  ---
149
164
 
150
165
  ## Key Rules
151
166
 
152
- - **Include naming**: TOP = `L<GROUP>TOP`, main = `SAPL<GROUP>` — uppercase in XML and filenames
167
+ - **Include naming**: TOP = `L<GROUP>TOP`, main = `SAPL<GROUP>`, FM implementation = `L<GROUP>U01` (U02, U03, …) — uppercase in XML and filenames
153
168
  - **FM source file**: named after the FM in **lowercase** (`zmy_my_function.abap`, not `ZMY_MY_FUNCTION.abap`)
169
+ - **U-include file required**: `lzmy_fugru01.abap` must exist — the SAPL source references it; missing it causes a pull error
154
170
  - **`INCLUDES` list** in the main XML: only lists TOP and SAPL includes — FM source includes are implicit
155
171
  - **`REMOTE_CALL>R`**: add only for RFC-enabled FMs; omit for local FMs
156
172
  - **Optional parameters**: include both `<OPTIONAL>X</OPTIONAL>` and `<DEFAULT>...</DEFAULT>`
157
- - **`DOCUMENTATION` section**: omit entirely if no parameter descriptions neededmissing docs cause no diff
173
+ - **`DOCUMENTATION` section**: the serializer always writes `<DOCUMENTATION>` with one `<RSFDO>` entry per parameter (containing only `<PARAMETER>` and `<KIND>P</KIND>`, no `<STEXT>`). Always include it omitting it causes a permanent "M" diff
158
174
  - **Screens/CUA**: omit `DYNPROS`/`CUA` sections for screenless function groups
159
175
  - **Multiple FMs**: add one `<item>` per FM in `FUNCTIONS`; add one `INCLUDE` line per FM in the SAPL source
@@ -170,6 +170,12 @@ A **text table** stores translatable texts for another table (the "main table").
170
170
 
171
171
  > Pull with: `pull --files src/zmy_dtel.dtel.xml`
172
172
 
173
+ **Two variants — choose based on whether the DTEL defines its own type or references a domain:**
174
+
175
+ #### Variant 1: Built-in type (no domain)
176
+
177
+ Use when the data element directly defines `DATATYPE` and `LENG` without referencing a domain.
178
+
173
179
  ```xml
174
180
  <?xml version="1.0" encoding="utf-8"?>
175
181
  <abapGit version="v1.0.0" serializer="LCL_OBJECT_DTEL" serializer_version="v1.0.0">
@@ -192,13 +198,38 @@ A **text table** stores translatable texts for another table (the "main table").
192
198
  </abapGit>
193
199
  ```
194
200
 
201
+ #### Variant 2: Domain reference
202
+
203
+ Use when the data element's type and length come from an existing domain (`DOMNAME`). Do **not** include `DATATYPE` or `LENG` — the domain owns those.
204
+
205
+ ```xml
206
+ <?xml version="1.0" encoding="utf-8"?>
207
+ <abapGit version="v1.0.0" serializer="LCL_OBJECT_DTEL" serializer_version="v1.0.0">
208
+ <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
209
+ <asx:values>
210
+ <DD04V>
211
+ <ROLLNAME>ZMY_DTEL</ROLLNAME>
212
+ <DDLANGUAGE>E</DDLANGUAGE>
213
+ <DDTEXT>Description of data element</DDTEXT>
214
+ <REPTEXT>Description</REPTEXT>
215
+ <SCRTEXT_S>Short text</SCRTEXT_S>
216
+ <SCRTEXT_M>Medium text</SCRTEXT_M>
217
+ <SCRTEXT_L>Long description text</SCRTEXT_L>
218
+ <DTELMASTER>E</DTELMASTER>
219
+ <DOMNAME>ZMY_DOMAIN</DOMNAME>
220
+ </DD04V>
221
+ </asx:values>
222
+ </asx:abap>
223
+ </abapGit>
224
+ ```
225
+
195
226
  **Key Fields**:
196
227
  - `ROLLNAME`: Data element name
197
228
  - `DDTEXT`: Description (**not** `DESCRIPT`)
198
229
  - `REPTEXT` / `SCRTEXT_S` / `SCRTEXT_M` / `SCRTEXT_L`: Field labels (report heading, short, medium, long)
199
230
  - `DTELMASTER`: Language key for label master (`E` for English)
200
- - `DATATYPE`: Data type (`CHAR`, `NUMC`, `DATS`, `TIMS`, `INT4`, etc.)
201
- - `LENG`: Length padded to 6 digits (e.g. `000010` for 10 characters)
231
+ - `DATATYPE` + `LENG`: Use for built-in type variant only (e.g. `CHAR` + `000010`)
232
+ - `DOMNAME`: Use for domain-reference variant only omit `DATATYPE` and `LENG` entirely
202
233
 
203
234
  **Omit `<PARAMID>`** unless you specifically need a SET/GET parameter ID — the serializer omits it when empty.
204
235
 
@@ -206,10 +237,14 @@ A **text table** stores translatable texts for another table (the "main table").
206
237
 
207
238
  ### Structure (STRU)
208
239
 
209
- **Filename**: `src/zmy_struct.stru.xml`
240
+ **Filename**: `src/zmy_struct.tabl.xml`
210
241
 
211
- > abapGit uses the same TABL serializer for STRU.
212
- > Pull with: `pull --files src/zmy_struct.stru.xml`
242
+ > ⚠️ **Use `.tabl.xml` extension, NOT `.stru.xml`** abapGit serializes structures with the TABL
243
+ > serializer and registers them as object type `TABL`. A `.stru.xml` filename causes
244
+ > "Step DDIC is only for DDIC objects" because abapGit treats it as object type `STRU`,
245
+ > which is not in its DDIC activation list.
246
+ >
247
+ > Pull with: `pull --files src/zmy_struct.tabl.xml`
213
248
 
214
249
  ```xml
215
250
  <?xml version="1.0" encoding="utf-8"?>
@@ -221,16 +256,37 @@ A **text table** stores translatable texts for another table (the "main table").
221
256
  <DDLANGUAGE>E</DDLANGUAGE>
222
257
  <TABCLASS>INTTAB</TABCLASS>
223
258
  <DDTEXT>Description of the structure</DDTEXT>
224
- <CONTFLAG>A</CONTFLAG>
259
+ <EXCLASS>1</EXCLASS>
225
260
  </DD02V>
261
+ <DD03P_TABLE>
262
+ <DD03P>
263
+ <FIELDNAME>FIELD1</FIELDNAME>
264
+ <ROLLNAME>S_CARR_ID</ROLLNAME>
265
+ <ADMINFIELD>0</ADMINFIELD>
266
+ <SHLPORIGIN>D</SHLPORIGIN>
267
+ <COMPTYPE>E</COMPTYPE>
268
+ </DD03P>
269
+ <DD03P>
270
+ <FIELDNAME>FIELD2</FIELDNAME>
271
+ <ROLLNAME>S_CARRNAME</ROLLNAME>
272
+ <ADMINFIELD>0</ADMINFIELD>
273
+ <COMPTYPE>E</COMPTYPE>
274
+ </DD03P>
275
+ </DD03P_TABLE>
226
276
  </asx:values>
227
277
  </asx:abap>
228
278
  </abapGit>
229
279
  ```
230
280
 
231
- **Key difference from TABL**: `TABCLASS` is `INTTAB` (internal table / structure) instead of `TRANSP`.
281
+ **Key differences from TABL**:
282
+ - `TABCLASS` is `INTTAB` instead of `TRANSP`
283
+ - No `<CONTFLAG>` — omit it (not written by serializer for structures)
284
+ - `<EXCLASS>1</EXCLASS>` — include it
285
+ - Include `<DD03P_TABLE>` with field definitions from the start (unlike TABL where it is optional on creation)
232
286
 
233
- **Note**: Like TABL, after the first pull abapGit expands the XML with `<DD03P_TABLE>` field definitions.
287
+ **`DD03P` field rules** (same as TABL):
288
+ - Fields with `ROLLNAME` (data element): include `ROLLNAME`, `ADMINFIELD>0`, `SHLPORIGIN` (when domain provides value help — `D` for domain fixed values), `COMPTYPE>E`
289
+ - Fields with raw type (no data element): include `ADMINFIELD>0`, `INTTYPE`, `INTLEN`, `DATATYPE`, `MASK` (before any text fields)
234
290
 
235
291
  ---
236
292
 
@@ -248,13 +304,13 @@ A **text table** stores translatable texts for another table (the "main table").
248
304
  <DD40V>
249
305
  <TYPENAME>ZMY_TTYP</TYPENAME>
250
306
  <DDLANGUAGE>E</DDLANGUAGE>
251
- <DDTEXT>Description of table type</DDTEXT>
252
307
  <ROWTYPE>ZMY_STRUCT</ROWTYPE>
253
308
  <ROWKIND>S</ROWKIND>
254
- <DATATYPE>TABLE_T</DATATYPE>
309
+ <DATATYPE>STRU</DATATYPE>
255
310
  <ACCESSMODE>T</ACCESSMODE>
256
311
  <KEYDEF>D</KEYDEF>
257
312
  <KEYKIND>N</KEYKIND>
313
+ <DDTEXT>Description of table type</DDTEXT>
258
314
  </DD40V>
259
315
  </asx:values>
260
316
  </asx:abap>
@@ -265,7 +321,7 @@ A **text table** stores translatable texts for another table (the "main table").
265
321
  - `TYPENAME`: Table type name
266
322
  - `ROWTYPE`: Row type (a structure or data element name)
267
323
  - `ROWKIND`: Row kind — `S`=Structure/Type, `D`=Data element, `R`=Reference
268
- - `DATATYPE`: Always `TABLE_T` for table types
324
+ - `DATATYPE`: `STRU` when row type is a structure (`ROWKIND=S`); `TABLE_T` only for elementary-type row types
269
325
  - `ACCESSMODE`: Table kind — `T`=Standard, `S`=Sorted, `H`=Hashed
270
326
  - `KEYDEF`: Key definition — `D`=Default (standard key), `K`=User-defined
271
327
  - `KEYKIND`: Key uniqueness — `N`=Non-unique, `U`=Unique
@@ -372,7 +428,7 @@ abapGit uses the view `DD01V` as the root element (not `DD01L`). The serializer
372
428
  <SPRSL>E</SPRSL>
373
429
  <ARBGB>ZMY_MSGS</ARBGB>
374
430
  <MSGNR>000</MSGNR>
375
- <TEXT>Object &1 not found</TEXT>
431
+ <TEXT>Object &amp;1 not found</TEXT>
376
432
  </T100>
377
433
  <T100>
378
434
  <SPRSL>E</SPRSL>
@@ -265,7 +265,7 @@ abapGit's serializer **omits fields that have their default value**. Writing ext
265
265
  - `SOURCE_TYPE W` → View Entity (`define view entity`, modern — **use by default**)
266
266
  - `SOURCE_TYPE V` → View (`define view` + `@AbapCatalog.sqlViewName`, legacy)
267
267
 
268
- → For DDL source syntax: `abapgit-agent ref --topic cds-abapgit`
268
+ → For DDL source syntax: `abapgit-agent ref --topic cds`
269
269
 
270
270
  ---
271
271
 
@@ -290,6 +290,7 @@ abapGit's serializer **omits fields that have their default value**. Writing ext
290
290
 
291
291
  - `DCLNAME` matches the CDS view name
292
292
  - Source file contains the DCL (`@MappingRole ... define role ...`)
293
+ - **Pull with the `.xml` file, not `.asdcls`**: `pull --files src/zc_my_view.dcls.xml` — the `pull --files` filter does not accept `.asdcls` extensions
293
294
 
294
295
  ---
295
296
 
@@ -20,6 +20,7 @@ This folder contains detailed ABAP coding guidelines that can be searched using
20
20
  | `cds.md` | CDS Views |
21
21
  | `classes.md` | ABAP Classes and Objects |
22
22
  | `objects.md` | Object Naming Conventions |
23
+ | `naming-limits.md` | Naming Length Limits (30/16/40 char rules per type) |
23
24
  | `json.md` | JSON Handling |
24
25
  | `abapgit.md` | abapGit XML Metadata Templates |
25
26
  | `unit-testable-code.md` | Unit Testable Code Guidelines (Dependency Injection) |
@@ -0,0 +1,160 @@
1
+ ---
2
+ layout: default
3
+ title: Naming Length Limits
4
+ nav_order: 6
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
9
+ # ABAP Naming Length Limits
10
+
11
+ **Searchable keywords**: name length, character limit, 30 characters, 16 characters, 40 characters, too long, truncate, field name, method name, class name, table name, CDS name
12
+
13
+ > **Rule of thumb**: Most ABAP object names → 30 chars. Table/structure **field names** → 16 chars. CDS/DDLS names → 40 chars. Method names (including test methods) → 30 chars.
14
+
15
+ ---
16
+
17
+ ## Quick Reference
18
+
19
+ | Object / Element | Max Length |
20
+ |---|---|
21
+ | Class name (CLAS) | **30** |
22
+ | Interface name (INTF) | **30** |
23
+ | Program name (PROG) | **30** |
24
+ | Function Group name (FUGR) | **26** |
25
+ | Function Module name | **30** |
26
+ | Table name (TABL) | **30** |
27
+ | **Table field name** | **16** |
28
+ | Structure name (STRU) | **30** |
29
+ | **Structure field name** | **16** |
30
+ | Data Element name (DTEL) | **30** |
31
+ | Domain name (DOMA) | **30** |
32
+ | Table Type name (TTYP) | **30** |
33
+ | Package name | **30** |
34
+ | **CDS View Entity name (DDLS)** | **40** |
35
+ | CDS Access Control name (DCLS) | **40** |
36
+ | CDS field alias | **30** |
37
+ | Message Class name (MSAG) | **20** |
38
+ | Class method name | **30** |
39
+ | **Test method name** | **30** |
40
+ | Interface method name | **30** |
41
+ | Class attribute name | **30** |
42
+ | Local variable name | **30** |
43
+ | Local type/class name | **30** |
44
+ | Test class name (local) | **30** |
45
+
46
+ ---
47
+
48
+ ## Critical Differences — Don't Confuse These
49
+
50
+ ### Table/Structure Field Names: 16 Characters MAX
51
+
52
+ This is the **most common mistake**. Field names in TABL and STRU are limited to **16 characters**, not 30.
53
+
54
+ ```xml
55
+ <!-- WRONG — 17 characters -->
56
+ <FIELDNAME>LAST_MODIFIED_AT</FIELDNAME>
57
+
58
+ <!-- CORRECT — 16 characters or fewer -->
59
+ <FIELDNAME>LAST_MODIFIED</FIELDNAME>
60
+ <FIELDNAME>SYS_CHANGED_AT</FIELDNAME> <!-- 14 chars ✓ -->
61
+ <FIELDNAME>LAST_PULLED_AT</FIELDNAME> <!-- 14 chars ✓ -->
62
+ ```
63
+
64
+ When naming table fields, keep names short and descriptive:
65
+ - `CARRID` not `CARRIER_ID_FIELD`
66
+ - `CONNID` not `CONNECTION_IDENTIFIER`
67
+ - `STATUS` not `CURRENT_STATUS_FLAG`
68
+ - `CREATED_AT` not `CREATION_TIMESTAMP`
69
+
70
+ ### CDS View Names: 40 Characters MAX
71
+
72
+ CDS View Entity (DDLS) names allow up to **40 characters** — more room than regular ABAP objects.
73
+
74
+ ```
75
+ ZC_MY_FLIGHT_BOOKING_REVENUE_SUMMARY ← 40 chars (at limit)
76
+ ZC_FLIGHT_REVENUE ← 17 chars (fine)
77
+ ```
78
+
79
+ However, CDS **field aliases** inside the view are still limited to **30 characters** (ABAP identifier rules).
80
+
81
+ ### Function Group Names: 26 Characters MAX
82
+
83
+ Function groups (`FUGR`) have a **26-character limit** because ABAP appends a 4-character suffix internally (e.g. `SAPLZMY_FG` prefix + module name). The safe usable name length is 26 characters.
84
+
85
+ ### Test Method Names: 30 Characters MAX — Causes Syntax Error
86
+
87
+ Test methods (`FOR TESTING`) hit the 30-char limit frequently because the `test_` prefix takes 5 chars before the meaningful content starts.
88
+
89
+ ```abap
90
+ " WRONG — 34 characters → syntax error at activation
91
+ METHODS test_execute_with_minimal_params FOR TESTING.
92
+
93
+ " CORRECT — abbreviate to stay within 30 chars
94
+ METHODS test_exec_minimal FOR TESTING. " 18 chars ✓
95
+ METHODS test_exec_with_files FOR TESTING. " 24 chars ✓
96
+ ```
97
+
98
+ **Counting test method length**: include the full method name — `test_exec_minimal` is 18 characters.
99
+
100
+ ---
101
+
102
+ ## Counting Characters Before You Name Things
103
+
104
+ Use this mental check before naming any ABAP element:
105
+
106
+ ```
107
+ # Object name: type prefix + your name ≤ limit
108
+ ZCL_ (4 chars) + name ≤ 30 → name ≤ 26 chars
109
+ ZIF_ (4 chars) + name ≤ 30 → name ≤ 26 chars
110
+ ZC_ (3 chars) + name ≤ 40 → name ≤ 37 chars (CDS)
111
+ Z (1 char) + name ≤ 30 → name ≤ 29 chars (table/program)
112
+
113
+ # Project-specific sub-namespace eats more of the budget — plan ahead
114
+ # Example: project uses ZFICO_ prefix for all objects
115
+ ZCL_FICO_ (9 chars) + name ≤ 30 → name ≤ 21 chars
116
+ ZCL_FICO_PAYMENT_PROPOSAL = 26 chars ✓
117
+ ZCL_FICO_PAYMENT_PROPOSAL_V = 27 chars ✓ (getting tight)
118
+
119
+ # Field name in TABL/STRU: no prefix, just ≤ 16 total
120
+ PAYMENT_METHOD = 14 chars ✓
121
+ PAYMENT_METHOD_CD = 17 chars ✗ → shorten to PAYMENT_METH_CD
122
+
123
+ # Method name: no prefix, just ≤ 30 total
124
+ test_exec_with_files → 24 chars ✓
125
+ test_execute_with_minimal_params → 34 chars ✗
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Common Length Violations and Fixes
131
+
132
+ | Too Long (violates limit) | Fixed Version | Limit |
133
+ |---|---|---|
134
+ | `ZCL_COMMAND_PULL_WITH_RETRY` (30+ chars) | `ZCL_COMMAND_PULL_RETRY` | 30 |
135
+ | `LAST_SUCCESSFULLY_PULLED_AT` (table field, 28 chars) | `LAST_PULLED_AT` | 16 |
136
+ | `test_execute_command_with_files` (test method, 32 chars) | `test_exec_with_files` | 30 |
137
+ | `ZC_MY_VERY_LONG_CDS_VIEW_NAME_EXCEEDS_40_CHARS` (47 chars) | `ZC_MY_LONG_CDS_VIEW_NAME_TRIMMED` | 40 |
138
+ | `ZBIZ_OBJECT_CREATION_SERVICE_MESSAGE_CLASS` (MSAG, 43 chars) | `ZBIZ_CREATE_MSGS` | 20 |
139
+
140
+ ---
141
+
142
+ ## SAP Technical Basis for These Limits
143
+
144
+ These limits come from the ABAP Dictionary (DDIC) and ABAP kernel:
145
+
146
+ | Limit Source | Explanation |
147
+ |---|---|
148
+ | 30 chars (most objects) | ABAP uses `RSYN` program name space; objects stored in `TADIR` with `SOBJ_NAME CHAR(40)` but compiler enforces 30 for classes/interfaces/programs |
149
+ | 16 chars (DDIC fields) | Stored in `DD03L.FIELDNAME CHAR(16)` — this is a hard database column width |
150
+ | 40 chars (CDS names) | CDS objects stored in `DD02L.TABNAME CHAR(40)` — intentionally larger for CDS |
151
+ | 20 chars (MSAG) | Message class name stored in `T100A.ARBGB CHAR(20)` |
152
+ | 26 chars (FUGR) | Function group internally prefixed with `SAPL` (4 chars) for the main include |
153
+
154
+ ---
155
+
156
+ ## See Also
157
+
158
+ - **Naming Conventions** (objects.md) — prefixes per object type
159
+ - **Object Creation** (object-creation.md) — which files to create
160
+ - **Testing** (testing.md) — test method naming (30-char limit detail)
@@ -24,7 +24,7 @@ Replace `<name>` with the actual object name from this project's naming conventi
24
24
  | CDS Access Control (DCLS) | `<name>.dcls.asdcls` | `<name>.dcls.xml` | `ref --topic abapgit` |
25
25
  | Function Group (FUGR) | `<name>.fugr.abap` + includes | `<name>.fugr.xml` | `ref --topic abapgit` |
26
26
  | Table (TABL) | *(none — XML-only)* | `<name>.tabl.xml` | `ref --topic abapgit-xml-only` |
27
- | Structure (STRU) | *(none — XML-only)* | `<name>.stru.xml` | `ref --topic abapgit-xml-only` |
27
+ | Structure (STRU) | *(none — XML-only)* | `<name>.tabl.xml` ⚠️ NOT `.stru.xml` | `ref --topic abapgit-xml-only` |
28
28
  | Data Element (DTEL) | *(none — XML-only)* | `<name>.dtel.xml` | `ref --topic abapgit-xml-only` |
29
29
  | Table Type (TTYP) | *(none — XML-only)* | `<name>.ttyp.xml` | `ref --topic abapgit-xml-only` |
30
30
  | Domain (DOMA) | *(none — XML-only)* | `<name>.doma.xml` | `ref --topic abapgit-xml-only` |
@@ -15,12 +15,13 @@ grand_parent: ABAP Development
15
15
  | | SAP Namespace | Customer Namespace |
16
16
  |---|---|---|
17
17
  | **Object prefix** | `CL_*`, `IF_*`, `/NAME/CL_*`, `/NAME/IF_*`, etc. | `Z*`, `Y*` |
18
- | **Package prefix** | SAP-delivered (e.g. `SFIN`, `CA_*`, `/NAME/*`) | `Z*`, `Y*`, `$*` |
18
+ | **Package prefix** | SAP-delivered (e.g. `SFIN`, `CA_*`, `/NAME/*`) | `Z*`, `Y*`, `$*` (local/non-transportable) |
19
19
  | **Ownership** | Delivered and maintained by SAP | Owned by the customer |
20
20
  | **In git repo** | Objects from an SAP-delivered package | Custom development objects |
21
21
 
22
22
  > **Rule**: Never add customer-created objects (including PoC/probe classes) into SAP namespace
23
23
  > packages. PoC objects always use `Z*`/`Y*` prefix and always go in a `Z*`, `Y*`, or `$*` package
24
+ > (use `$*` only for throwaway probes — non-transportable)
24
25
  > — even on a project where production objects use SAP namespace.
25
26
 
26
27
  ## How to Determine This Project's Naming Convention
@@ -43,7 +44,8 @@ Applied when no `objects.local.md` exists:
43
44
  | Class | `ZCL_` | `ZCL_MY_CLASS` |
44
45
  | Interface | `ZIF_` | `ZIF_MY_INTERFACE` |
45
46
  | Program | `Z` | `ZMY_PROGRAM` |
46
- | Package | `$` | `$MY_PACKAGE` |
47
+ | Package | `Z` or `Y` | `ZMYPROJECT` |
48
+ > **Note**: `$` packages (e.g. `$TMP`) are local/non-transportable — use only for throwaway probe objects, never for real development.
47
49
  | Table | `Z` | `ZMY_TABLE` |
48
50
  | CDS View Entity | `ZC_` | `ZC_MY_VIEW` |
49
51
  | Data Element | `Z` | `ZMY_ELEMENT` |
@@ -83,3 +85,4 @@ Default package: /MYNAMESPACE/MAIN
83
85
 
84
86
  → For file structure (what files to create): `abapgit-agent ref --topic object-creation`
85
87
  → For XML templates: `abapgit-agent ref --topic abapgit`
88
+ → For name **length limits** (30/16/40 char rules): `abapgit-agent ref --topic naming-limits`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abapgit-agent",
3
- "version": "1.15.2",
3
+ "version": "1.15.3",
4
4
  "description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
5
5
  "files": [
6
6
  "bin/",
@@ -1,264 +0,0 @@
1
- # ABAP Development with abapGit
2
-
3
- You are working on an ABAP project using abapGit for version control.
4
-
5
- ---
6
-
7
- ## Critical Rules
8
-
9
- ### 1. Use `ref` Command for Unfamiliar Topics
10
-
11
- **When starting to work on ANY unfamiliar ABAP topic, syntax, or pattern, you MUST use the `ref` command BEFORE writing any code.**
12
-
13
- ```
14
- ❌ WRONG: Start writing code immediately based on assumptions
15
- ✅ CORRECT: Run ref command first to look up the correct pattern
16
- ```
17
-
18
- **Why**: ABAP syntax is strict. Guessing leads to activation errors that waste time.
19
-
20
- | Scenario | Example |
21
- |----------|---------|
22
- | Implementing new ABAP feature | "How do I use FILTER operator?" |
23
- | Unfamiliar pattern | "What's the correct VALUE #() syntax?" |
24
- | SQL operations | "How to write a proper SELECT with JOIN?" |
25
- | CDS views | "How to define CDS view with associations?" |
26
- | Getting syntax errors | Check reference before trying approaches |
27
-
28
- ```bash
29
- # Search for a pattern
30
- abapgit-agent ref "CORRESPONDING"
31
- abapgit-agent ref "FILTER #"
32
-
33
- # Browse by topic
34
- abapgit-agent ref --topic exceptions
35
- abapgit-agent ref --topic sql
36
-
37
- # List all topics
38
- abapgit-agent ref --list-topics
39
- ```
40
-
41
- ### 2. Read `.abapGitAgent` for Folder Location and Naming Conventions
42
-
43
- **Before creating ANY ABAP object file, you MUST read `.abapGitAgent` to determine the correct folder.**
44
-
45
- ```
46
- ❌ WRONG: Assume files go in "abap/" folder
47
- ✅ CORRECT: Read .abapGitAgent to get the "folder" property value
48
- ```
49
-
50
- The folder is configured in `.abapGitAgent` (property: `folder`):
51
- - If `folder` is `/src/` → files go in `src/` (e.g., `src/zcl_my_class.clas.abap`)
52
- - If `folder` is `/abap/` → files go in `abap/` (e.g., `abap/zcl_my_class.clas.abap`)
53
-
54
- **Also check naming conventions before creating any new object:**
55
-
56
- ```
57
- 1. Check guidelines/objects.local.md ← project-specific overrides (if file exists)
58
- 2. Fall back to guidelines/objects.md ← default Z/Y prefix conventions
59
- ```
60
-
61
- `objects.local.md` is created by `abapgit-agent init` and is never overwritten by updates — it holds project-specific prefixes (e.g. `YCL_` instead of `ZCL_`).
62
-
63
- ### 3. Create XML Metadata / Local Classes
64
-
65
- Each ABAP object needs an XML metadata file. Local helper/test-double classes use separate `.locals_def.abap` / `.locals_imp.abap` files.
66
- → See `guidelines/object-creation.md` for XML templates and local class setup
67
-
68
- ### 4. Use Syntax Command Before Commit (for CLAS, INTF, PROG, DDLS)
69
-
70
- ```
71
- ❌ WRONG: Make changes → Commit → Push → Pull → Find errors → Fix → Repeat
72
- ✅ CORRECT: Make changes → Run syntax → Fix locally → Commit → Push → Pull → Done
73
- ```
74
-
75
- **For CLAS, INTF, PROG, DDLS files**: Run `syntax` command BEFORE commit to catch errors early.
76
-
77
- ```bash
78
- # Check syntax of local code (no commit/push needed)
79
- abapgit-agent syntax --files src/zcl_my_class.clas.abap
80
-
81
- # Check multiple INDEPENDENT files
82
- abapgit-agent syntax --files src/zcl_utils.clas.abap,src/zcl_logger.clas.abap
83
- ```
84
-
85
- **For dependent files, skip `syntax` and use `pull` instead:**
86
- ```bash
87
- # ❌ BAD - Interface and implementing class (may show false errors)
88
- abapgit-agent syntax --files src/zif_my_intf.intf.abap,src/zcl_my_class.clas.abap
89
-
90
- # ✅ GOOD - Use pull instead for dependent files
91
- git add . && git commit && git push
92
- abapgit-agent pull --files src/zif_my_intf.intf.abap,src/zcl_my_class.clas.abap
93
- ```
94
-
95
- ### 5. Local Helper / Test-Double Classes
96
-
97
- → See `guidelines/object-creation.md` for local class setup (`locals_def.abap` / `locals_imp.abap`)
98
-
99
- ### 6. Use `ref`, `view` and `where` Commands to Learn About Unknown Classes/Methods
100
-
101
- **When working with unfamiliar ABAP classes or methods, follow this priority:**
102
-
103
- ```
104
- 1. First: Check local git repo for usage examples
105
- 2. Second: Check ABAP reference/cheat sheets
106
- 3. Third: Use view/where commands to query ABAP system (if needed)
107
- ```
108
-
109
- ```bash
110
- # Find where a class/interface is USED
111
- abapgit-agent where --objects ZIF_UNKNOWN_INTERFACE
112
-
113
- # View CLASS DEFINITION
114
- abapgit-agent view --objects ZCL_UNKNOWN_CLASS
115
- ```
116
-
117
- ### 7. CDS Unit Tests
118
-
119
- Use `CL_CDS_TEST_ENVIRONMENT` for unit tests that read CDS views.
120
- → See `guidelines/cds-testing.md` for code examples
121
-
122
- ### 8. Use `unit` Command for Unit Tests
123
-
124
- **Use `abapgit-agent unit` to run ABAP unit tests (AUnit).**
125
-
126
- ```
127
- ❌ WRONG: Try to use SE24, SE37, or other transaction codes
128
- ✅ CORRECT: Use abapgit-agent unit --files src/zcl_test.clas.testclasses.abap
129
- ```
130
-
131
- ```bash
132
- # Run unit tests (after pulling to ABAP)
133
- abapgit-agent unit --files src/zcl_test.clas.testclasses.abap
134
-
135
- # Multiple test classes
136
- abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.clas.testclasses.abap
137
- ```
138
-
139
- ### 9. Troubleshooting ABAP Issues
140
-
141
- | Symptom | Tool | When |
142
- |---|---|---|
143
- | HTTP 500 / runtime crash (ST22) | `dump` | Error already occurred |
144
- | Wrong output, no crash | `debug` | Need to trace logic |
145
-
146
- Quick start:
147
- ```bash
148
- abapgit-agent dump --date TODAY --detail 1 # inspect last crash
149
- abapgit-agent debug set --objects ZCL_FOO:42 # set breakpoint then attach
150
- ```
151
- → See `guidelines/debug-dump.md` for dump analysis workflow
152
- → See `guidelines/debug-session.md` for full debug session guide, breakpoint tips, and pull flow architecture
153
-
154
- ---
155
-
156
- ## Development Workflow
157
-
158
- This project's workflow mode is configured in `.abapGitAgent` under `workflow.mode`.
159
-
160
- ### Project-Level Config (`.abapgit-agent.json`)
161
-
162
- Checked into the repository — applies to all developers. **Read this file at the start of every session.**
163
-
164
- | Setting | Values | Default | Effect |
165
- |---------|--------|---------|--------|
166
- | `safeguards.requireFilesForPull` | `true`/`false` | `false` | Requires `--files` on every pull |
167
- | `safeguards.disablePull` | `true`/`false` | `false` | Disables pull entirely (CI/CD-only projects) |
168
- | `conflictDetection.mode` | `"abort"`/`"ignore"` | `"abort"` | Whether to abort pull on conflict |
169
- | `transports.allowCreate` | `true`/`false` | `true` | When `false`, `transport create` is blocked |
170
- | `transports.allowRelease` | `true`/`false` | `true` | When `false`, `transport release` is blocked |
171
-
172
- ### Workflow Modes
173
-
174
- | Mode | Branch Strategy | Rebase Before Pull | Create PR |
175
- |------|----------------|-------------------|-----------|
176
- | `"branch"` | Feature branches | ✓ Always | ✓ Yes (squash merge) |
177
- | `"trunk"` | Direct to default branch | ✗ No | ✗ No |
178
- | (not set) | Direct to default branch | ✗ No | ✗ No |
179
-
180
- ### Trunk Workflow (`"mode": "trunk"`)
181
-
182
- ```bash
183
- git checkout main
184
- git pull origin main
185
- edit src/zcl_auth_handler.clas.abap
186
- abapgit-agent syntax --files src/zcl_auth_handler.clas.abap
187
- git add . && git commit -m "feat: add authentication handler"
188
- git push origin main
189
- abapgit-agent pull --files src/zcl_auth_handler.clas.abap
190
- ```
191
-
192
- ### Branch Workflow (`"mode": "branch"`)
193
-
194
- → See `guidelines/branch-workflow.md` for step-by-step commands and examples
195
-
196
- ### AI Tool Guidelines
197
-
198
- **When `workflow.mode = "branch"`:**
199
- 1. ✓ Create feature branches (naming: `feature/description`)
200
- 2. ✓ Always `git fetch origin <default> && git rebase origin/<default>` before `pull` command
201
- 3. ✓ Use `--force-with-lease` after rebase (never `--force`)
202
- 4. ✓ Create PR with squash merge when feature complete
203
- 5. ✗ Never commit directly to default branch
204
-
205
- **When `workflow.mode = "trunk"` or not set:**
206
- 1. ✓ Commit directly to default branch
207
- 2. ✓ `git pull origin <default>` before push
208
- 3. ✗ Don't create feature branches
209
-
210
- **When `safeguards.requireFilesForPull = true`:** always include `--files` in every `pull` command
211
-
212
- **When `safeguards.disablePull = true`:** do not run `abapgit-agent pull` at all
213
-
214
- **When `conflictDetection.mode = "abort"`:** if pull aborts with conflict error, inform user and suggest `--conflict-mode ignore` to override for that run
215
-
216
- ### Quick Decision Tree
217
-
218
- ```
219
- Modified ABAP files?
220
- ├─ CLAS/INTF/PROG/DDLS files?
221
- │ ├─ Independent files (no cross-dependencies)?
222
- │ │ └─ ✅ Use: syntax → commit → push → pull
223
- │ └─ Dependent files (interface + class, class uses class)?
224
- │ └─ ✅ Use: skip syntax → commit → push → pull
225
- └─ Other types (FUGR, TABL, etc.)?
226
- └─ ✅ Use: skip syntax → commit → push → pull → (if errors: inspect)
227
- ```
228
-
229
- → See `guidelines/workflow-detailed.md` for full workflow decision tree, error indicators, and complete command reference
230
-
231
- ---
232
-
233
- ## Guidelines Index
234
-
235
- Detailed guidelines are available in the `guidelines/` folder:
236
-
237
- | File | Topic |
238
- |------|-------|
239
- | `guidelines/sql.md` | ABAP SQL Best Practices |
240
- | `guidelines/exceptions.md` | Exception Handling |
241
- | `guidelines/testing.md` | Unit Testing (including CDS) |
242
- | `guidelines/cds.md` | CDS Views |
243
- | `guidelines/classes.md` | ABAP Classes and Objects |
244
- | `guidelines/objects.md` | Object Naming Conventions (defaults) |
245
- | `guidelines/objects.local.md` | **Project** Naming Conventions — overrides `objects.md` (never overwritten) |
246
- | `guidelines/json.md` | JSON Handling |
247
- | `guidelines/abapgit.md` | abapGit XML Metadata Templates |
248
- | `guidelines/unit-testable-code.md` | Unit Testable Code Guidelines (Dependency Injection) |
249
- | `guidelines/common-errors.md` | Common ABAP Errors - Quick Fixes |
250
- | `guidelines/debug-session.md` | Debug Session Guide |
251
- | `guidelines/debug-dump.md` | Dump Analysis Guide |
252
- | `guidelines/branch-workflow.md` | Branch Workflow |
253
- | `guidelines/workflow-detailed.md` | Development Workflow (Detailed) |
254
- | `guidelines/object-creation.md` | Object Creation (XML metadata, local classes) |
255
- | `guidelines/cds-testing.md` | CDS Testing (Test Double Framework) |
256
-
257
- These guidelines are automatically searched by the `ref` command.
258
-
259
- ---
260
-
261
- ## For More Information
262
-
263
- - [SAP ABAP Cheat Sheets](https://github.com/SAP-samples/abap-cheat-sheets)
264
- - [ABAP Keyword Documentation](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm)