@linkup-ai/abap-ai 2.0.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.
Files changed (114) hide show
  1. package/README.md +384 -0
  2. package/dist/adt-client.js +364 -0
  3. package/dist/cli/activate.js +113 -0
  4. package/dist/cli/init.js +333 -0
  5. package/dist/cli/remove.js +80 -0
  6. package/dist/cli/status.js +229 -0
  7. package/dist/cli/systems.js +68 -0
  8. package/dist/cli.js +81 -0
  9. package/dist/index.js +1318 -0
  10. package/dist/knowledge/abap/abap-dictionary.md +199 -0
  11. package/dist/knowledge/abap/abap-sql.md +296 -0
  12. package/dist/knowledge/abap/amdp.md +273 -0
  13. package/dist/knowledge/abap/clean-code.md +293 -0
  14. package/dist/knowledge/abap/cloud-background-processing.md +250 -0
  15. package/dist/knowledge/abap/cloud-communication.md +265 -0
  16. package/dist/knowledge/abap/cloud-development.md +176 -0
  17. package/dist/knowledge/abap/cloud-extensibility.md +252 -0
  18. package/dist/knowledge/abap/cloud-released-apis.md +261 -0
  19. package/dist/knowledge/abap/constructor-expressions.md +289 -0
  20. package/dist/knowledge/abap/enhancements.md +232 -0
  21. package/dist/knowledge/abap/exceptions.md +271 -0
  22. package/dist/knowledge/abap/internal-tables.md +205 -0
  23. package/dist/knowledge/abap/object-orientation.md +298 -0
  24. package/dist/knowledge/abap/performance.md +216 -0
  25. package/dist/knowledge/abap/rap-abstract-entities.md +206 -0
  26. package/dist/knowledge/abap/rap-business-events.md +216 -0
  27. package/dist/knowledge/abap/rap-draft.md +191 -0
  28. package/dist/knowledge/abap/rap-eml.md +453 -0
  29. package/dist/knowledge/abap/rap-end-to-end.md +486 -0
  30. package/dist/knowledge/abap/rap-feature-control.md +185 -0
  31. package/dist/knowledge/abap/rap-numbering.md +280 -0
  32. package/dist/knowledge/abap/rap-service-exposure.md +163 -0
  33. package/dist/knowledge/abap/rap-unmanaged.md +468 -0
  34. package/dist/knowledge/abap/string-processing.md +180 -0
  35. package/dist/knowledge/abap/unit-testing.md +303 -0
  36. package/dist/knowledge/abap-cds/access-control.md +241 -0
  37. package/dist/knowledge/abap-cds/annotations.md +331 -0
  38. package/dist/knowledge/abap-cds/associations.md +254 -0
  39. package/dist/knowledge/abap-cds/expressions.md +230 -0
  40. package/dist/knowledge/abap-cds/functions.md +245 -0
  41. package/dist/knowledge/abap-cds/metadata-extensions.md +294 -0
  42. package/dist/knowledge/cap/authentication.md +278 -0
  43. package/dist/knowledge/cap/cdl-syntax.md +247 -0
  44. package/dist/knowledge/cap/cql-queries.md +266 -0
  45. package/dist/knowledge/cap/deployment.md +343 -0
  46. package/dist/knowledge/cap/event-handlers.md +287 -0
  47. package/dist/knowledge/cap/fiori-integration.md +303 -0
  48. package/dist/knowledge/cap/service-definitions.md +287 -0
  49. package/dist/knowledge/fiori/annotations.md +347 -0
  50. package/dist/knowledge/fiori/deployment.md +340 -0
  51. package/dist/knowledge/fiori/fiori-elements.md +332 -0
  52. package/dist/knowledge/fiori/fiori-side-effects.md +107 -0
  53. package/dist/knowledge/fiori/fiori-valuelist.md +144 -0
  54. package/dist/knowledge/fiori/ui5-controllers.md +358 -0
  55. package/dist/knowledge/fiori/ui5-data-binding.md +311 -0
  56. package/dist/knowledge/fiori/ui5-fragments-dialogs.md +330 -0
  57. package/dist/knowledge/fiori/ui5-manifest.md +411 -0
  58. package/dist/knowledge/fiori/ui5-routing.md +303 -0
  59. package/dist/knowledge/fiori/ui5-xml-views.md +294 -0
  60. package/dist/logger.js +114 -0
  61. package/dist/system-profile.js +207 -0
  62. package/dist/tools/abap-doc.js +72 -0
  63. package/dist/tools/abapgit.js +161 -0
  64. package/dist/tools/activate.js +68 -0
  65. package/dist/tools/atc-check.js +117 -0
  66. package/dist/tools/auth-object.js +56 -0
  67. package/dist/tools/breakpoints.js +76 -0
  68. package/dist/tools/call-hierarchy.js +84 -0
  69. package/dist/tools/cds-annotations.js +98 -0
  70. package/dist/tools/cds-dependencies.js +65 -0
  71. package/dist/tools/check.js +47 -0
  72. package/dist/tools/code-completion.js +70 -0
  73. package/dist/tools/code-coverage.js +111 -0
  74. package/dist/tools/create-amdp.js +111 -0
  75. package/dist/tools/create-dcl.js +81 -0
  76. package/dist/tools/create-transport.js +38 -0
  77. package/dist/tools/create.js +285 -0
  78. package/dist/tools/data-preview.js +37 -0
  79. package/dist/tools/delete.js +45 -0
  80. package/dist/tools/deploy-bsp.js +298 -0
  81. package/dist/tools/discovery.js +59 -0
  82. package/dist/tools/element-info.js +93 -0
  83. package/dist/tools/enhancements.js +186 -0
  84. package/dist/tools/extract-method.js +44 -0
  85. package/dist/tools/function-group.js +59 -0
  86. package/dist/tools/knowledge.js +275 -0
  87. package/dist/tools/lock-object.js +75 -0
  88. package/dist/tools/message-class.js +67 -0
  89. package/dist/tools/navigate.js +80 -0
  90. package/dist/tools/number-range.js +57 -0
  91. package/dist/tools/object-documentation.js +43 -0
  92. package/dist/tools/object-structure.js +78 -0
  93. package/dist/tools/object-versions.js +57 -0
  94. package/dist/tools/package-contents.js +60 -0
  95. package/dist/tools/pretty-printer.js +35 -0
  96. package/dist/tools/publish-binding.js +49 -0
  97. package/dist/tools/quick-fix.js +69 -0
  98. package/dist/tools/read.js +167 -0
  99. package/dist/tools/refactor-rename.js +60 -0
  100. package/dist/tools/release-transport.js +24 -0
  101. package/dist/tools/released-apis.js +51 -0
  102. package/dist/tools/repository-tree.js +90 -0
  103. package/dist/tools/scaffold-rap.js +642 -0
  104. package/dist/tools/search.js +73 -0
  105. package/dist/tools/shared/data-format.js +101 -0
  106. package/dist/tools/sql-console.js +17 -0
  107. package/dist/tools/system-info.js +270 -0
  108. package/dist/tools/traces.js +66 -0
  109. package/dist/tools/transport-contents.js +83 -0
  110. package/dist/tools/transports.js +67 -0
  111. package/dist/tools/unit-test.js +135 -0
  112. package/dist/tools/where-used.js +59 -0
  113. package/dist/tools/write.js +101 -0
  114. package/package.json +49 -0
