Skip to content

Commit faa89cc

Browse files
committed
Add explanatory text to 12 documentation pages with unexplained code
Context paragraphs added before code snippets in fiori.md, xlsx.md, translation.md, custom_js.md, demo_output.md, barcodes.md, device.md, app_state.md, user_exits.md, btp.md, authorization.md, and launchpad.md. Each addition explains what the code does, which APIs are used, and when/why the pattern is needed. https://claude.ai/code/session_01AaA4EMw83KMzGP6kaDZPJU
1 parent 8af9648 commit faa89cc

12 files changed

Lines changed: 55 additions & 19 deletions

File tree

docs/advanced/extensibility/custom_js.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ If the standard UI5 framework functionalities do not fulfill all your requiremen
77

88
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.
99

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:
1111

1212
```abap
1313
METHOD z2ui5_if_app~main.
1414
1515
IF client->check_on_init( ).
1616
DATA(view) = z2ui5_cl_xml_view=>factory( ).
17-
view->_generic( name = `script` ns = `html`
17+
view->_generic( name = `script` ns = `html`
1818
)->_cc_plain_xml(
1919
|function myFunction() \{ console.log( `Hello World` ); \}|
2020
).

docs/advanced/extensibility/user_exits.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
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.
44

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:
610

711
```abap
812
CLASS zcl_a2ui5_user_exit DEFINITION PUBLIC.

