Skip to content

Commit 7a0bb7e

Browse files
committed
docs: second clarity pass — beginner journey, code correctness, consistency
- quickstart: state the endpoint URL (SICF Test Service), map the ABAP/ABAP Cloud tabs to system types, explain the Handler List step, how to launch your own class, abapGit prerequisite, and a naming tip (customer namespace vs. reserved Z2UI5_ prefix) - hello_world/full_example: explain why bound attributes must be public, the me->client pattern, shell( )/get_parent( ) and get( )-event vs get_event_arg( ) on first use - life_cycle: drop the false "used by every tutorial" claim and acknowledge the equivalent IF/ELSEIF dispatch used by the tutorials and samples - snippets: replace the non-compiling "sorting/filtering" table example (growing_threshold, sort_property/filter_property do not exist in the builder or sap.m.Column) with a real backend-sorting example - definition: fix Dialog cross-reference (Popup, not Popover) and the builder property naming rule (selectedkey, not selected_key) - binding: rename example class out of the reserved framework namespace - smaller fixes: LO→L0 template variable, misleading button label, Cookbook link target, ITS vs ITS Mobile, dispatch style unified within abap_sql page, changelog note on check_on_event status Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC2cWJafPETwcMbh3NCsgH
1 parent 7baa422 commit 7a0bb7e

18 files changed

Lines changed: 76 additions & 52 deletions

File tree

