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/advanced/extensibility/custom_js.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,14 @@ If the standard UI5 framework functionalities do not fulfill all your requiremen
7
7
8
8
The idea is to send the custom JavaScript function along with the view to the frontend and invoke it later when an event is triggered.
9
9
10
-
Below is a working example that you can use as a starting point:
10
+
Below is a working example that you can use as a starting point. The `_generic` method creates an arbitrary XML/HTML element — here an HTML `<script>` tag (namespace `html`). The `_cc_plain_xml` method injects raw content into that element, in this case the JavaScript function definition. On the backend side, `client->follow_up_action` then executes the function by name on the frontend:
Copy file name to clipboardExpand all lines: docs/advanced/extensibility/user_exits.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,11 @@
2
2
3
3
abap2UI5 contains predefined user exits which can be used to modify the standard behavior. The user exits are exposed by the interface [`Z2UI5_IF_EXIT`](https://github.com/abap2UI5/abap2UI5/blob/main/src/02/z2ui5_if_exit.intf.abap). To use them in your system you have to create a new class which implements the interface and its methods. They're called dynamically by abap2UI5 class [`Z2UI5_CL_EXIT`](https://github.com/abap2UI5/abap2UI5/blob/main/src/02/z2ui5_cl_exit.clas.abap). You should **not** include your class into abap2UI5 packages but in any other custom package.
4
4
5
-
The following example changes the title, theme and the time drafts are saved in the backend:
5
+
The interface provides two exit methods:
6
+
***`set_config_http_get`** — called during the initial HTTP GET request (page load). Use it to customize frontend settings like the page title, UI5 theme, or UI5 version.
7
+
***`set_config_http_post`** — called on every subsequent HTTP POST request (each roundtrip). Use it to configure backend behavior like the draft expiration time.
8
+
9
+
Both methods receive a `cs_config` changing parameter whose fields you can set as needed. The following example changes the title, theme and the time drafts are saved in the backend:
Copy file name to clipboardExpand all lines: docs/advanced/fiori.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,8 @@ sap.ui.core.Component.create({
65
65
```
66
66
67
67
5. Create abap2UI5 app class
68
+
69
+
On the ABAP side, the app receives the Fiori startup parameters (such as the app class name and any custom key-value pairs) via `client->get( )-t_comp_params`. The `check_initialized` flag ensures the parameters are only read once on the first roundtrip. Setting `backgrounddesign = 'List'` gives the page a white background that blends in with the Fiori object page:
Copy file name to clipboardExpand all lines: docs/configuration/authorization.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ abap2UI5 offers flexible ways to manage authorization handling. It doesn't inclu
9
9
One of the easiest ways to manage access to different apps is by implementing checks within the HTTP handler. This approach lets you restrict access to individual apps based on the APP_START parameter, directly in the ICF service handler class.
10
10
11
11
##### Example: Restricting Access Based on URL Parameters
12
-
In this example, we use the ICF handler class to control which apps can be accessed based on the APP_START parameter in the HTTP request. If an unauthorized app is requested, access is denied.
12
+
In this example, we use the ICF handler class to control which apps can be accessed based on the APP_START parameter in the HTTP request. The `get_header_field( 'APP_START' )` method reads the URL query parameter that specifies which abap2UI5 app class to launch. If an unauthorized app is requested, access is denied.
13
13
```abap
14
14
CLASS z2ui5_cl_launchpad_handler DEFINITION PUBLIC.
15
15
@@ -36,7 +36,7 @@ CLASS z2ui5_cl_launchpad_handler IMPLEMENTATION.
36
36
ENDCLASS.
37
37
```
38
38
##### Example: Authorization Objects in Service Handlers
39
-
You can also use the SAP authorization objects:
39
+
You can also combine this with SAP authorization objects. The example below uses a custom authorization object `Z_APP_AUTH` with a field `APP` — you need to create this object in transaction `SU21` and assign it to the relevant roles in your system:
40
40
```abap
41
41
CLASS z2ui5_cl_launchpad_handler DEFINITION PUBLIC.
42
42
@@ -85,8 +85,8 @@ CLASS z2ui5_cl_app IMPLEMENTATION.
85
85
86
86
METHOD z2ui5_if_app~main.
87
87
" Perform an authorization check before launching the app

29
+

30
30
31
31
2. Recalculate index of distribution layer with report /UI5/APP_INDEX_CALCULATE (if tab isn't visible try switching to another tab, then it usually appears)

37
37
38
38
4. Clear browser caches and hard reload
39
39
@@ -59,7 +59,9 @@ Find more information in the blog article on [LinkedIn.](https://www.linkedin.co
59
59
<br>
60
60
61
61
#### Approach
62
-
(1/3) Use a single Interface:
62
+
The integration works in three steps: you implement a simple interface, the Launchpad calls a generic OData proxy service, and the proxy delegates to your ABAP class to calculate the KPI count.
63
+
64
+
(1/3) Implement the `z2ui5_if_lp_kpi` interface. The `count` method receives an optional `filter` string (from the OData `$filter` parameter) and returns the KPI value as an integer:
63
65
```abap
64
66
INTERFACE z2ui5_if_lp_kpi
65
67
PUBLIC.
@@ -72,7 +74,7 @@ INTERFACE z2ui5_if_lp_kpi
72
74
73
75
ENDINTERFACE.
74
76
```
75
-
(2/3) Which can be used on app level to return KPIs:
77
+
(2/3) Implement the interface in your app class alongside `z2ui5_if_app`. The `count` method contains your custom KPI calculation logic (e.g. counting open items from the database):
76
78
```abap
77
79
CLASS z2ui5_cl_lp_kpi_hello_world DEFINITION PUBLIC.
78
80
@@ -95,7 +97,7 @@ CLASS z2ui5_cl_lp_kpi_hello_world IMPLEMENTATION.
95
97
96
98
ENDCLASS.
97
99
```
98
-
(3/3) A generic OData service takes care of everything else (which just returns n dummy entries). Just maintain the KPI at the Launchpad with the following endpoint:
100
+
(3/3) A generic OData proxy service (`Z2UI5_PROXY_KPI_SRV`) handles the rest. It receives the `$filter` parameter containing your class name, instantiates the class, calls `count`, and returns that many dummy OData entries. The Launchpad displays the `$count` result as the tile KPI. Configure the tile with this endpoint:
Copy file name to clipboardExpand all lines: docs/configuration/performance.md
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,38 @@ Frontend logic is kept to a minimum: no business logic runs in the browser. Ever
10
10
11
11
abap2UI5 has been successfully tested with tables containing large numbers of entries and columns. So, you can confidently develop your app — performance shouldn't be a concern.
12
12
13
+
### view_display vs view_model_update
14
+
15
+
The most impactful optimization is choosing the right update method:
16
+
17
+
-**`client->view_display( )`** — sends a new XML view and model to the frontend. UI5 destroys the current view and creates a new one from scratch. Use this only on initialization or when the view structure changes.
18
+
-**`client->view_model_update( )`** — sends only updated model data. UI5 refreshes the existing view via data binding — only the changed controls are re-rendered. This preserves UI state (scroll position, focus, etc.) and is significantly faster.
19
+
20
+
```abap
21
+
METHOD z2ui5_if_app~main.
22
+
23
+
CASE abap_true.
24
+
25
+
WHEN client->check_on_init( ).
26
+
DATA(view) = z2ui5_cl_xml_view=>factory(
27
+
)->page( `My App`
28
+
)->text( client->_bind( mv_text )
29
+
)->button( text = `update` press = client->_event( `UPDATE` ) ).
30
+
client->view_display( view->stringify( ) ).
31
+
32
+
WHEN client->check_on_event( `UPDATE` ).
33
+
mv_text = `new value`.
34
+
client->view_model_update( ).
35
+
36
+
ENDCASE.
37
+
38
+
ENDMETHOD.
39
+
```
40
+
13
41
### Suggestions
14
42
Want to optimize your app even more? Here are a few tips:
15
-
* Only call the `client->view_display`method when necessary. Instead, prefer using `client->model_update` so the UI5 framework only re-renders the controls that have actually changed
16
-
* Prefer using `client->bind` and use `client->bind_edit` only when users need to make changes that are processed in the backend. Otherwise, it leads to unnecessary data transfers
43
+
* Only call `client->view_display` when necessary. Prefer `client->view_model_update` so the UI5 framework only re-renders controls that have actually changed
44
+
* Prefer `client->_bind` and use `client->_bind_edit` only when users need to make changes that are processed in the backend. Otherwise, it leads to unnecessary data transfers
17
45
* Declare public attributes in your app class only for variables displayed in the frontend. This helps prevent the framework from accessing unused values
18
46
* Follow standard ABAP best practices, such as reducing loops and using sorted tables, as you would in any other ABAP development project
Copy file name to clipboardExpand all lines: docs/configuration/productive_usage.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The project will be continuously further developed, so there's no specific "stab
18
18
19
19
#### Transport
20
20
Install the project using abapGit into your development system. Then, use the normal transport process for deployment to production:
21
-
{ width=80% }
21
+
{ width=80% }
22
22
23
23
#### Renaming
24
24
If you're starting new development but already have abap2UI5 apps running in production, and you're worried about updating to the latest release, consider installing abap2UI5 multiple times in your system using the [renaming feature](/advanced/renaming). This way, you can safely continue development without affecting your existing apps in production.
Copy file name to clipboardExpand all lines: docs/development/events.md
+37-23Lines changed: 37 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,69 +22,76 @@ METHOD z2ui5_if_app~main.
22
22
23
23
CASE client->get( )-event.
24
24
WHEN `BUTTON_POST`.
25
-
client->message_box_display( |Your name is { name }| ).
25
+
client->message_box_display( `The button was pressed` ).
26
26
ENDCASE.
27
27
28
28
ENDMETHOD.
29
29
```
30
-
If the backend needs additional information about the specific event, use parameters like `$event`, `$source`, and `$params` to send further details. Use the t_arg parameter to include these details. Check out [this documentation](https://openui5.hana.ondemand.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe) for more information, and refer to sample `Z2UI5_CL_DEMO_APP_167`.
30
+
If the backend needs additional information about the specific event, use the `t_arg` parameter to include additional details. Three special prefixes are available:
31
+
32
+
-**`$source`** — the UI5 control that triggered the event (e.g. `${$source>/text}` returns the button text)
33
+
-**`$parameters`** — the event parameters as defined by the UI5 control (e.g. `${$parameters>/id}` returns the element ID)
34
+
-**`$event`** — the UI5 event object itself (e.g. `$event>sId` returns the event type like `press`)
35
+
36
+
Check out [this documentation](https://openui5.hana.ondemand.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe) for more information, and refer to sample `Z2UI5_CL_DEMO_APP_167`.
31
37
32
38
#### Source
33
-
Send properties of the event source control to the backend:
39
+
Send properties of the event source control to the backend. The syntax `${$source>/text}` reads the `text` property from the UI5 control that fired the event — here the button itself, so the result is the button's label (`post`):
34
40
```abap
35
41
METHOD z2ui5_if_app~main.
36
42
37
43
client->view_display( z2ui5_cl_xml_view=>factory(
38
-
)->button( text = `post` press = client->_event(
39
-
val = `BUTTON_POST`
40
-
t_arg = VALUE #( ( `${$source>/text}` ) ) )
44
+
)->button( text = `post` press = client->_event(
45
+
val = `BUTTON_POST`
46
+
"reads button text → result: "post"
47
+
t_arg = VALUE #( ( `${$source>/text}` ) ) )
41
48
)->stringify( ) ).
42
-
49
+
43
50
CASE client->get( )-event.
44
51
WHEN `BUTTON_POST`.
45
52
client->message_box_display( |The button text is { client->get_event_arg( ) }| ).
46
53
ENDCASE.
47
-
54
+
48
55
ENDMETHOD.
49
56
```
50
57
51
58
#### Parameters
52
-
Retrieve parameters of the event:
59
+
Retrieve parameters of the event. The syntax `${$parameters>/id}` reads the `id` parameter from the event's parameter map — UI5 generates a qualified ID like `mainView--button_id`:
53
60
```abap
54
61
METHOD z2ui5_if_app~main.
55
62
56
63
client->view_display( z2ui5_cl_xml_view=>factory(
57
-
)->button( text = `post` id = `button_id` press = client->_event(
58
-
val = `BUTTON_POST`
59
-
t_arg = VALUE #( ( `${$parameters>/id}` ) ) )
64
+
)->button( text = `post` id = `button_id` press = client->_event(
client->message_box_display( |The button id is { client->get_event_arg( ) }| ).
66
73
ENDCASE.
67
-
74
+
68
75
ENDMETHOD.
69
76
```
70
77
71
78
#### Event
72
-
Retrieve specific properties of the event:
79
+
Retrieve specific properties of the event object. The syntax `$event>sId` accesses the `sId` attribute of the UI5 event — here it returns the event type name (`press`). Note: no `${...}` wrapper here because `$event` directly references the event object:
73
80
```abap
74
81
METHOD z2ui5_if_app~main.
75
82
76
83
client->view_display( z2ui5_cl_xml_view=>factory(
77
-
)->button( text = `post` press = client->_event(
78
-
val = `BUTTON_POST`
79
-
t_arg = VALUE #( ( `$event>sId` ) ) )
84
+
)->button( text = `post` press = client->_event(
85
+
val = `BUTTON_POST`
86
+
"reads event object attribute → result: "press"
87
+
t_arg = VALUE #( ( `$event>sId` ) ) )
80
88
)->stringify( ) ).
81
-
89
+
82
90
CASE client->get( )-event.
83
91
WHEN `BUTTON_POST`.
84
-
"press
85
92
client->message_box_display( |The event id is { client->get_event_arg( ) }| ).
86
93
ENDCASE.
87
-
94
+
88
95
ENDMETHOD.
89
96
```
90
97
::: warning
@@ -127,7 +134,14 @@ This is just a demonstration. In this case, it would be easier to access `name`
127
134
:::
128
135
129
136
### Frontend
130
-
If you don't want to process the event in the backend, you can also directly trigger actions at the frontend. The following frontend events are available:
137
+
If you don't want to process the event in the backend, you can directly trigger actions at the frontend using `client->_event_client`. The difference between the two methods:
138
+
139
+
-**`client->_event( )`** — triggers a backend roundtrip, the event is processed in the `main` method
140
+
-**`client->_event_client( )`** — executes an action directly in the browser, no backend call
141
+
142
+
To use a frontend event on a UI5 control property (like `press`), wrap `_event_client` inside `_event`. To execute a frontend event after backend processing, pass `_event_client` to `client->follow_up_action`.
0 commit comments