Skip to content

Commit 3f642af

Browse files
committed
Docs: recommend follow_up_action, mark action->gen obsolete
Reverse the previous obsolete designation: follow_up_action is now documented as the recommended way to trigger a frontend action from the backend, and action->gen is marked obsolete. - follow_up_action.md rewritten as the recommended page; action.md rewritten as the obsolete page pointing to it - all cookbook code examples (browser interaction, device capabilities, model, odata, launchpad, ...) converted from action->gen( val/t_arg ) to the equivalent follow_up_action( |.eF('EVENT', args)| ) form - prose references in frontend.md, focus.md, size_limit.md, custom_controls.md and custom_js.md updated accordingly vitepress build passes (no dead links). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vTnxZtHiAd4tiqMvxFdgJ
1 parent f21ea64 commit 3f642af

21 files changed

Lines changed: 88 additions & 152 deletions

docs/configuration/launchpad.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ ENDIF.
3434
Change the Launchpad shell title from ABAP at any time with the `set_title_launchpad` frontend event:
3535

3636
```abap
37-
client->action->gen(
38-
val = z2ui5_if_client=>cs_event-set_title_launchpad
39-
t_arg = VALUE #( ( `My Dynamic Title` ) ) ).
37+
client->follow_up_action( |.eF('SET_TITLE_LAUNCHPAD', 'My Dynamic Title')| ).
4038
```
4139

4240
#### Read Startup Parameters

