Skip to content

Commit 05e36fe

Browse files
authored
Merge branch 'main' into claude/laughing-cori-mJTaz
2 parents 2baa93d + 452f4fb commit 05e36fe

2 files changed

Lines changed: 43 additions & 47 deletions

File tree

docs/get_started/about.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,3 @@ Contributions are always welcome. Whether you fix bugs, build features, or impro
118118
Volunteers maintain abap2UI5. If you or your company benefits from the project, please consider sponsoring it.
119119

120120
*Read more about [sponsorship opportunities](/resources/sponsor)*
121-
122-
### About This Documentation
123-
124-
This site explains the mental model, lifecycle, and recurring patterns of abap2UI5 — the *how* and *why* behind the framework. For the API surface (interfaces like `z2ui5_if_client`, helpers like `z2ui5_cl_xml_view`), read the source directly in the [main repository](https://github.com/abap2UI5/abap2UI5). For ready-to-copy code, browse the 250+ apps in the [samples repository](https://github.com/abap2UI5/samples). Treat this site as the index, not the catalog.

docs/get_started/hello_world.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,8 @@ outline: [2, 4]
33
---
44
# Hello World
55

6-
abap2UI5 follows a thin-frontend model: the browser only renders UI5 views, while all logic, state, and data handling stay in ABAP on the server. Three ideas to keep in mind before writing code:
7-
8-
- **One method, many calls.** The framework calls your app's `main` method on every roundtrip — on the initial start *and* after every user interaction (button press, input change, navigation).
9-
- **State lives in your class.** Public attributes of your app class hold data between roundtrips; abap2UI5 serializes and restores them for you, so you don't manage sessions manually.
10-
- **The `client` object is your only API.** Use it to display views, check which event fired, bind attributes to UI5 controls, and trigger navigation.
11-
12-
Every abap2UI5 app implements the `z2ui5_if_app` interface. It has a single method, `main`, with one parameter: `client` of type `z2ui5_if_client`:
13-
```abap
14-
INTERFACE z2ui5_if_app PUBLIC.
15-
METHODS main
16-
IMPORTING
17-
client TYPE REF TO z2ui5_if_client.
18-
ENDINTERFACE.
19-
```
20-
The `client` object is your only entry point into the framework. Use it to show views, handle events, share data, and navigate between apps.
21-
22-
*For a deeper look at the lifecycle and framework internals, see [How It All Works](/technical/how_it_all_works) and [Concept](/technical/concept).*
6+
Just copy the following class into your system:
237

24-
### Basic Example
25-
Build a class:
268
```abap
279
CLASS zcl_app_hello_world DEFINITION PUBLIC.
2810
PUBLIC SECTION.
@@ -31,9 +13,7 @@ ENDCLASS.
3113
3214
CLASS zcl_app_hello_world IMPLEMENTATION.
3315
METHOD z2ui5_if_app~main.
34-
3516
client->message_box_display( `Hello World` ).
36-
3717
ENDMETHOD.
3818
ENDCLASS.
3919
```
@@ -63,28 +43,28 @@ CLASS zcl_app_hello_world IMPLEMENTATION.
6343
ENDCLASS.
6444
```
6545

66-
### Event Handler
67-
The framework calls the `main` method on every roundtrip — on initialization and after every user interaction (button press, input submit, etc.):
46+
### Info
47+
abap2UI5 follows a thin-frontend model: the browser only renders UI5 views, while all logic, state, and data handling stay in ABAP on the server. Three ideas to keep in mind before writing code:
6848

69-
```text
70-
┌─────────┐ ┌──────────┐ ┌─────────┐
71-
│ Browser │──────>│ main() │──────>│ Browser │
72-
│ (Start) │ HTTP │ init │ HTTP │ (View) │
73-
└─────────┘ └──────────┘ └────┬─────┘
74-
│ user clicks
75-
┌─────────┐ ┌──────────┐ ┌────┴─────┐
76-
│ Browser │<──────│ main() │<──────│ Browser │
77-
│ (Update) │ HTTP │ event │ HTTP │ (Event) │
78-
└─────────┘ └──────────┘ └──────────┘
49+
- **One method, many calls.** The framework calls your app's `main` method on every roundtrip — on the initial start *and* after every user interaction (button press, input change, navigation).
50+
- **State lives in your class.** Public attributes of your app class hold data between roundtrips; abap2UI5 serializes and restores them for you, so you don't manage sessions manually.
51+
- **The `client` object is your only API.** Use it to display views, check which event fired, bind attributes to UI5 controls, and trigger navigation.
52+
53+
Every abap2UI5 app implements the `z2ui5_if_app` interface. It has a single method, `main`, with one parameter: `client` of type `z2ui5_if_client`:
54+
```abap
55+
INTERFACE z2ui5_if_app PUBLIC.
56+
METHODS main
57+
IMPORTING
58+
client TYPE REF TO z2ui5_if_client.
59+
ENDINTERFACE.
7960
```
61+
The `client` object is your only entry point into the framework. Use it to show views, handle events, share data, and navigate between apps.
8062

81-
To distinguish between lifecycle events, use `CASE abap_true`:
63+
*For a deeper look at the lifecycle and framework internals, see [How It All Works](/technical/how_it_all_works) and [Concept](/technical/concept).*
8264

83-
- `client->check_on_init( )` — first call when the app starts
84-
- `client->check_on_event( )` — user triggered an event (e.g., button press)
85-
- `client->check_on_navigated( )` — returned from another app via navigation
65+
### Events
8666

87-
Each `check_*` method returns `abap_true` only for its specific phase, so `CASE abap_true` acts as a dispatcher:
67+
Let's extend the code with some event handling:
8868
```abap
8969
CLASS zcl_app_hello_world DEFINITION PUBLIC.
9070
PUBLIC SECTION.
@@ -94,26 +74,46 @@ ENDCLASS.
9474
CLASS zcl_app_hello_world IMPLEMENTATION.
9575
METHOD z2ui5_if_app~main.
9676
97-
CASE abap_true.
98-
99-
WHEN client->check_on_init( ).
77+
IF client->check_on_init( ).
10078
10179
DATA(view) = z2ui5_cl_xml_view=>factory(
10280
)->page( `abap2UI5 - Hello World`
10381
)->text( `My Text`
10482
)->button( text = `post` press = client->_event( `POST` ) ).
10583
client->view_display( view->stringify( ) ).
10684
107-
WHEN client->check_on_event( `POST` ).
85+
ELSEIF client->check_on_event( `POST` ).
10886
10987
client->message_box_display( `Hello World!` ).
11088
111-
ENDCASE.
89+
ENDIF.
11290
11391
ENDMETHOD.
11492
ENDCLASS.
11593
```
11694

95+
### Info
96+
The framework calls the `main` method on every roundtrip — on initialization and after every user interaction (button press, input submit, etc.):
97+
98+
```text
99+
┌─────────┐ ┌──────────┐ ┌─────────┐
100+
│ Browser │──────>│ main() │──────>│ Browser │
101+
│ (Start) │ HTTP │ init │ HTTP │ (View) │
102+
└─────────┘ └──────────┘ └────┬─────┘
103+
│ user clicks
104+
┌─────────┐ ┌──────────┐ ┌────┴─────┐
105+
│ Browser │<──────│ main() │<──────│ Browser │
106+
│ (Update) │ HTTP │ event │ HTTP │ (Event) │
107+
└─────────┘ └──────────┘ └──────────┘
108+
```
109+
110+
To distinguish between lifecycle events, check for the following events:
111+
112+
- `client->check_on_init( )` — first call when the app starts
113+
- `client->check_on_event( )` — user triggered an event (e.g., button press)
114+
115+
Each `check_*` method returns `abap_true` only for its specific phase, so is acts as a dispatcher:
116+
117117
### Data Flow
118118
Finally, add a public attribute to send data to the backend:
119119
```abap

0 commit comments

Comments
 (0)