@@ -0,0 +1,332 @@
1
+ # Fiori Elements — Annotation-Driven UI Templates
2
+
3
+ ## List Report — Table + Filter Bar
4
+
5
+ ```xml
6
+ <Annotations Target="Service.Products">
7
+ <!-- Filter bar fields -->
8
+ <Annotation Term="UI.SelectionFields">
9
+ <Collection>
10
+ <PropertyPath>Category</PropertyPath>
11
+ <PropertyPath>Price</PropertyPath>
12
+ <PropertyPath>Status</PropertyPath>
13
+ </Collection>
14
+ </Annotation>
15
+
16
+ <!-- Table columns -->
17
+ <Annotation Term="UI.LineItem">
18
+ <Collection>
19
+ <Record Type="UI.DataField">
20
+ <PropertyValue Property="Value" PropertyPath="ProductID"/>
21
+ </Record>
22
+ <Record Type="UI.DataField">
23
+ <PropertyValue Property="Value" PropertyPath="Name"/>
24
+ <PropertyValue Property="Label" String="Product Name"/>
25
+ </Record>
26
+ <Record Type="UI.DataField">
27
+ <PropertyValue Property="Value" PropertyPath="Price"/>
28
+ </Record>
29
+ <Record Type="UI.DataFieldForAnnotation">
30
+ <PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#Rating"/>
31
+ <PropertyValue Property="Label" String="Rating"/>
32
+ </Record>
33
+ <!-- Action button in table -->
34
+ <Record Type="UI.DataFieldForAction">
35
+ <PropertyValue Property="Label" String="Approve"/>
36
+ <PropertyValue Property="Action" String="Service.ApproveOrder"/>
37
+ <PropertyValue Property="InvocationGrouping"
38
+ EnumMember="UI.OperationGroupingType/Isolated"/>
39
+ </Record>
40
+ </Collection>
41
+ </Annotation>
42
+ </Annotations>
43
+ ```
44
+
45
+ ```json
46
+ // manifest.json — List Report target
47
+ {
48
+ "sap.ui5": {
49
+ "routing": {
50
+ "targets": {
51
+ "ProductsList": {
52
+ "type": "Component",
53
+ "id": "ProductsList",
54
+ "name": "sap.fe.templates.ListReport",
55
+ "options": {
56
+ "settings": {
57
+ "contextPath": "/Products",
58
+ "variantManagement": "Page",
59
+ "initialLoad": true,
60
+ "navigation": {
61
+ "Products": {
62
+ "detail": { "route": "ProductDetail" }
63
+ }
64
+ },
65
+ "tableSettings": {
66
+ "type": "ResponsiveTable",
67
+ "selectAll": true,
68
+ "selectionMode": "Multi"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## Object Page — Header + Sections + Facets
80
+
81
+ ```xml
82
+ <Annotations Target="Service.Product">
83
+ <Annotation Term="UI.HeaderInfo">
84
+ <Record>
85
+ <PropertyValue Property="TypeName" String="Product"/>
86
+ <PropertyValue Property="TypeNamePlural" String="Products"/>
87
+ <PropertyValue Property="Title">
88
+ <Record Type="UI.DataField">
89
+ <PropertyValue Property="Value" PropertyPath="Name"/>
90
+ </Record>
91
+ </PropertyValue>
92
+ <PropertyValue Property="Description">
93
+ <Record Type="UI.DataField">
94
+ <PropertyValue Property="Value" PropertyPath="Description"/>
95
+ </Record>
96
+ </PropertyValue>
97
+ </Record>
98
+ </Annotation>
99
+
100
+ <Annotation Term="UI.HeaderFacets">
101
+ <Collection>
102
+ <Record Type="UI.ReferenceFacet">
103
+ <PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#Price"/>
104
+ </Record>
105
+ <Record Type="UI.ReferenceFacet">
106
+ <PropertyValue Property="Target" AnnotationPath="@UI.DataPoint#Stock"/>
107
+ </Record>
108
+ </Collection>
109
+ </Annotation>
110
+
111
+ <Annotation Term="UI.Facets">
112
+ <Collection>
113
+ <Record Type="UI.CollectionFacet">
114
+ <PropertyValue Property="Label" String="General Information"/>
115
+ <PropertyValue Property="ID" String="GeneralInfo"/>
116
+ <PropertyValue Property="Facets">
117
+ <Collection>
118
+ <Record Type="UI.ReferenceFacet">
119
+ <PropertyValue Property="Target"
120
+ AnnotationPath="@UI.FieldGroup#General"/>
121
+ </Record>
122
+ </Collection>
123
+ </PropertyValue>
124
+ </Record>
125
+ <Record Type="UI.ReferenceFacet">
126
+ <PropertyValue Property="Label" String="Sales Orders"/>
127
+ <PropertyValue Property="Target"
128
+ AnnotationPath="SalesOrders/@UI.LineItem"/>
129
+ </Record>
130
+ </Collection>
131
+ </Annotation>
132
+
133
+ <Annotation Term="UI.FieldGroup" Qualifier="General">
134
+ <Record>
135
+ <PropertyValue Property="Data">
136
+ <Collection>
137
+ <Record Type="UI.DataField">
138
+ <PropertyValue Property="Value" PropertyPath="ProductID"/>
139
+ </Record>
140
+ <Record Type="UI.DataField">
141
+ <PropertyValue Property="Value" PropertyPath="Category"/>
142
+ </Record>
143
+ <Record Type="UI.DataField">
144
+ <PropertyValue Property="Value" PropertyPath="Price"/>
145
+ </Record>
146
+ </Collection>
147
+ </PropertyValue>
148
+ </Record>
149
+ </Annotation>
150
+ </Annotations>
151
+ ```
152
+
153
+ ```json
154
+ // manifest.json — Object Page target
155
+ {
156
+ "ProductDetail": {
157
+ "type": "Component",
158
+ "id": "ProductDetail",
159
+ "name": "sap.fe.templates.ObjectPage",
160
+ "options": {
161
+ "settings": {
162
+ "contextPath": "/Products",
163
+ "editableHeaderContent": true,
164
+ "showRelatedApps": true
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ ## Analytical List Page — Charts + Visual Filters
172
+
173
+ ```xml
174
+ <Annotations Target="Service.SalesData">
175
+ <Annotation Term="UI.Chart">
176
+ <Record>
177
+ <PropertyValue Property="Title" String="Sales by Region"/>
178
+ <PropertyValue Property="ChartType" EnumMember="UI.ChartType/Column"/>
179
+ <PropertyValue Property="Dimensions">
180
+ <Collection><PropertyPath>Region</PropertyPath></Collection>
181
+ </PropertyValue>
182
+ <PropertyValue Property="Measures">
183
+ <Collection><PropertyPath>Sales</PropertyPath></Collection>
184
+ </PropertyValue>
185
+ </Record>
186
+ </Annotation>
187
+
188
+ <Annotation Term="UI.PresentationVariant">
189
+ <Record>
190
+ <PropertyValue Property="Visualizations">
191
+ <Collection>
192
+ <AnnotationPath>@UI.Chart</AnnotationPath>
193
+ <AnnotationPath>@UI.LineItem</AnnotationPath>
194
+ </Collection>
195
+ </PropertyValue>
196
+ <PropertyValue Property="SortOrder">
197
+ <Collection>
198
+ <Record Type="Common.SortOrderType">
199
+ <PropertyValue Property="Property" PropertyPath="Sales"/>
200
+ <PropertyValue Property="Descending" Bool="true"/>
201
+ </Record>
202
+ </Collection>
203
+ </PropertyValue>
204
+ </Record>
205
+ </Annotation>
206
+ </Annotations>
207
+ ```
208
+
209
+ ## Draft Handling
210
+
211
+ ```xml
212
+ <Annotations Target="Service.SalesOrder">
213
+ <Annotation Term="Common.DraftRoot">
214
+ <Record>
215
+ <PropertyValue Property="ActivationAction" String="Service.draftActivate"/>
216
+ <PropertyValue Property="EditAction" String="Service.draftEdit"/>
217
+ <PropertyValue Property="PreparationAction" String="Service.draftPrepare"/>
218
+ </Record>
219
+ </Annotation>
220
+ </Annotations>
221
+ ```
222
+
223
+ Required entity properties: `IsActiveEntity`, `HasActiveEntity`, `HasDraftEntity` (all `Edm.Boolean`).
224
+
225
+ ## Determining Actions — Object Page Footer
226
+
227
+ ```xml
228
+ <Annotation Term="UI.Identification">
229
+ <Collection>
230
+ <Record Type="UI.DataFieldForAction">
231
+ <PropertyValue Property="Label" String="Approve"/>
232
+ <PropertyValue Property="Action" String="Service.ApproveOrder"/>
233
+ <PropertyValue Property="Determining" Bool="true"/>
234
+ </Record>
235
+ </Collection>
236
+ </Annotation>
237
+ ```
238
+
239
+ ## Flexible Column Layout
240
+
241
+ ```json
242
+ {
243
+ "sap.ui5": {
244
+ "routing": {
245
+ "config": {
246
+ "routerClass": "sap.f.routing.Router",
247
+ "flexibleColumnLayout": {
248
+ "defaultTwoColumnLayoutType": "TwoColumnsMidExpanded",
249
+ "defaultThreeColumnLayoutType": "ThreeColumnsMidExpanded"
250
+ }
251
+ },
252
+ "routes": [
253
+ { "pattern": ":?query:", "name": "List", "target": ["List"] },
254
+ { "pattern": "Items({key}):?query:", "name": "Detail",
255
+ "target": ["List", "Detail"] },
256
+ { "pattern": "Items({key})/Sub({subKey}):?query:", "name": "SubDetail",
257
+ "target": ["List", "Detail", "SubDetail"] }
258
+ ]
259
+ }
260
+ }
261
+ }
262
+ ```
263
+
264
+ ## Building Blocks — Reusable Macros
265
+
266
+ ```xml
267
+ <macros:Table id="tbl" contextPath="/Products"
268
+ metaPath="@com.sap.vocabularies.UI.v1.LineItem" readOnly="true"/>
269
+
270
+ <macros:FilterBar id="fb" contextPath="/Products"
271
+ metaPath="@com.sap.vocabularies.UI.v1.SelectionFields"/>
272
+
273
+ <macros:Form id="frm" contextPath="/Products"
274
+ metaPath="@com.sap.vocabularies.UI.v1.FieldGroup#General"/>
275
+ ```
276
+
277
+ Available: `Table`, `Chart`, `FilterBar`, `Form`, `Field`, `MicroChart`, `ValueHelp`.
278
+
279
+ ## CDS Annotation Syntax (CAP)
280
+
281
+ ```cds
282
+ annotate CatalogService.Products with @(
283
+ UI: {
284
+ HeaderInfo: {
285
+ TypeName: 'Product',
286
+ TypeNamePlural: 'Products',
287
+ Title: { Value: name }
288
+ },
289
+ SelectionFields: [ category, price, status ],
290
+ LineItem: [
291
+ { Value: ID },
292
+ { Value: name },
293
+ { Value: price }
294
+ ],
295
+ Facets: [
296
+ { $Type: 'UI.ReferenceFacet', Target: '@UI.FieldGroup#General', Label: 'General' }
297
+ ],
298
+ FieldGroup#General: {
299
+ Data: [
300
+ { Value: ID },
301
+ { Value: category },
302
+ { Value: price }
303
+ ]
304
+ }
305
+ }
306
+ );
307
+ ```
308
+
309
+ ## Rules
310
+
311
+ - Always define `UI.HeaderInfo` with `TypeName` + `TypeNamePlural` on Object Page entities
312
+ - Use `UI.CollectionFacet` to group multiple `ReferenceFacet` under one section
313
+ - Set `variantManagement: "Page"` for List Report variant persistence
314
+ - Use `contextPath` (not `entitySet`) in manifest.json for V4-based Fiori Elements
315
+ - Add `:?query:` to route patterns to preserve filter/variant state in URL
316
+ - Set `initialLoad: true` only when data should load without user pressing Go
317
+ - Use `UI.DataFieldForAction` inside `UI.LineItem` for table-row actions
318
+ - Use `UI.DataFieldForAction` with `Determining: true` inside `UI.Identification` for footer actions
319
+ - Navigation associations in `UI.Facets` use path syntax: `NavProperty/@UI.LineItem`
320
+
321
+ ## Anti-Patterns
322
+
323
+ | Anti-Pattern | Correct Approach |
324
+ |---|---|
325
+ | Writing custom JS controllers for standard CRUD | Use annotations + draft handling |
326
+ | Hardcoding column labels in XML annotations | Use `@Common.Label` on entity properties or i18n |
327
+ | Using `entitySet` in manifest instead of `contextPath` | Use `contextPath` for OData V4 |
328
+ | Mixing freestyle UI5 views with Fiori Elements | Use extension points or building blocks |
329
+ | Omitting `TypeNamePlural` in `HeaderInfo` | Always set both `TypeName` and `TypeNamePlural` |
330
+ | Defining sections without `ID` property | Always set `ID` on `CollectionFacet` for stable anchors |
331
+ | Using `OneColumn` layout for master-detail | Use `TwoColumnsMidExpanded` |
332
+ | Skipping `PresentationVariant` on Analytical List Page | Required for chart+table visualization binding |
@@ -0,0 +1,107 @@
1
+ # Fiori Side Effects — refresh automatico de campos e validacao inline
2
+
3
+ Declarar no BDEF da interface (ZI_*), NAO na projection.
4
+
5
+ ## Sintaxe
6
+
7
+ ```abap
8
+ define behavior for ZI_Order alias Order
9
+ {
10
+ side effects
11
+ {
12
+ " campo afeta campo
13
+ field Quantity affects field TotalPrice;
14
+
15
+ " campo afeta multiplos campos
16
+ field Discount affects field TotalPrice, field NetPrice;
17
+
18
+ " multiplos campos trigam mesmo efeito
19
+ field Quantity, field UnitPrice affects field TotalPrice;
20
+
21
+ " campo afeta entity inteira (recarrega tudo)
22
+ field CurrencyCode affects entity Order;
23
+
24
+ " campo afeta filhos (recarrega association)
25
+ field OrderType affects entity _Item;
26
+
27
+ " validacao inline ao sair do campo
28
+ determine action Prepare executed on field CustomerID, field BeginDate;
29
+
30
+ " acao afeta entity
31
+ action acceptOrder affects entity Order;
32
+
33
+ " campo afeta feature control de acoes
34
+ field Status affects action acceptOrder, action rejectOrder;
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## Patterns
40
+
41
+ ### Campo calculado
42
+ ```abap
43
+ " BDEF:
44
+ determination calculateTotal on modify { field Quantity, UnitPrice; }
45
+ side effects { field Quantity, field UnitPrice affects field TotalPrice; }
46
+ ```
47
+ Side effect recarrega o campo. Determination faz o calculo. Ambos necessarios.
48
+
49
+ ### Validacao em tempo real
50
+ ```abap
51
+ " BDEF:
52
+ draft determine action Prepare { validation validateDates; validation validateCustomer; }
53
+ side effects { determine action Prepare executed on field BeginDate, field EndDate, field CustomerID; }
54
+ ```
55
+ Ao sair do campo, Fiori chama Prepare → backend roda validacoes → mostra erro inline.
56
+
57
+ ### Filho afeta pai
58
+ ```abap
59
+ " No BDEF do filho (ZI_OrderItem):
60
+ side effects { field Quantity, field ItemPrice affects entity _Order; }
61
+ ```
62
+ Mudanca no item recarrega entidade pai (ex: recalcula total do pedido).
63
+
64
+ ### Pai afeta filhos
65
+ ```abap
66
+ " No BDEF do pai (ZI_Order):
67
+ side effects { field CurrencyCode affects entity _Item; }
68
+ ```
69
+
70
+ ### Feature control dinamico
71
+ ```abap
72
+ side effects {
73
+ field OverallStatus affects action acceptTravel, action rejectTravel;
74
+ }
75
+ ```
76
+ Apos mudar Status, Fiori recalcula `get_instance_features` → habilita/desabilita botoes.
77
+
78
+ ## Tipos de efeito
79
+
80
+ | Sintaxe | Recarrega |
81
+ |---------|-----------|
82
+ | `affects field X` | So o campo X (melhor performance) |
83
+ | `affects field X, field Y` | Campos X e Y |
84
+ | `affects entity Order` | Todos os campos da entidade |
85
+ | `affects entity _Item` | Todos os filhos da association |
86
+ | `affects action X` | Feature control da acao X |
87
+ | `determine action Prepare executed on field X` | Executa validacoes do Prepare ao sair do campo |
88
+
89
+ ## Performance
90
+
91
+ - Preferir `affects field` sobre `affects entity`
92
+ - `determine action Prepare executed on field` gera roundtrip por campo — usar com moderacao
93
+ - Agrupar: `field A, field B, field C affects field Total`
94
+
95
+ ## Regras
96
+ - Declarar no BDEF da interface (ZI_*), nunca na projection
97
+ - Side effect sem determination correspondente nao faz nada (recarrega dados inalterados)
98
+ - `determine action Prepare` requer que Prepare liste as validacoes
99
+ - `use action Prepare` obrigatorio na projection BDEF
100
+
101
+ ## Anti-patterns
102
+ | Errado | Correto |
103
+ |--------|---------|
104
+ | Side effects na projection BDEF | Na interface BDEF |
105
+ | `affects entity` para tudo | `affects field` quando possivel |
106
+ | Prepare em todos os campos | So nos que precisam de validacao inline |
107
+ | Side effect sem determination | Recarrega dado inalterado — sem efeito visivel |
@@ -0,0 +1,144 @@
1
+ # Fiori Value Help — @Consumption.valueHelpDefinition
2
+
3
+ ## Basico
4
+
5
+ ```abap
6
+ @Consumption.valueHelpDefinition: [{
7
+ entity: { name: '/DMO/I_Agency', element: 'AgencyID' }
8
+ }]
9
+ AgencyID;
10
+ ```
11
+
12
+ A entidade DEVE estar exposta no Service Definition.
13
+
14
+ ## Com filtros dependentes (additionalBinding)
15
+
16
+ ```abap
17
+ @Consumption.valueHelpDefinition: [{
18
+ entity: { name: '/DMO/I_Connection', element: 'ConnectionID' },
19
+ additionalBinding: [
20
+ { localElement: 'CarrierID', element: 'AirlineID', usage: #FILTER_AND_RESULT }
21
+ ]
22
+ }]
23
+ ConnectionID;
24
+ ```
25
+
26
+ | usage | Comportamento |
27
+ |-------|---------------|
28
+ | `#FILTER` | Filtra opcoes mas NAO preenche campo |
29
+ | `#RESULT` | Preenche campo mas NAO filtra |
30
+ | `#FILTER_AND_RESULT` | Filtra + preenche. O mais usado |
31
+
32
+ ## Cascata de value helps
33
+
34
+ ```abap
35
+ " 1. Carrier — sem dependencia
36
+ @Consumption.valueHelpDefinition: [{
37
+ entity: { name: '/DMO/I_Carrier', element: 'AirlineID' }
38
+ }]
39
+ CarrierID;
40
+
41
+ " 2. Connection — depende do carrier
42
+ @Consumption.valueHelpDefinition: [{
43
+ entity: { name: '/DMO/I_Connection', element: 'ConnectionID' },
44
+ additionalBinding: [
45
+ { localElement: 'CarrierID', element: 'AirlineID', usage: #FILTER_AND_RESULT }
46
+ ]
47
+ }]
48
+ ConnectionID;
49
+
50
+ " 3. Flight — depende do carrier + connection
51
+ @Consumption.valueHelpDefinition: [{
52
+ entity: { name: '/DMO/I_Flight', element: 'FlightDate' },
53
+ additionalBinding: [
54
+ { localElement: 'CarrierID', element: 'AirlineID', usage: #FILTER_AND_RESULT },
55
+ { localElement: 'ConnectionID', element: 'ConnectionID', usage: #FILTER_AND_RESULT }
56
+ ]
57
+ }]
58
+ FlightDate;
59
+ ```
60
+
61
+ ## Com texto (descricao)
62
+
63
+ ```abap
64
+ @ObjectModel.text.element: ['AgencyName']
65
+ @Consumption.valueHelpDefinition: [{
66
+ entity: { name: '/DMO/I_Agency', element: 'AgencyID' }
67
+ }]
68
+ AgencyID;
69
+
70
+ @UI.textArrangement: #TEXT_FIRST
71
+ _Agency.Name as AgencyName;
72
+ ```
73
+
74
+ | textArrangement | Exibicao |
75
+ |-----------------|----------|
76
+ | `#TEXT_FIRST` | "ACME Travel (001)" |
77
+ | `#TEXT_LAST` | "001 (ACME Travel)" |
78
+ | `#TEXT_ONLY` | "ACME Travel" |
79
+ | `#TEXT_SEPARATE` | Colunas separadas |
80
+
81
+ Alternativa via association:
82
+ ```abap
83
+ @ObjectModel.text.association: '_AgencyText'
84
+ AgencyID;
85
+ ```
86
+
87
+ ## Com validacao frontend
88
+
89
+ ```abap
90
+ @Consumption.valueHelpDefinition: [{
91
+ entity: { name: '/DMO/I_Customer', element: 'CustomerID' },
92
+ useForValidation: true
93
+ }]
94
+ CustomerID;
95
+ ```
96
+
97
+ Valida no frontend se valor existe (evita roundtrip).
98
+
99
+ ## Multiplos value helps (qualifier)
100
+
101
+ ```abap
102
+ @Consumption.valueHelpDefinition: [
103
+ { entity: { name: 'ZI_CustomerByID', element: 'CustomerID' },
104
+ qualifier: 'ByID', label: 'By ID' },
105
+ { entity: { name: 'ZI_CustomerByName', element: 'CustomerID' },
106
+ qualifier: 'ByName', label: 'By Name',
107
+ additionalBinding: [
108
+ { localElement: 'CustomerName', element: 'Name', usage: #RESULT }
109
+ ] }
110
+ ]
111
+ CustomerID;
112
+ ```
113
+
114
+ Aparece dropdown com opcoes "By ID" e "By Name" no Fiori.
115
+
116
+ ## Service Definition — expor entidades
117
+
118
+ ```abap
119
+ define service ZUI_ORDER {
120
+ expose ZC_Order as Order;
121
+ expose ZC_OrderItem as OrderItem;
122
+ expose /DMO/I_Agency as Agency; " OBRIGATORIO para value help funcionar
123
+ expose /DMO/I_Customer as Customer;
124
+ expose /DMO/I_Carrier as Carrier;
125
+ expose /DMO/I_Connection as Connection;
126
+ expose /DMO/I_Flight as Flight;
127
+ expose I_Currency as Currency;
128
+ }
129
+ ```
130
+
131
+ ## Regras
132
+ - `@Consumption.valueHelpDefinition` na projection CDS (ZC_*), nao na interface (ZI_*)
133
+ - Entidade de value help DEVE estar no Service Definition
134
+ - `#FILTER_AND_RESULT` e o usage padrao para filtros dependentes
135
+ - `@ObjectModel.text.element` para exibir descricao junto com codigo
136
+ - `useForValidation: true` para validacao frontend
137
+
138
+ ## Anti-patterns
139
+ | Errado | Correto |
140
+ |--------|---------|
141
+ | Value help na interface (ZI_*) | Na projection (ZC_*) |
142
+ | Entidade nao exposta no Service Definition | Value help nao aparece (sem erro) |
143
+ | `#FILTER` quando quer preencher | `#FILTER_AND_RESULT` |
144
+ | Sem `@ObjectModel.text.element` | Campo mostra so codigo sem descricao |