docs/cookbook/eml_cds_sql/abap_sql.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ CLASS z2ui5_cl_sample_sql IMPLEMENTATION.
2828
INTO TABLE @mt_flights
2929
UP TO 50 ROWS.
3030
31-
DATA(view) = z2ui5_cl_xml_view=>factory( )->page( ).
31+
DATA(view) = z2ui5_cl_xml_view=>factory( )->shell( )->page( ).
3232
DATA(table) = view->table( client->_bind( mt_flights ) ).
3333
3434
table->columns(
@@ -55,17 +55,17 @@ ENDCLASS.
5555

5656
Bind the search term with `_bind_edit( )` and re-run the `SELECT` on every `SEARCH` event:
5757
```abap
58-
CASE abap_true.
58+
IF client->check_on_init( ).
5959
60-
WHEN client->check_on_init( ).
61-
load_data( ).
62-
render( ).
60+
load_data( ).
61+
render( ).
6362
64-
WHEN client->check_on_event( `SEARCH` ).
65-
load_data( ).
66-
client->view_model_update( ).
63+
ELSEIF client->check_on_event( `SEARCH` ).
6764
68-
ENDCASE.
65+
load_data( ).
66+
client->view_model_update( ).
67+
68+
ENDIF.
6969
```
7070

7171
```abap

docs/cookbook/eml_cds_sql/cds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ outline: [2, 4]
33
---
44
# CDS
55

6-
All examples in these docs work without CDS. But on a recent ABAP release, you can also use this feature in abap2UI5 apps.
6+
All examples in these docs work without CDS. On a recent ABAP release, you can also read data through CDS views in your abap2UI5 apps.
77

88
### ABAP CDS
99
ABAP Core Data Services (CDS) let you define structured views and read data straight from the database. The example below fetches sales orders from the `I_SalesOrder` view of the Virtual Data Model (VDM) and shows them in a UI5 table:

docs/cookbook/eml_cds_sql/draft_handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ ENDMETHOD.
269269
`%is_draft = if_abap_behv=>mk-off` makes the read return the **active** row, not any open draft.
270270

271271
#### 2. Entering Edit Mode — Check for an Existing Draft
272-
When the user clicks **Switch to Edit Mode**, the app first looks in the BO's draft-shadow table (here `cabnk_bank_d`) joined with `sdraft_admin` to find out whether a draft already exists for this key — and who owns it.
272+
When the user clicks **Switch to Edit Mode**, the app first looks in the BO's draft-shadow table (here `cabnk_bank_d`) joined with `sdraft_admin` to find out whether a draft already exists for this key — and who owns it. (Simplified here; the full snippet at the end of the page additionally reads the draft's timestamp.)
273273
```abap
274274
METHOD check_existing_draft.
275275
SELECT SINGLE a~created_by, a~last_changed_at

docs/cookbook/eml_cds_sql/fuzzy_search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ CLASS z2ui5_cl_sample_fuzzy IMPLEMENTATION.
6161
DATA(tab) = view->table( client->_bind( mt_customers ) growing = abap_true ).
6262
6363
tab->header_toolbar( )->overflow_toolbar(
64-
)->title( `Customers`
64+
)->title( `Customer List`
6565
)->toolbar_spacer( )
6666
)->search_field(
6767
value = client->_bind_edit( mv_search )

docs/cookbook/event_navigation/frontend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ METHOD z2ui5_if_app~main.
4444
4545
client->view_display( z2ui5_cl_xml_view=>factory(
4646
)->button(
47-
text = `post`
47+
text = `open new tab`
4848
press = client->_event_client(
4949
val = client->cs_event-open_new_tab
5050
t_arg = VALUE #( ( `https://github.com/abap2UI5` ) ) )

docs/cookbook/event_navigation/life_cycle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ outline: [2, 4]
33
---
44
# Life Cycle
55

6-
Every request enters the `main` method. `CASE abap_true` dispatches between initialization, navigation returns, and user events using `client->check_on_init( )`, `client->check_on_event( 'EVENT_NAME' )`, and `client->check_on_navigated( )`. Each branch either does the work inline (tiny apps) or calls a named handler method (typical apps) — the **structure is always the same**.
6+
Every request enters the `main` method. `CASE abap_true` dispatches between initialization, navigation returns, and user events using `` client->check_on_init( ) ``, `` client->check_on_event( `EVENT_NAME` ) ``, and `` client->check_on_navigated( ) ``. Each branch either does the work inline (tiny apps) or calls a named handler method (typical apps) — the **structure is always the same**.
77

88
```abap
99
CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC.
@@ -42,10 +42,10 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.
4242
ENDCLASS.
4343
```
4444

45-
Three things make this the recommended shape, used by every tutorial in this guide:
45+
Whether you dispatch with `CASE abap_true` (as above) or with an equivalent `IF` / `ELSEIF` chain (as the [Hello World](/get_started/hello_world) and [Full Example](/get_started/full_example) tutorials do) is a matter of taste — the structure is what counts. Three things make this the recommended shape:
4646

4747
1. **Store `client` on `me->client`** so handler methods can use it without passing it around.
48-
2. **Dispatch by event name**`check_on_event( 'POST' )` rather than a generic `check_on_event( )` followed by a second `CASE`. Each event gets its own `WHEN`.
48+
2. **Dispatch by event name**`` check_on_event( `POST` ) `` rather than a generic `` CASE client->get( )-event `` with a second dispatch level. Each event gets its own `WHEN`. (With many events or extracted handler methods, the `CASE client->get( )-event` form is a fine alternative — the [Full Example](/get_started/full_example) uses it.)
4949
3. **One render method per view** — call it from any `WHEN` that should rebuild the screen (`check_on_init`, after a search, after a navigation return). Event handlers that only mutate state and reuse the existing view (a button press inside a popup, a toast) skip it — see [The View Is Only Sent When You Call `view_display`](#the-view-is-only-sent-when-you-call-view-display) below.
5050

5151
For a tiny app with one or two events, inline the view and the handler directly in the `WHEN` branches and skip the handler methods entirely. [Hello World](/get_started/hello_world) shows this variant; [Full Example](/get_started/full_example) shows the full version with multiple handler methods, a popup, and persistence. Both follow the same pattern — only the amount of code inside each branch differs.

docs/cookbook/expert_more/snippets.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ CLASS z2ui5_cl_app_table_basic IMPLEMENTATION.
174174
ENDCLASS.
175175
```
176176

177-
## Table with Filtering, Sorting
177+
## Table with Sorting
178178

179-
Enable UI5's built-in column sorting and filtering by setting `sortProperty` and `filterProperty` on each column header. The `p13n` settings expose the personalization icon.
179+
`sap.m.Table` has no built-in column sorting — in abap2UI5, sorting (and filtering) is backend work: react to an event, `SORT` the internal table in ABAP, and push the new order to the rendered view with `view_model_update`. No re-render needed:
180180

181181
```abap
182-
CLASS z2ui5_cl_app_table_p13n DEFINITION PUBLIC.
182+
CLASS z2ui5_cl_app_table_sort DEFINITION PUBLIC.
183183
184184
PUBLIC SECTION.
185185
INTERFACES z2ui5_if_app.
@@ -193,7 +193,7 @@ CLASS z2ui5_cl_app_table_p13n DEFINITION PUBLIC.
193193
194194
ENDCLASS.
195195
196-
CLASS z2ui5_cl_app_table_p13n IMPLEMENTATION.
196+
CLASS z2ui5_cl_app_table_sort IMPLEMENTATION.
197197
METHOD z2ui5_if_app~main.
198198
199199
IF client->check_on_init( ).
@@ -206,22 +206,28 @@ CLASS z2ui5_cl_app_table_p13n IMPLEMENTATION.
206206
) INTO TABLE rows.
207207
ENDDO.
208208
209-
DATA(view) = z2ui5_cl_xml_view=>factory( )->page( `Sortable / Filterable Table` ).
209+
DATA(view) = z2ui5_cl_xml_view=>factory( )->page( `Sortable Table` ).
210210
211211
DATA(tab) = view->table(
212-
items = client->_bind( rows )
213-
growing = abap_true
214-
growing_threshold = `10`
215-
mode = `MultiSelect`
216-
sticky = `ColumnHeaders` ).
212+
items = client->_bind( rows )
213+
growing = abap_true
214+
growingthreshold = `10`
215+
sticky = `ColumnHeaders` ).
216+
217+
tab->header_toolbar( )->toolbar(
218+
)->title( `Orders`
219+
)->toolbar_spacer(
220+
)->button(
221+
text = `Sort by Name`
222+
press = client->_event( `SORT_NAME` )
223+
)->button(
224+
text = `Sort by Status`
225+
press = client->_event( `SORT_STATUS` ) ).
217226
218227
tab->columns(
219-
)->column( sort_property = `ID` filter_property = `ID`
220-
)->text( `ID` )->get_parent(
221-
)->column( sort_property = `NAME` filter_property = `NAME`
222-
)->text( `Name` )->get_parent(
223-
)->column( sort_property = `STATUS` filter_property = `STATUS`
224-
)->text( `Status` ).
228+
)->column( )->text( `ID` )->get_parent(
229+
)->column( )->text( `Name` )->get_parent(
230+
)->column( )->text( `Status` ).
225231
226232
tab->items( )->column_list_item( )->cells(
227233
)->text( `{ID}`
@@ -230,6 +236,16 @@ CLASS z2ui5_cl_app_table_p13n IMPLEMENTATION.
230236
231237
client->view_display( view->stringify( ) ).
232238
239+
ELSEIF client->check_on_event( `SORT_NAME` ).
240+
241+
SORT rows BY name.
242+
client->view_model_update( ).
243+
244+
ELSEIF client->check_on_event( `SORT_STATUS` ).
245+
246+
SORT rows BY status.
247+
client->view_model_update( ).
248+
233249
ENDIF.
234250
235251
ENDMETHOD.

docs/cookbook/model/binding.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ In abap2UI5, there are two ways to share data between your ABAP code and the UI5
99
Use one-way binding to show data on the frontend without allowing edits. The `client->_bind` method sends data to the frontend and binds it to the view:
1010

1111
```abap
12-
CLASS z2ui5_cl_app_hello_world DEFINITION PUBLIC.
12+
CLASS zcl_app_hello_world DEFINITION PUBLIC.
1313
1414
PUBLIC SECTION.
1515
INTERFACES z2ui5_if_app.
1616
DATA name TYPE string.
1717
1818
ENDCLASS.
1919
20-
CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
20+
CLASS zcl_app_hello_world IMPLEMENTATION.
2121
METHOD z2ui5_if_app~main.
2222
2323
client->view_display( z2ui5_cl_xml_view=>factory(
@@ -35,15 +35,15 @@ This method works with tables, trees, and other nested data structures — see [
3535
When users need to edit data, use two-way binding to keep it in sync with the ABAP backend. Call the `client->_bind_edit` method — after an event, the framework syncs the data back to your ABAP class:
3636

3737
```abap
38-
CLASS z2ui5_cl_app_hello_world DEFINITION PUBLIC.
38+
CLASS zcl_app_hello_world DEFINITION PUBLIC.
3939
4040
PUBLIC SECTION.
4141
INTERFACES z2ui5_if_app.
4242
DATA name TYPE string.
4343
4444
ENDCLASS.
4545
46-
CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
46+
CLASS zcl_app_hello_world IMPLEMENTATION.
4747
METHOD z2ui5_if_app~main.
4848
4949
client->view_display( z2ui5_cl_xml_view=>factory(

docs/cookbook/view/definition.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ outline: [2, 4]
55

66
abap2UI5 uses [SAP UI5](https://sapui5.hana.ondemand.com) on the frontend without modification. Whatever your ABAP code sends to the browser is a **standard UI5 XML view** — the same XML you would write in any UI5 freestyle project.
77

8-
The consequence: **everything in the UI5 SDK works in abap2UI5 1:1**. Any control, any property, any namespace from the [UI5 Demo Kit](https://sapui5.hana.ondemand.com/sdk) is available. Copy the XML, paste it into your ABAP class, and it renders.
8+
The consequence: **everything in the UI5 SDK works in abap2UI5 1:1 when you write the XML directly**. Any control, any property, any namespace from the [UI5 Demo Kit](https://sapui5.hana.ondemand.com/sdk) is available. Copy the XML, paste it into your ABAP class, and it renders.
99

1010
#### Sending a View
1111

@@ -94,7 +94,7 @@ The UI5 SDK is large. The table below covers the choices that come up in almost
9494
| Multi-select dropdown | `sap.m.MultiComboBox` | Pills appear inside the field. |
9595
| Date / time input | `sap.m.DatePicker` / `sap.m.TimePicker` / `sap.m.DateTimePicker` | Needs a formatter — see [Binding → Data-Type Mapping](/cookbook/model/binding#data-type-mapping). |
9696
| Status indicator | `sap.m.ObjectStatus` | Colored text + icon for state. |
97-
| Modal dialog | `sap.m.Dialog` (built with `factory_popup`) | See [Popover](/cookbook/popup_popover/popover). |
97+
| Modal dialog | `sap.m.Dialog` (built with `factory_popup`) | See [Popup](/cookbook/popup_popover/popup). |
9898

9999
When two controls fit, prefer the simpler one: `Table` over `TreeTable`, `SimpleForm` over `Form`, `Select` over `ComboBox`. Switch to the richer variant only when a concrete requirement justifies it.
100100

@@ -103,7 +103,7 @@ When two controls fit, prefer the simpler one: `Table` over `TreeTable`, `Simple
103103
`Z2UI5_CL_XML_VIEW` is a hand-curated wrapper around UI5 controls. It does not cover every UI5 control, and the naming is not always a strict 1:1 mapping of the UI5 SDK:
104104

105105
- Control names follow snake_case of the UI5 control class — `sap.m.MultiComboBox` becomes `->multi_combo_box( )`, `sap.m.Text` becomes `->text( )`.
106-
- Properties are passed as named parameters in snake_case (`enabled`, `placeholder`, `selected_key`).
106+
- Properties are passed as named parameters, lowercased without underscores (`enabled`, `placeholder`, `selectedkey`, `growingthreshold`). Only the *method* names use snake_case (e.g. `multi_combo_box`).
107107
- Aggregations are exposed as methods named after the aggregation itself (`->items( )`, `->content( )`, `->custom_data( )`) — not as `add_item( )` / `add_content( )`. Calling the aggregation method returns the parent builder so you can chain children inside it.
108108
- Coverage is incomplete and occasionally inconsistent: some controls or properties are missing, some method signatures don't match the SDK exactly. When in doubt, check the source of `Z2UI5_CL_XML_VIEW` or fall back to the generic builder below.
109109

docs/cookbook/view/xml_templating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ DATA(lo_view_nested) = z2ui5_cl_xml_view=>factory( ).
111111
lo_view_nested->shell( )->page( `Nested View`
112112
)->table( client->_bind( mt_data )
113113
)->columns(
114-
)->template_repeat( list = `{template>/MT_LAYOUT}` var = `LO`
114+
)->template_repeat( list = `{template>/MT_LAYOUT}` var = `L0`
115115
)->column( ... ) " ...
116116
117117
client->nest_view_display( val = lo_view_nested->stringify( )

0 commit comments

Comments
 (0)