docs/advanced/fiori.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ sap.ui.core.Component.create({
6565
```
6666

6767
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:
6870
```abap
6971
METHOD z2ui5_if_app~main.
7072

docs/configuration/authorization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abap2UI5 offers flexible ways to manage authorization handling. It doesn't inclu
99
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.
1010

1111
##### 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.
1313
```abap
1414
CLASS z2ui5_cl_launchpad_handler DEFINITION PUBLIC.
1515
@@ -36,7 +36,7 @@ CLASS z2ui5_cl_launchpad_handler IMPLEMENTATION.
3636
ENDCLASS.
3737
```
3838
##### 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:
4040
```abap
4141
CLASS z2ui5_cl_launchpad_handler DEFINITION PUBLIC.
4242

docs/configuration/btp.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ Integrate your abap2UI5 apps into BTP Services like Build Workzone. Find all inf
2424

2525
##### Additional Properties
2626

27-
* HTML5.DynamicDestination true
28-
* product.name ABAP System
29-
* sap-client (client)
30-
* WebIDEEnabled true
31-
* WebIDEUsage odata_abap,dev_abap
27+
These properties are required by SAP Build Work Zone to correctly route requests to your ABAP backend:
28+
29+
| Property | Value | Description |
30+
|---|---|---|
31+
| HTML5.DynamicDestination | `true` | Allows HTML5 apps to resolve this destination at runtime |
32+
| product.name | `ABAP System` | Identifies the backend type for the Work Zone tile configuration |
33+
| sap-client | *(your client number)* | The SAP system client to connect to (e.g. `001`) |
34+
| WebIDEEnabled | `true` | Enables the destination for SAP Business Application Studio |
35+
| WebIDEUsage | `odata_abap,dev_abap` | Declares supported protocols for development tools |

docs/configuration/launchpad.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ Find more information in the blog article on [LinkedIn.](https://www.linkedin.co
5959
<br>
6060

6161
#### 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:
6365
```abap
6466
INTERFACE z2ui5_if_lp_kpi
6567
PUBLIC.
@@ -72,7 +74,7 @@ INTERFACE z2ui5_if_lp_kpi
7274
7375
ENDINTERFACE.
7476
```
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):
7678
```abap
7779
CLASS z2ui5_cl_lp_kpi_hello_world DEFINITION PUBLIC.
7880
@@ -95,7 +97,7 @@ CLASS z2ui5_cl_lp_kpi_hello_world IMPLEMENTATION.
9597
9698
ENDCLASS.
9799
```
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:
99101
```
100102
.../sap/opu/odata/sap/Z2UI5_PROXY_KPI_SRV/ENTITYCollection/$count?$filter=CLASS eq 'z2ui5_cl_lp_kpi_hello_world'
101103
```

docs/development/model/device.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ outline: [2, 4]
33
---
44
# Device Model
55

6+
abap2UI5 offers two ways to access device information: directly in the view via the UI5 device model (frontend), or by collecting it in ABAP attributes via a custom control (backend).
7+
68
### Frontend
79

8-
The device model is bound to the view by default with the name `device`. You can access it easily in your view. For example:
10+
The device model is bound to the view by default with the name `device`. You can use standard UI5 binding syntax to display device properties directly — no backend roundtrip needed. For example:
911
```abap
1012
page->input(
1113
description = `device model - resize - width`
@@ -14,7 +16,7 @@ page->input(
1416
Explore all available parameters in the [UI5 Documentation.](https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.Device)
1517

1618
### Backend
17-
You can also retrieve detailed device information on the backend using a custom info frontend control. This allows you to access UI5 version, device type, OS, browser details, and screen dimensions. Below is an example implementation, which demonstrates how to collect and use this information:
19+
If you need device information in your ABAP logic (e.g. to adapt behavior based on the browser or screen size), use the `info_frontend` custom control. It collects the values on the frontend and sends them back to the backend via two-way binding (`_bind_edit`). Once the `finished` event fires, all bound attributes are populated and available in ABAP:
1820
```abap
1921
CLASS z2ui5_cl_sample_device DEFINITION PUBLIC.
2022

docs/development/navigation/app_state.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
abap2UI5 supports saving the current app state so you can return to it later -- similar to how standard UI5 applications handle state management.
44

55
### Usage
6-
Each state is saved as a draft with a unique ID, you can display this ID in the URL using the `client->set_app_state_active` method. This command generates a URL that you can copy and paste into another browser window. An example URL looks like this: <br>
6+
Each state is saved as a draft with a unique ID. Calling `client->set_app_state_active` appends this ID as a hash fragment to the URL. The resulting URL is shareable — you can copy it and open it in another browser window (or send it to a colleague) to restore the exact same app state. The hash value (`z2ui5-xapp-state=...`) is a server-side key that references the persisted draft. Drafts expire after a configurable time (default: 4 hours, adjustable via [User Exits](/advanced/extensibility/user_exits)).
7+
8+
An example URL looks like this: <br>
79
`.../sap/bc/z2ui5?sap-client=001&app_start=z2ui5_cl_demo_app_000#/z2ui5-xapp-state=024251849E5A1EDFB1DAE2C97C8CE8C2`
810

911
### Sample Code

docs/development/specific/barcodes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ This feature is only available when using the UI5 framework and is not supported
4949
#### Focus Handling
5050
Most scanner devices have an integrated scanning function. In such cases, you can create an input field and ensure that focus is properly set. The scanned data will populate the input field as if it were typed via a keyboard.
5151

52-
Here’s an example that demonstrates how to handle input focus and manage transitions between fields after scanning and pressing ENTER:
52+
The key mechanism is the `_z2ui5()->focus()` custom control, which accepts a bound `focus_id` attribute. When the user presses ENTER (triggering the `submit` event), the backend updates `focus_id` to the next input field's ID and calls `view_model_update` — the framework then automatically moves focus to the corresponding field on the frontend:
53+
54+
Here's an example that demonstrates how to handle input focus and manage transitions between fields after scanning and pressing ENTER:
5355

5456
```abap
5557
CLASS z2ui5_cl_sample_focus DEFINITION PUBLIC.

docs/development/specific/demo_output.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
If you're familiar with `CL_DEMO_OUTPUT` from classic ABAP, you can display its HTML output inside an abap2UI5 app as well. This is handy for quick data visualization or when migrating existing demo code.
44

5-
The approach: generate the HTML with `cl_demo_output=>get( )`, inject CSS styles via `_cc_plain_xml`, and render the result with the `html` control:
5+
The approach: generate the HTML with `cl_demo_output=>get( )`, inject CSS styles via `_cc_plain_xml` (which inserts raw XML/HTML into the view), and render the result with the UI5 `html` control. The CSS block is needed because `CL_DEMO_OUTPUT` produces HTML with specific class names (e.g. `heading1`, `header`, `body`) that require matching style definitions to display correctly.
6+
7+
::: tip
8+
This technique is best suited for prototyping or migrating existing demo programs. For production apps, consider building proper UI5 views instead.
9+
:::
610

711
```abap
812
METHOD z2ui5_if_app~main.

0 commit comments

Comments
 (0)