abapgit-agent 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abap/guidelines/00_index.md +1 -0
- package/abap/guidelines/01_sql.md +16 -0
- package/abap/guidelines/02_exceptions.md +92 -0
- package/abap/guidelines/03_testing.md +36 -0
- package/abap/guidelines/04_cds.md +16 -0
- package/abap/guidelines/05_classes.md +119 -0
- package/abap/guidelines/06_objects.md +46 -86
- package/abap/guidelines/07_json.md +2 -0
- package/abap/guidelines/08_abapgit.md +40 -0
- package/abap/guidelines/09_unit_testable_code.md +589 -0
- package/bin/abapgit-agent +176 -32
- package/package.json +5 -1
- package/src/abap-client.js +46 -0
- package/src/agent.js +48 -0
- package/src/config.js +1 -1
- package/src/ref-search.js +92 -44
|
@@ -14,6 +14,7 @@ This folder contains detailed ABAP coding guidelines that can be searched using
|
|
|
14
14
|
| `06_objects.md` | Object Naming Conventions |
|
|
15
15
|
| `07_json.md` | JSON Handling |
|
|
16
16
|
| `08_abapgit.md` | abapGit XML Metadata Templates |
|
|
17
|
+
| `09_unit_testable_code.md` | Unit Testable Code Guidelines (Dependency Injection) |
|
|
17
18
|
|
|
18
19
|
## Usage
|
|
19
20
|
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
# ABAP SQL Best Practices
|
|
2
2
|
|
|
3
|
+
**Searchable keywords**: SELECT, FROM, WHERE, ABAP SQL, Open SQL, host variable, @ prefix, range table, INTO, UP TO, OFFSET, GROUP BY, JOIN
|
|
4
|
+
|
|
3
5
|
When writing ABAP SQL (Open SQL) queries, follow these rules:
|
|
4
6
|
|
|
7
|
+
## TOPICS IN THIS FILE
|
|
8
|
+
1. Host Variables (@ prefix) - line 5
|
|
9
|
+
2. Range Tables (IN clause) - line 17
|
|
10
|
+
3. SELECT Clause Order - line 35
|
|
11
|
+
4. Fixed Point Arithmetic - line 52
|
|
12
|
+
5. Field Separation - line 62
|
|
13
|
+
|
|
5
14
|
## 1. Host Variables - Use @ Prefix
|
|
6
15
|
|
|
7
16
|
Use `@` prefix for host variables in ABAP SQL:
|
|
@@ -70,3 +79,10 @@ SELECT object, obj_name FROM tadir ...
|
|
|
70
79
|
" Wrong - missing comma
|
|
71
80
|
SELECT object obj_name FROM tadir ...
|
|
72
81
|
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## See Also
|
|
86
|
+
- **Constructor Expressions** (05_classes.md) - for VALUE #(), FILTER, FOR loops
|
|
87
|
+
- **Internal Tables** - for filtering and iteration patterns
|
|
88
|
+
- **abapGit** (08_abapgit.md) - for XML metadata templates
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Exception Handling - Classical vs Class-Based
|
|
2
2
|
|
|
3
|
+
**Searchable keywords**: exception, RAISING, TRY, CATCH, cx_static_check, cx_dynamic_check, EXCEPTIONS, sy-subrc, class-based exception, classical exception
|
|
4
|
+
|
|
5
|
+
## TOPICS IN THIS FILE
|
|
6
|
+
1. Quick Identification - line 5
|
|
7
|
+
2. Classical Exceptions - line 12
|
|
8
|
+
3. Class-Based Exceptions - line 25
|
|
9
|
+
4. Method Signatures - line 50
|
|
10
|
+
5. Best Practices - line 80
|
|
11
|
+
6. Interface vs Class Methods - line 118
|
|
12
|
+
|
|
3
13
|
ABAP has two exception handling mechanisms. Using the wrong one causes silent failures.
|
|
4
14
|
|
|
5
15
|
## Quick Identification
|
|
@@ -106,3 +116,85 @@ Or search the cheat sheets:
|
|
|
106
116
|
```bash
|
|
107
117
|
abapgit-agent ref --topic exceptions
|
|
108
118
|
```
|
|
119
|
+
|
|
120
|
+
## Interface vs Class Methods
|
|
121
|
+
|
|
122
|
+
### Interface Methods
|
|
123
|
+
|
|
124
|
+
Cannot add RAISING clause in the implementing class. Options:
|
|
125
|
+
|
|
126
|
+
1. Add RAISING to interface definition
|
|
127
|
+
2. Use TRY-CATCH in the implementation
|
|
128
|
+
|
|
129
|
+
```abap
|
|
130
|
+
" Interface definition - can add RAISING here
|
|
131
|
+
INTERFACE zif_example.
|
|
132
|
+
methods execute
|
|
133
|
+
importing is_param type data optional
|
|
134
|
+
returning value(rv_result) type string
|
|
135
|
+
raising cx_static_check.
|
|
136
|
+
ENDINTERFACE.
|
|
137
|
+
|
|
138
|
+
" Implementation - CANNOT add RAISING here
|
|
139
|
+
CLASS zcl_example DEFINITION.
|
|
140
|
+
INTERFACES zif_example.
|
|
141
|
+
ENDCLASS.
|
|
142
|
+
|
|
143
|
+
CLASS zcl_example IMPLEMENTATION.
|
|
144
|
+
METHOD zif_example~execute.
|
|
145
|
+
" Must handle cx_static_check here with TRY-CATCH
|
|
146
|
+
" or declare it in interface, not here
|
|
147
|
+
ENDMETHOD.
|
|
148
|
+
ENDCLASS.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Class Methods
|
|
152
|
+
|
|
153
|
+
Can add RAISING clause to declare exceptions, allowing caller to handle in one place:
|
|
154
|
+
|
|
155
|
+
```abap
|
|
156
|
+
" Class method with RAISING clause
|
|
157
|
+
METHODS process_data
|
|
158
|
+
importing iv_data type string
|
|
159
|
+
returning value(rv_result) type string
|
|
160
|
+
raising cx_static_check.
|
|
161
|
+
|
|
162
|
+
" Caller can handle in one place
|
|
163
|
+
TRY.
|
|
164
|
+
lv_result = lo_obj->process_data( iv_data = 'test' ).
|
|
165
|
+
CATCH cx_static_check.
|
|
166
|
+
" Handle exception
|
|
167
|
+
ENDTRY.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### When to Use Each
|
|
171
|
+
|
|
172
|
+
| Scenario | Recommendation |
|
|
173
|
+
|----------|----------------|
|
|
174
|
+
| Multiple callers need to handle exception | Add RAISING to method definition |
|
|
175
|
+
| Exception should be handled internally | Use TRY-CATCH in implementation |
|
|
176
|
+
| Interface method | Add RAISING to interface, or use TRY-CATCH in class |
|
|
177
|
+
|
|
178
|
+
### RAISING Clause in Method Calls
|
|
179
|
+
|
|
180
|
+
The `RAISING` clause **cannot be used in method call statements**. It can only be used in method definitions.
|
|
181
|
+
|
|
182
|
+
```abap
|
|
183
|
+
" WRONG - syntax error
|
|
184
|
+
lo_handler->read( ... ) RAISING cx_dd_ddl_check.
|
|
185
|
+
|
|
186
|
+
" CORRECT - use TRY-CATCH
|
|
187
|
+
TRY.
|
|
188
|
+
lo_handler->read( ... ).
|
|
189
|
+
CATCH cx_dd_ddl_check.
|
|
190
|
+
" Handle error
|
|
191
|
+
ENDTRY.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Correct usage in method definitions:**
|
|
195
|
+
```abap
|
|
196
|
+
" Interface/Class method definition
|
|
197
|
+
METHODS read
|
|
198
|
+
IMPORTING iv_name TYPE string
|
|
199
|
+
RAISING cx_static_check.
|
|
200
|
+
``` |
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Unit Testing
|
|
2
2
|
|
|
3
|
+
**Searchable keywords**: unit test, AUnit, test class, cl_abap_unit_assert, FOR TESTING, setup, teardown, RISK LEVEL, DURATION, CDS test double, CL_CDS_TEST_ENVIRONMENT
|
|
4
|
+
|
|
5
|
+
## TOPICS IN THIS FILE
|
|
6
|
+
1. Local Test Classes - line 3
|
|
7
|
+
2. File Structure - line 5
|
|
8
|
+
3. Required Elements - line 16
|
|
9
|
+
4. Naming Conventions - line 48
|
|
10
|
+
5. CDS Test Doubles - line 94
|
|
11
|
+
6. CDS with Aggregations - line 178
|
|
12
|
+
|
|
3
13
|
## Unit Testing with Local Test Classes
|
|
4
14
|
|
|
5
15
|
### File Structure
|
|
@@ -69,6 +79,25 @@ Examples of compliant names:
|
|
|
69
79
|
- `test_exec_files` (16 chars)
|
|
70
80
|
- `test_interface` (15 chars)
|
|
71
81
|
|
|
82
|
+
### Test Methods and RAISING Clause
|
|
83
|
+
|
|
84
|
+
If a test method calls methods that raise exceptions, add `RAISING` to the method definition:
|
|
85
|
+
|
|
86
|
+
```abap
|
|
87
|
+
" CORRECT - declare that method can raise exceptions
|
|
88
|
+
METHODS test_validate_ddls FOR TESTING RAISING cx_static_check.
|
|
89
|
+
METHODS test_read_data FOR TESTING RAISING cx_dd_ddl_check.
|
|
90
|
+
|
|
91
|
+
" Then implement with TRY-CATCH if needed
|
|
92
|
+
METHOD test_validate_ddls.
|
|
93
|
+
TRY.
|
|
94
|
+
mo_cut->some_method( ).
|
|
95
|
+
CATCH cx_static_check.
|
|
96
|
+
" Handle exception
|
|
97
|
+
ENDTRY.
|
|
98
|
+
ENDMETHOD.
|
|
99
|
+
```
|
|
100
|
+
|
|
72
101
|
### Common Assertions
|
|
73
102
|
|
|
74
103
|
```abap
|
|
@@ -250,3 +279,10 @@ ENDMETHOD.
|
|
|
250
279
|
abapgit-agent ref "cl_cds_test_environment"
|
|
251
280
|
abapgit-agent ref --topic unit-tests
|
|
252
281
|
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## See Also
|
|
286
|
+
- **CDS Views** (04_cds.md) - for CDS view definitions and syntax
|
|
287
|
+
- **abapGit** (08_abapgit.md) - for WITH_UNIT_TESTS in XML metadata
|
|
288
|
+
- **ABAP SQL** (01_sql.md) - for SELECT statements in tests
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Creating CDS Views
|
|
2
2
|
|
|
3
|
+
**Searchable keywords**: CDS, DDL, DDLS, CDS view, @AbapCatalog, @AccessControl, association, projection, consumption
|
|
4
|
+
|
|
5
|
+
## TOPICS IN THIS FILE
|
|
6
|
+
1. File Naming - line 7
|
|
7
|
+
2. DDL Source (.ddls.asddls) - line 18
|
|
8
|
+
3. Annotations - line 50
|
|
9
|
+
4. Associations - line 75
|
|
10
|
+
5. CDS Test Doubles - see 03_testing.md
|
|
11
|
+
|
|
3
12
|
## Creating CDS Views (DDLS)
|
|
4
13
|
|
|
5
14
|
CDS views (Data Definition Language Source) require specific file naming and structure for abapGit.
|
|
@@ -118,3 +127,10 @@ When working with CDS view syntax (arithmetic, built-in functions, aggregations,
|
|
|
118
127
|
- `zdemo_abap_cds_ve_assoc.ddls.asddls` - Associations
|
|
119
128
|
|
|
120
129
|
**Note**: This requires `abap-cheat-sheets` to be in the reference folder (configured in `.abapGitAgent`).
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## See Also
|
|
134
|
+
- **Unit Testing** (03_testing.md) - for CDS Test Double Framework
|
|
135
|
+
- **abapGit** (08_abapgit.md) - for CDS XML metadata templates
|
|
136
|
+
- **ABAP SQL** (01_sql.md) - for SQL functions used in CDS
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# ABAP Classes and Objects
|
|
2
2
|
|
|
3
|
+
**Searchable keywords**: CLASS, DEFINITION, PUBLIC, CREATE OBJECT, NEW, METHOD, INTERFACES, inheritance, FINAL, ABSTRACT
|
|
4
|
+
|
|
5
|
+
## TOPICS IN THIS FILE
|
|
6
|
+
1. Class Definition (PUBLIC) - line 3
|
|
7
|
+
2. Constructor - line 20
|
|
8
|
+
3. Interfaces - line 35
|
|
9
|
+
4. Inline Declaration - line 50
|
|
10
|
+
5. Abstract Methods - line 99
|
|
11
|
+
6. FINAL Class Limitation - line 117
|
|
12
|
+
7. Working with TYPE any - line 135
|
|
13
|
+
|
|
3
14
|
## ABAP Class Definition - Must Use PUBLIC
|
|
4
15
|
|
|
5
16
|
**CRITICAL**: Global ABAP classes MUST use `PUBLIC` in the class definition:
|
|
@@ -48,3 +59,111 @@ ENDCLASS.
|
|
|
48
59
|
|
|
49
60
|
**Wrong**: `METHOD do_something.` - parameter `iv_param` will be unknown
|
|
50
61
|
**Correct**: `METHOD zif_my_interface~do_something.` - parameters recognized
|
|
62
|
+
|
|
63
|
+
## Use Interface Type for References
|
|
64
|
+
|
|
65
|
+
When a class implements an interface, use the **interface type** instead of the class type for references:
|
|
66
|
+
|
|
67
|
+
```abap
|
|
68
|
+
" Interface definition
|
|
69
|
+
INTERFACE zif_my_interface PUBLIC.
|
|
70
|
+
METHODS do_something RETURNING VALUE(rv_result) TYPE string.
|
|
71
|
+
ENDINTERFACE.
|
|
72
|
+
|
|
73
|
+
" Class implements interface
|
|
74
|
+
CLASS zcl_my_class DEFINITION PUBLIC.
|
|
75
|
+
PUBLIC SECTION.
|
|
76
|
+
INTERFACES zif_my_interface.
|
|
77
|
+
CLASS-METHODS get_instance RETURNING VALUE(ro_instance) TYPE REF TO zif_my_interface.
|
|
78
|
+
ENDCLASS.
|
|
79
|
+
|
|
80
|
+
" Caller - use interface type, not class type
|
|
81
|
+
CLASS zcl_consumer DEFINITION PUBLIC.
|
|
82
|
+
PRIVATE SECTION.
|
|
83
|
+
DATA mo_instance TYPE REF TO zif_my_interface. " <- Use interface type
|
|
84
|
+
ENDCLASS.
|
|
85
|
+
|
|
86
|
+
METHOD zcl_consumer->do_something.
|
|
87
|
+
mo_instance = zcl_my_class=>get_instance( ).
|
|
88
|
+
|
|
89
|
+
" Call without interface prefix - cleaner code
|
|
90
|
+
DATA(lv_result) = mo_instance->do_something( ).
|
|
91
|
+
ENDMETHOD.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Benefits:**
|
|
95
|
+
- Cleaner code: `mo_instance->method( )` instead of `mo_instance->zif_my_interface~method( )`
|
|
96
|
+
- Flexibility: Can swap implementation class without changing caller (dependency inversion)
|
|
97
|
+
- Consistency: All callers use the same interface type
|
|
98
|
+
|
|
99
|
+
**Key rule:** Always use `REF TO zif_xxx` not `REF TO zcl_xxx` for instance variables and parameters.
|
|
100
|
+
|
|
101
|
+
## Abstract Methods
|
|
102
|
+
|
|
103
|
+
The ABSTRACT keyword must come immediately after the method name:
|
|
104
|
+
|
|
105
|
+
```abap
|
|
106
|
+
" ✅ Correct - ABSTRACT right after method name
|
|
107
|
+
METHODS get_name ABSTRACT
|
|
108
|
+
RETURNING VALUE(rv_name) TYPE string.
|
|
109
|
+
|
|
110
|
+
" ❌ Wrong - ABSTRACT after parameters (syntax error)
|
|
111
|
+
METHODS get_name
|
|
112
|
+
RETURNING VALUE(rv_name) TYPE string
|
|
113
|
+
ABSTRACT.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## FINAL Class Limitation
|
|
117
|
+
|
|
118
|
+
A FINAL class cannot have abstract methods. Use plain REDEFINITION instead:
|
|
119
|
+
|
|
120
|
+
```abap
|
|
121
|
+
" ❌ Wrong in FINAL class - syntax error
|
|
122
|
+
CLASS zcl_my_class DEFINITION PUBLIC FINAL.
|
|
123
|
+
METHODS parse_request ABSTRACT REDEFINITION.
|
|
124
|
+
ENDCLASS.
|
|
125
|
+
|
|
126
|
+
" ✅ Correct in FINAL class - use REDEFINITION only
|
|
127
|
+
CLASS zcl_my_class DEFINITION PUBLIC FINAL.
|
|
128
|
+
METHODS parse_request REDEFINITION.
|
|
129
|
+
ENDCLASS.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Working with TYPE any
|
|
133
|
+
|
|
134
|
+
TYPE any cannot be used with CREATE DATA. When a base class defines parameters with TYPE any, use a typed local variable in the subclass:
|
|
135
|
+
|
|
136
|
+
```abap
|
|
137
|
+
" Base class defines:
|
|
138
|
+
CLASS zcl_base DEFINITION PUBLIC ABSTRACT.
|
|
139
|
+
PROTECTED SECTION.
|
|
140
|
+
METHODS parse_request
|
|
141
|
+
IMPORTING iv_json TYPE string
|
|
142
|
+
EXPORTING es_request TYPE any.
|
|
143
|
+
ENDCLASS.
|
|
144
|
+
|
|
145
|
+
" Subclass implementation:
|
|
146
|
+
CLASS zcl_subclass DEFINITION PUBLIC FINAL.
|
|
147
|
+
INHERITING FROM zcl_base.
|
|
148
|
+
PROTECTED SECTION.
|
|
149
|
+
METHODS parse_request REDEFINITION.
|
|
150
|
+
ENDCLASS.
|
|
151
|
+
|
|
152
|
+
CLASS zcl_subclass IMPLEMENTATION.
|
|
153
|
+
METHOD parse_request.
|
|
154
|
+
" Use typed local variable
|
|
155
|
+
DATA: ls_request TYPE ty_my_params.
|
|
156
|
+
|
|
157
|
+
/ui2/cl_json=>deserialize(
|
|
158
|
+
EXPORTING json = iv_json
|
|
159
|
+
CHANGING data = ls_request ).
|
|
160
|
+
|
|
161
|
+
es_request = ls_request. " Assign typed to generic
|
|
162
|
+
ENDMETHOD.
|
|
163
|
+
ENDCLASS.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Key points:**
|
|
167
|
+
- Declare a local variable with the concrete type
|
|
168
|
+
- Deserialize JSON into the typed local variable
|
|
169
|
+
- Assign to the generic TYPE any parameter
|
|
@@ -1,103 +1,63 @@
|
|
|
1
|
-
# ABAP
|
|
1
|
+
# ABAP Object Naming Conventions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Searchable keywords**: naming convention, Z prefix, namespace, object type, CLAS, INTF, PROG, TABL, DDLS
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## TOPICS IN THIS FILE
|
|
6
|
+
1. Naming Conventions
|
|
7
|
+
2. ABAP Object Types
|
|
8
|
+
3. XML Metadata (see guidelines/08_abapgit.md)
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## Naming Conventions
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
12
|
+
Use `Z_` or `Y_` prefix for custom objects:
|
|
13
|
+
|
|
14
|
+
| Object Type | Prefix | Example |
|
|
15
|
+
|-------------|--------|---------|
|
|
16
|
+
| Class | ZCL_ | ZCL_MY_CLASS |
|
|
17
|
+
| Interface | ZIF_ | ZIF_MY_INTERFACE |
|
|
18
|
+
| Program | Z | ZMY_PROGRAM |
|
|
19
|
+
| Package | $ | $MY_PACKAGE |
|
|
20
|
+
| Table | Z | ZMY_TABLE |
|
|
21
|
+
| CDS View | ZC | ZC_MY_VIEW |
|
|
22
|
+
| CDS Entity | ZE | ZE_MY_ENTITY |
|
|
23
|
+
| Data Element | Z | ZMY_ELEMENT |
|
|
24
|
+
| Structure | Z | ZMY_STRUCTURE |
|
|
25
|
+
| Table Type | Z | ZMY_TABLE_TYPE |
|
|
13
26
|
|
|
14
|
-
|
|
27
|
+
## ABAP Object Types
|
|
15
28
|
|
|
16
|
-
|
|
29
|
+
Common object types in this project:
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
| Type | Description | File Suffix |
|
|
32
|
+
|------|-------------|-------------|
|
|
33
|
+
| CLAS | Classes | .clas.abap |
|
|
34
|
+
| PROG | Programs | .prog.abap |
|
|
35
|
+
| FUGR | Function Groups | .fugr.abap |
|
|
36
|
+
| INTF | Interfaces | .intf.abap |
|
|
37
|
+
| TABL | Tables | .tabl.abap |
|
|
38
|
+
| STRU | Structures | .stru.abap |
|
|
39
|
+
| DTEL | Data Elements | .dtel.abap |
|
|
40
|
+
| TTYP | Table Types | .ttyp.abap |
|
|
41
|
+
| DDLS | CDS Views | .ddls.asddls |
|
|
42
|
+
| DDLX | CDS Entities | .ddlx.asddlx |
|
|
19
43
|
|
|
20
|
-
|
|
21
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
22
|
-
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
|
23
|
-
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
|
24
|
-
<asx:values>
|
|
25
|
-
<VSEOCLASS>
|
|
26
|
-
<CLSNAME>ZCL_ABGAGT_UTIL</CLSNAME>
|
|
27
|
-
<LANGU>E</LANGU>
|
|
28
|
-
<DESCRIPT>Description</DESCRIPT>
|
|
29
|
-
<EXPOSURE>2</EXPOSURE>
|
|
30
|
-
<STATE>1</STATE>
|
|
31
|
-
<UNICODE>X</UNICODE>
|
|
32
|
-
</VSEOCLASS>
|
|
33
|
-
</asx:values>
|
|
34
|
-
</asx:abap>
|
|
35
|
-
</abapGit>
|
|
36
|
-
```
|
|
44
|
+
## XML Metadata
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
**See guidelines/08_abapgit.md for XML templates.**
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
Each ABAP object requires an XML metadata file for abapGit. Quick reference:
|
|
41
49
|
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<VSEOINTERF>
|
|
48
|
-
<CLSNAME>ZIF_ABGAGT_UTIL</CLSNAME>
|
|
49
|
-
<LANGU>E</LANGU>
|
|
50
|
-
<DESCRIPT>Description</DESCRIPT>
|
|
51
|
-
<EXPOSURE>2</EXPOSURE>
|
|
52
|
-
<STATE>1</STATE>
|
|
53
|
-
<UNICODE>X</UNICODE>
|
|
54
|
-
</VSEOINTERF>
|
|
55
|
-
</asx:values>
|
|
56
|
-
</asx:abap>
|
|
57
|
-
</abapGit>
|
|
50
|
+
```
|
|
51
|
+
Class: zcl_*.clas.xml
|
|
52
|
+
Interface: zif_*.intf.xml
|
|
53
|
+
Table: z*.tabl.xml
|
|
54
|
+
CDS View: zc_*.ddls.xml
|
|
58
55
|
```
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
1. **CRITICAL: Push to git BEFORE pulling into ABAP**
|
|
63
|
-
- Always commit and push ABAP files to git first
|
|
64
|
-
- Then run `abapgit-agent pull` to activate in ABAP
|
|
65
|
-
- Never run `abapgit-agent pull` without pushing changes first
|
|
66
|
-
|
|
67
|
-
2. **Only pull ABAP files** - The XML metadata stays in git:
|
|
68
|
-
```bash
|
|
69
|
-
abapgit-agent pull --files zcl_my_class.clas.abap
|
|
70
|
-
```
|
|
71
|
-
3. abapGit reads the XML from git to deserialize the ABAP code
|
|
72
|
-
4. XML files are NOT activated in ABAP - they are only for abapGit
|
|
73
|
-
|
|
57
|
+
**Important**: Always push to git BEFORE running pull:
|
|
74
58
|
```bash
|
|
75
|
-
# After making changes to ABAP files
|
|
76
59
|
git add .
|
|
77
|
-
git commit -m "
|
|
78
|
-
git push
|
|
79
|
-
|
|
80
|
-
# Then validate in ABAP system (single file - fast)
|
|
60
|
+
git commit -m "Changes"
|
|
61
|
+
git push # CRITICAL: Push FIRST
|
|
81
62
|
abapgit-agent pull --files abap/zcl_my_class.clas.abap
|
|
82
|
-
|
|
83
|
-
# Or validate all files
|
|
84
|
-
abapgit-agent pull
|
|
85
63
|
```
|
|
86
|
-
|
|
87
|
-
## Naming Conventions
|
|
88
|
-
|
|
89
|
-
- Use `Z_` or `Y_` prefix for custom objects
|
|
90
|
-
- Class names: `ZCL_<NAME>`
|
|
91
|
-
- Interface names: `ZIF_<NAME>`
|
|
92
|
-
- Programs: `Z<NAME>`
|
|
93
|
-
- Package: `$<PROJECT_NAME>`
|
|
94
|
-
|
|
95
|
-
## ABAP Object Types
|
|
96
|
-
|
|
97
|
-
Common object types in this project:
|
|
98
|
-
- `CLAS` - Classes
|
|
99
|
-
- `PROG` - Programs
|
|
100
|
-
- `FUGR` - Function Groups
|
|
101
|
-
- `INTF` - Interfaces
|
|
102
|
-
- `TABL` - Tables
|
|
103
|
-
- `DDLS` - Data Definitions
|
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Each ABAP object requires an XML metadata file for abapGit to understand how to serialize/deserialize it. This guide provides templates for common object types.
|
|
4
4
|
|
|
5
|
+
## QUICK REFERENCE
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
File Type | ABAP File | XML File
|
|
9
|
+
-------------------|------------------------------|-------------------
|
|
10
|
+
Class | zcl_*.clas.abap | zcl_*.clas.xml
|
|
11
|
+
Test Class | zcl_*.clas.testclasses.abap | zcl_*.clas.xml
|
|
12
|
+
Interface | zif_*.intf.abap | zif_*.intf.xml
|
|
13
|
+
Program | z*.prog.abap | z*.prog.xml
|
|
14
|
+
Table | z*.tabl.abap | z*.tabl.xml
|
|
15
|
+
CDS View | zc_*.ddls.asddls | zc_*.ddls.xml
|
|
16
|
+
CDS Entity | ze_*.ddlx.asddlx | ze_*.ddlx.xml
|
|
17
|
+
Data Element | z*.dtel.abap | z*.dtel.xml
|
|
18
|
+
Structure | z*.stru.abap | z*.stru.xml
|
|
19
|
+
Table Type | z*.ttyp.abap | z*.ttyp.xml
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Key XML Settings:
|
|
24
|
+
Class EXPOSURE: 2=Public, 3=Protected, 4=Private
|
|
25
|
+
Class STATE: 1=Active
|
|
26
|
+
Table TABCLASS: TRANSP, POOL, CLUSTER
|
|
27
|
+
Table DELIVERY: A=Application, C=Customizing
|
|
28
|
+
CDS SOURCE_TYPE: V=View, C=Consumption
|
|
29
|
+
Test Class XML: <WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
|
|
30
|
+
Local Classes: <CLSCCINCL>X</CLSCCINCL>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Searchable keywords**: class xml, interface xml, table xml, cds xml, test class, exposure, serializer, abapgit
|
|
34
|
+
|
|
5
35
|
## Why XML Metadata?
|
|
6
36
|
|
|
7
37
|
abapGit needs XML files to:
|
|
@@ -40,6 +70,16 @@ abapGit needs XML files to:
|
|
|
40
70
|
- `STATE`: State (1 = Active)
|
|
41
71
|
- `UNICODE`: Unicode encoding (X = Yes)
|
|
42
72
|
|
|
73
|
+
**Local Classes**: If the class has local classes (e.g., test doubles), add:
|
|
74
|
+
- `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` - for test classes
|
|
75
|
+
- `<CLSCCINCL>X</CLSCCINCL>` - for local class definitions
|
|
76
|
+
|
|
77
|
+
**Local Class Files**:
|
|
78
|
+
| File | Purpose |
|
|
79
|
+
|------|---------|
|
|
80
|
+
| `zcl_xxx.clas.locals_def.abap` | Local class definitions |
|
|
81
|
+
| `zcl_xxx.clas.locals_imp.abap` | Local class implementations |
|
|
82
|
+
|
|
43
83
|
---
|
|
44
84
|
|
|
45
85
|
### Interface (INTF)
|