You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration/launchpad.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,16 @@ Use these parameters for target mapping in your Launchpad configuration:
16
16
- ID: `z2ui5`
17
17
- Parameter: `app_start / Z2UI5_CL_MY_APP`
18
18
19
+
### Cross App Navigation
20
+
We recommend backend communication only for view changes or popup calls. With a Launchpad, consider navigating via the Launchpad to use browser navigation and history:
`client->check_on_event` returns `abap_true` when the request was triggered by a user event. Read the event name with `client->get( )-event` and dispatch to the matching handler.
7
+
8
+
```abap
9
+
METHOD z2ui5_if_app~main.
10
+
11
+
me->client = client.
12
+
CASE abap_true.
13
+
WHEN client->check_on_event( ).
14
+
on_event( ).
15
+
ENDCASE.
16
+
17
+
ENDMETHOD.
18
+
19
+
METHOD on_event.
20
+
21
+
DATA(lt_arg) = client->get_event_arg( ).
22
+
23
+
CASE client->get( )-event.
24
+
WHEN `BUTTON_POST`.
25
+
client->message_toast_display( |{ mv_value } - send to the server| ).
abap2UI5 gives you great flexibility in how you structure apps. Most sample apps follow the pattern below. Use it as a starting point, and tweak it or build a wrapper around abap2UI5 for more specific behavior.
7
7
8
-
The idea: every request enters the `main` method, and you use `CASE` to dispatch between initialization, navigation returns, and user events.
8
+
The idea: every request enters the `main` method, and you use `CASE` to dispatch between initialization, navigation returns, and user events. The recommended pattern uses `CASE abap_true` together with `client->check_on_init`, `client->check_on_event`, and `client->check_on_navigated` to dispatch to the matching handler method.
9
9
10
10
```abap
11
11
CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC.
@@ -45,45 +45,7 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.
45
45
46
46
ENDMETHOD.
47
47
48
-
METHOD on_init.
49
-
50
-
mv_value = `value`.
51
-
52
-
ENDMETHOD.
53
-
54
-
METHOD display_view.
55
-
56
-
DATA(view) = z2ui5_cl_xml_view=>factory( ).
57
-
view->shell( )->page(
58
-
)->simple_form( title = `Form Title` editable = abap_true
59
-
)->content( `form`
60
-
)->title( `Input`
61
-
)->label( `value`
62
-
)->input( client->_bind_edit( mv_value )
63
-
)->button(
64
-
text = `post`
65
-
press = client->_event( `BUTTON_POST` ) ).
66
-
client->view_display( view->stringify( ) ).
67
-
68
-
ENDMETHOD.
69
-
70
-
METHOD on_event.
71
-
72
-
DATA(lt_arg) = client->get_event_arg( ).
73
-
74
-
CASE client->get( )-event.
75
-
WHEN `BUTTON_POST`.
76
-
client->message_toast_display( |{ mv_value } - send to the server| ).
77
-
ENDCASE.
78
-
79
-
ENDMETHOD.
80
-
81
-
METHOD on_navigated.
82
-
83
-
DATA(lo_app_prev) = client->get_app_prev( ).
84
-
85
-
ENDMETHOD.
86
-
87
48
ENDCLASS.
88
49
```
50
+
89
51
See the dedicated sections of this development guide for full details on views, events, data binding, and navigation.
`client->check_on_navigated` returns `abap_true` when the user returns from another app. Use `client->get_app_prev` to access the previous app instance and read any data it returns.
0 commit comments