Skip to content

Commit 31504ae

Browse files
authored
Merge pull request #114 from abap2UI5/claude/focused-edison-a9KA1
Replace CASE abap_true pattern with IF/ELSEIF dispatcher
2 parents 393ffb0 + a14319e commit 31504ae

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

docs/advanced/agent.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,18 @@ CLASS zcl_my_app IMPLEMENTATION.
4747
ENDCLASS.
4848
```
4949

50-
#### 2. Dispatch with `CASE abap_true`
50+
#### 2. Dispatch with `IF` / `ELSEIF`
5151

52-
`main` is a dispatcher. Three lifecycle checks decide what to do:
52+
`main` is a dispatcher. Three lifecycle checks decide what to do — always chain them with `IF` / `ELSEIF`, never separate `IF` blocks:
5353

5454
```abap
55-
CASE abap_true.
56-
WHEN client->check_on_init( ). " first call
57-
" load data + render view
58-
WHEN client->check_on_event( `POST` ). " user fired event 'POST'
59-
" handle it
60-
WHEN client->check_on_navigated( ). " returned from sub-app / popup
61-
" refresh state
62-
ENDCASE.
55+
IF client->check_on_init( ). " first call
56+
" load data + render view
57+
ELSEIF client->check_on_event( `POST` ). " user fired event 'POST'
58+
" handle it
59+
ELSEIF client->check_on_navigated( ). " returned from sub-app / popup
60+
" refresh state
61+
ENDIF.
6362
```
6463

6564
[Life Cycle](/cookbook/event_navigation/life_cycle)
@@ -235,7 +234,7 @@ When an AI needs deeper information than this page provides:
235234
| Topic | Best reference |
236235
|---|---|
237236
| Architecture, request roundtrip | [Concept](/technical/concept), [How It All Works](/technical/how_it_all_works) |
238-
| Lifecycle and `CASE abap_true` pattern | [Cookbook → Life Cycle](/cookbook/event_navigation/life_cycle) |
237+
| Lifecycle and `IF` / `ELSEIF` dispatcher pattern | [Cookbook → Life Cycle](/cookbook/event_navigation/life_cycle) |
239238
| Building views, control choice | [Cookbook → View Definition](/cookbook/view/definition) |
240239
| Data binding (`_bind`, `_bind_edit`) | [Cookbook → Binding](/cookbook/model/binding) |
241240
| Tables and trees | [Cookbook → Tables](/cookbook/model/tables), [Trees](/cookbook/model/trees) |
@@ -260,7 +259,7 @@ A prompt that gives an AI assistant enough context to produce a working app:
260259
|---|---|
261260
| Implement `z2ui5_if_app` with a single `main` method | The only entry point the framework calls |
262261
| Bound attributes must be `PUBLIC` | The framework binds via dynamic ASSIGN; `PROTECTED`/`PRIVATE` are silently ignored |
263-
| Use `CASE abap_true` with `check_on_init` / `check_on_event( 'NAME' )` / `check_on_navigated` | Canonical dispatcher pattern |
262+
| Use `IF` / `ELSEIF` with `check_on_init` / `check_on_event( 'NAME' )` / `check_on_navigated` | Canonical dispatcher pattern |
264263
| Use `z2ui5_cl_util_xml` for AI-generated views | Maps 1:1 to UI5 SDK; no wrapper to learn |
265264
| Pass XML boolean attributes as string literals `'true'` / `'false'` | `abap_true` / `abap_false` produce invalid or empty attributes |
266265
| Use backtick string literals (`` ` ``), not single quotes | Project-wide convention enforced by abaplint |

0 commit comments

Comments
 (0)