docs/cookbook/browser_interaction/clipboard.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ CLASS z2ui5_cl_sample_clipboard IMPLEMENTATION.
3131
)->stringify( ) ).
3232
3333
WHEN client->check_on_event( `COPY` ).
34-
client->action->gen(
35-
val = client->cs_event-clipboard_copy
36-
t_arg = VALUE #( ( mv_text ) ) ).
34+
client->follow_up_action( |.eF('CLIPBOARD_COPY', '{ mv_text }')| ).
3735
client->message_toast_display( `copied` ).
3836
3937
ENDCASE.

docs/cookbook/browser_interaction/focus.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This is useful for guided data entry, barcode scanning, or any flow where the ne
2525

2626
#### Basic Usage
2727

28-
After processing an event, call `client->action->gen( )` with `cs_event-set_focus` and the id of the input to focus next. (The value bindings on the inputs are omitted here to keep the focus logic clear — see [Barcode Scanning](/cookbook/device_capabilities/barcode_scanning) for the same form with bound inputs.)
28+
After processing an event, call `client->follow_up_action( )` with the `SET_FOCUS` frontend event and the id of the input to focus next. (The value bindings on the inputs are omitted here to keep the focus logic clear — see [Barcode Scanning](/cookbook/device_capabilities/barcode_scanning) for the same form with bound inputs.)
2929

3030
```abap
3131
METHOD z2ui5_if_app~main.
@@ -45,12 +45,10 @@ METHOD z2ui5_if_app~main.
4545
client->view_display( page->stringify( ) ).
4646
4747
ELSEIF client->check_on_event( `ONE_ENTER` ).
48-
client->action->gen( val = client->cs_event-set_focus
49-
t_arg = VALUE #( ( `id2` ) ) ).
48+
client->follow_up_action( |.eF('SET_FOCUS', 'id2')| ).
5049
5150
ELSEIF client->check_on_event( `TWO_ENTER` ).
52-
client->action->gen( val = client->cs_event-set_focus
53-
t_arg = VALUE #( ( `id1` ) ) ).
51+
client->follow_up_action( |.eF('SET_FOCUS', 'id1')| ).
5452
5553
ENDIF.
5654
@@ -64,8 +62,7 @@ After the user presses Enter in `id1`, the backend fires `set_focus` for `id2` a
6462
To position the caret inside the field or pre-select a range, pass the start and end offsets as additional arguments:
6563

6664
```abap
67-
client->action->gen( val = client->cs_event-set_focus
68-
t_arg = VALUE #( ( `id1` ) ( `0` ) ( `5` ) ) ).
65+
client->follow_up_action( |.eF('SET_FOCUS', 'id1', '0', '5')| ).
6966
```
7067

7168
#### Barcode Scanning

docs/cookbook/browser_interaction/scrolling.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ CLASS z2ui5_cl_sample_scrolling IMPLEMENTATION.
5252
5353
CASE client->get( )-event.
5454
WHEN `SCROLL_TOP`.
55-
client->action->gen( val = client->cs_event-scroll_to
56-
t_arg = VALUE #( ( `id_page` ) ( `0` ) ) ).
55+
client->follow_up_action( |.eF('SCROLL_TO', 'id_page', '0')| ).
5756
WHEN `SCROLL_BOTTOM`.
58-
client->action->gen( val = client->cs_event-scroll_to
59-
t_arg = VALUE #( ( `id_page` ) ( `99999` ) ) ).
57+
client->follow_up_action( |.eF('SCROLL_TO', 'id_page', '99999')| ).
6058
ENDCASE.
6159
6260
ENDMETHOD.
@@ -66,22 +64,19 @@ ENDCLASS.
6664
The arguments for `scroll_to` are `id`, `scrollTop` (y, px), `scrollLeft` (x, px, optional), and `behavior` (optional):
6765

6866
```abap
69-
client->action->gen( val = client->cs_event-scroll_to
70-
t_arg = VALUE #( ( `id_page` ) ( `500` ) ( `0` ) ( `smooth` ) ) ).
67+
client->follow_up_action( |.eF('SCROLL_TO', 'id_page', '500', '0', 'smooth')| ).
7168
```
7269

7370
#### Scroll an Element into View
7471

7572
To reveal a specific control — e.g. a row after a search — use `scroll_into_view` with the target control's id:
7673

7774
```abap
78-
client->action->gen( val = client->cs_event-scroll_into_view
79-
t_arg = VALUE #( ( `id_row_42` ) ) ).
75+
client->follow_up_action( |.eF('SCROLL_INTO_VIEW', 'id_row_42')| ).
8076
```
8177

8278
Additional optional arguments mirror the browser's `scrollIntoView` options: `behavior` (`smooth` | `auto` | `instant`), `block` (`start` | `center` | `end` | `nearest`), `inline` (`nearest` | `start` | `center` | `end`):
8379

8480
```abap
85-
client->action->gen( val = client->cs_event-scroll_into_view
86-
t_arg = VALUE #( ( `id_row_42` ) ( `smooth` ) ( `center` ) ) ).
81+
client->follow_up_action( |.eF('SCROLL_INTO_VIEW', 'id_row_42', 'smooth', 'center')| ).
8782
```

docs/cookbook/browser_interaction/soft_keyboard.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ METHOD z2ui5_if_app~main.
3636
3737
CASE client->get( )-event.
3838
WHEN `CALL_KEYBOARD`.
39-
client->action->gen( val = client->cs_event-keyboard_set_mode
40-
t_arg = VALUE #( ( `ZINPUT` ) ( `none` ) ) ).
39+
client->follow_up_action( |.eF('KEYBOARD_SET_MODE', 'ZINPUT', 'none')| ).
4140
WHEN `BACK`.
4241
client->nav_app_leave( ).
4342
ENDCASE.

docs/cookbook/browser_interaction/timer.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ Fire a backend event after a delay with the `start_timer` frontend event. Handy
88
Pass the event name to fire and the delay in milliseconds:
99

1010
```abap
11-
client->action->gen(
12-
val = client->cs_event-start_timer
13-
t_arg = VALUE #( ( `REFRESH` ) ( `2000` ) ) ).
11+
client->follow_up_action( |.eF('START_TIMER', 'REFRESH', '2000')| ).
1412
```
1513

1614
After 2 seconds the browser triggers a backend roundtrip with the event name `REFRESH`, which you handle via `check_on_event` like any other event.
@@ -38,14 +36,12 @@ CLASS z2ui5_cl_sample_timer IMPLEMENTATION.
3836
)->page( `abap2UI5 - Timer`
3937
)->text( client->_bind( counter )
4038
)->stringify( ) ).
41-
client->action->gen( val = client->cs_event-start_timer
42-
t_arg = VALUE #( ( `TICK` ) ( `2000` ) ) ).
39+
client->follow_up_action( |.eF('START_TIMER', 'TICK', '2000')| ).
4340
4441
WHEN client->check_on_event( `TICK` ).
4542
counter = counter + 1.
4643
client->view_model_update( ).
47-
client->action->gen( val = client->cs_event-start_timer
48-
t_arg = VALUE #( ( `TICK` ) ( `2000` ) ) ).
44+
client->follow_up_action( |.eF('START_TIMER', 'TICK', '2000')| ).
4945
5046
ENDCASE.
5147
@@ -61,12 +57,10 @@ A single `start_timer` call fires once — perfect for a deferred action like op
6157

6258
```abap
6359
WHEN client->check_on_event( `BUTTON_OPEN_NEW_TAB` ).
64-
client->action->gen( val = client->cs_event-start_timer
65-
t_arg = VALUE #( ( `FIRE_OPEN_TAB` ) ( `500` ) ) ).
60+
client->follow_up_action( |.eF('START_TIMER', 'FIRE_OPEN_TAB', '500')| ).
6661
6762
WHEN client->check_on_event( `FIRE_OPEN_TAB` ).
68-
client->action->gen( val = client->cs_event-open_new_tab
69-
t_arg = VALUE #( ( `https://www.google.com/search?q=abap2ui5` ) ) ).
63+
client->follow_up_action( |.eF('OPEN_NEW_TAB', 'https://www.google.com/search?q=abap2ui5')| ).
7064
```
7165

7266
#### Replacing a Pending Timer

docs/cookbook/browser_interaction/title.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ METHOD z2ui5_if_app~main.
2323
)->stringify( ) ).
2424
2525
WHEN client->check_on_event( `RENAME` ).
26-
client->action->gen(
27-
val = client->cs_event-set_title
28-
t_arg = VALUE #( ( `Invoice 4711` ) ) ).
26+
client->follow_up_action( |.eF('SET_TITLE', 'Invoice 4711')| ).
2927
3028
ENDCASE.
3129
@@ -37,9 +35,7 @@ METHOD z2ui5_if_app~main.
3735
When the app runs inside an SAP Fiori Launchpad shell, use the dedicated `set_title_launchpad` event instead. It forwards the title to the shell's `ShellUIService` rather than setting `document.title`:
3836

3937
```abap
40-
client->action->gen(
41-
val = client->cs_event-set_title_launchpad
42-
t_arg = VALUE #( ( `Invoice 4711` ) ) ).
38+
client->follow_up_action( |.eF('SET_TITLE_LAUNCHPAD', 'Invoice 4711')| ).
4339
```
4440

4541
Use `set_title` for the browser tab/window title (standalone) and `set_title_launchpad` for the launchpad shell title.

docs/cookbook/browser_interaction/url_handling.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ DATA(lv_search) = client->get( )-s_config-search.
1616
Open a URL in a new browser tab via a frontend event:
1717
```abap
1818
DATA(lv_url) = `https://www.abap2UI5.org`.
19-
client->action->gen(
20-
val = client->cs_event-open_new_tab
21-
t_arg = VALUE #( ( lv_url ) ) ).
19+
client->follow_up_action( |.eF('OPEN_NEW_TAB', '{ lv_url }')| ).
2220
```
2321

2422
#### Browser History

docs/cookbook/device_capabilities/audio.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ CLASS z2ui5_cl_sample_sound IMPLEMENTATION.
3939
4040
IF client->get( )-event = `CHECK_INPUT`.
4141
IF company_code IS INITIAL.
42-
client->action->gen( val = client->cs_event-play_audio
43-
t_arg = VALUE #( ( `/SAP/PUBLIC/BC/ABAP/mime_demo/bam.wav` ) ) ).
42+
client->follow_up_action( |.eF('PLAY_AUDIO', '/SAP/PUBLIC/BC/ABAP/mime_demo/bam.wav')| ).
4443
client->message_box_display( type = `error` text = `Input is empty!` ).
4544
ELSE.
4645
CLEAR company_code.

docs/cookbook/device_capabilities/barcode_scanning.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ CLASS z2ui5_cl_sample_focus IMPLEMENTATION.
8686
8787
CASE client->get( )-event.
8888
WHEN `ONE_ENTER`.
89-
client->action->gen( val = client->cs_event-set_focus
90-
t_arg = VALUE #( ( `id2` ) ) ).
89+
client->follow_up_action( |.eF('SET_FOCUS', 'id2')| ).
9190
WHEN `TWO_ENTER`.
92-
client->action->gen( val = client->cs_event-set_focus
93-
t_arg = VALUE #( ( `id1` ) ) ).
91+
client->follow_up_action( |.eF('SET_FOCUS', 'id1')| ).
9492
ENDCASE.
9593
9694
ENDMETHOD.
@@ -131,8 +129,7 @@ CLASS z2ui5_cl_sample_sound IMPLEMENTATION.
131129
132130
IF client->get( )-event = `CHECK_INPUT`.
133131
IF company_code IS INITIAL.
134-
client->action->gen( val = client->cs_event-play_audio
135-
t_arg = VALUE #( ( `/SAP/PUBLIC/BC/ABAP/mime_demo/bam.wav` ) ) ).
132+
client->follow_up_action( |.eF('PLAY_AUDIO', '/SAP/PUBLIC/BC/ABAP/mime_demo/bam.wav')| ).
136133
client->message_box_display( type = `error` text = `Input is empty!` ).
137134
ELSE.
138135
CLEAR company_code.

0 commit comments

Comments
 (0)