From 3f88e32268e13bf266e2e60215fa0b2693e5b409 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 15 Sep 2026 09:08:19 +0000 Subject: [PATCH 1/2] The invoices app sends its one event argument with arg, not t_arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_event( arg = x )` is the one-value spelling of `t_arg = VALUE #( ( x ) )` — the client folds it into the same string_table, so the wire and `get_event_arg( )` are byte for byte what they were. The app that every reader meets first (the front page, and the twelve walkthrough steps that build it) was still spelling a single row out as a table constructor longer than the value inside it, which is the notation it then teaches by example. The wire now fits on one line, so the `val =` padding that only existed to align with the `t_arg =` continuation goes with it. Step 6, where the argument is introduced, names `arg` and says what it is short for and where `t_arg` takes over (from two values on). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JLUuftzubB7iRprxsDtVxD --- docs/index.md | 3 +-- docs/tutorials/walkthrough/step-10.md | 5 ++--- docs/tutorials/walkthrough/step-12.md | 5 ++--- docs/tutorials/walkthrough/step-6.md | 15 ++++++++------- docs/tutorials/walkthrough/step-7.md | 3 +-- docs/tutorials/walkthrough/step-9.md | 3 +-- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/docs/index.md b/docs/index.md index b92b4b12..7ebf14e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -293,8 +293,7 @@ CLASS zcl_app_invoices IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-10.md b/docs/tutorials/walkthrough/step-10.md index f670c41a..e697c491 100644 --- a/docs/tutorials/walkthrough/step-10.md +++ b/docs/tutorials/walkthrough/step-10.md @@ -76,7 +76,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. METHOD on_event. " get_event( ) holds the name passed to _event( ); - " get_event_arg( ) returns the extra argument attached via t_arg + " get_event_arg( ) returns the extra argument attached via arg CASE client->get_event( ). WHEN `READ`. data_read( ). @@ -177,8 +177,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-12.md b/docs/tutorials/walkthrough/step-12.md index 3ceef166..5d47768f 100644 --- a/docs/tutorials/walkthrough/step-12.md +++ b/docs/tutorials/walkthrough/step-12.md @@ -72,7 +72,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. METHOD on_event. " get_event( ) holds the name passed to _event( ); - " get_event_arg( ) returns the extra argument attached via t_arg + " get_event_arg( ) returns the extra argument attached via arg CASE client->get_event( ). WHEN `READ`. data_read( ). @@ -173,8 +173,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-6.md b/docs/tutorials/walkthrough/step-6.md index f87cdbad..5a54ea6f 100644 --- a/docs/tutorials/walkthrough/step-6.md +++ b/docs/tutorials/walkthrough/step-6.md @@ -59,8 +59,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->a( n = `description` v = `{SUPPLIER}` )->a( n = `info` v = `{QUANTITY}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( val = `SHOW_INVOICE` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `SHOW_INVOICE` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). @@ -80,11 +79,13 @@ ENDCLASS. - **`type = Active`** makes the whole row clickable and gives it press feedback; the `press` handler sits on the row template, so every row fires the same event. -- **The argument rides with the event:** - ``t_arg = VALUE #( ( `${PRODUCT}` ) )``. The `${...}` syntax is resolved - *per row* in the browser — each clone of the template carries its own - product name. On the server, `client->get_event_arg( )` returns it, and a - table read finds the row. +- **The argument rides with the event:** ``arg = `${PRODUCT}` ``. The + `${...}` syntax is resolved *per row* in the browser — each clone of the + template carries its own product name. On the server, + `client->get_event_arg( )` returns it, and a table read finds the row. + `arg` is the one-value spelling of `t_arg`: it is exactly + ``t_arg = VALUE #( ( `${PRODUCT}` ) )``, and from two values on `t_arg` is + the parameter to use. - **The state is still there.** `t_invoices` was filled in the `check_on_navigated` branch of an earlier roundtrip — the framework restored it before this one, so the event handler can read it. That is the diff --git a/docs/tutorials/walkthrough/step-7.md b/docs/tutorials/walkthrough/step-7.md index c41c92cb..3aa3883f 100644 --- a/docs/tutorials/walkthrough/step-7.md +++ b/docs/tutorials/walkthrough/step-7.md @@ -61,8 +61,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->a( n = `description` v = `{SUPPLIER}` )->a( n = `info` v = `{QUANTITY}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). diff --git a/docs/tutorials/walkthrough/step-9.md b/docs/tutorials/walkthrough/step-9.md index 7aaba909..893a4f66 100644 --- a/docs/tutorials/walkthrough/step-9.md +++ b/docs/tutorials/walkthrough/step-9.md @@ -96,8 +96,7 @@ CLASS zcl_app_walkthrough IMPLEMENTATION. )->tag( `Button` )->a( n = `icon` v = `sap-icon://edit` )->a( n = `tooltip` v = `Edit delivery date` - )->a( n = `press` v = client->_event( val = `EDIT` - t_arg = VALUE #( ( `${PRODUCT}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `EDIT` arg = `${PRODUCT}` ) ). client->view_display( view->stringify( ) ). From e2d18d46f2d6f67a422c995fd0eb43da9f4e9bfd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 15 Sep 2026 09:36:54 +0000 Subject: [PATCH 2/2] The event-argument pages send one value with arg The Backend page is where an event argument is introduced, so it taught the notation the rest of the site then copied: `t_arg = VALUE #( ( x ) )` for a single value, where `arg = x` is the same wire - the client folds it into the same string_table and `get_event_arg( )` reads it back unchanged. All four examples on the page (source, parameters, event object, model property) carry exactly one argument, and now say so; the comment lines between `val` and the argument keep their place, so the multi-line shape stays where it earns it. What the page loses by that - the table form itself - it gets back as a sentence: from two values on, `t_arg` is the parameter, in that order, read with `get_event_arg( 2 )` and up. Value help was the one remaining wire of that shape on the site, and fits on one line now. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JLUuftzubB7iRprxsDtVxD --- docs/cookbook/event_navigation/backend.md | 20 +++++++++++--------- docs/cookbook/expert_more/value_help.md | 4 +--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/cookbook/event_navigation/backend.md b/docs/cookbook/event_navigation/backend.md index b78b9316..e3c9289f 100644 --- a/docs/cookbook/event_navigation/backend.md +++ b/docs/cookbook/event_navigation/backend.md @@ -33,12 +33,14 @@ METHOD z2ui5_if_app~main. ENDMETHOD. ``` -If the backend needs more details about the event, use the `t_arg` parameter to add extra info. Three prefixes are available: +If the backend needs more details about the event, use the `arg` parameter to add extra info. Three prefixes are available: - **`$source`** — the UI5 control that fired the event (e.g., `${$source>/text}` returns the button text) - **`$parameters`** — the event parameters defined by the UI5 control (e.g., `${$parameters>/id}` returns the element ID) - **`$event`** — the UI5 event object itself (e.g., `$event>sId` returns the event type like `press`). Note: unlike the other two prefixes, `$event` is written without the `${...}` wrapper and without a leading `/` — see the [Event](#event) section below. +`arg` carries one value, which is what most events need. For two or more, use `t_arg` instead and pass them as a table — ``t_arg = VALUE #( ( `${$source>/text}` ) ( `${$parameters>/id}` ) )`` — and read them back in the same order with `client->get_event_arg( 2 )`, `( 3 )` and so on. The two are the same wire: `arg = x` is exactly ``t_arg = VALUE #( ( x ) )``. + For details, see the [UI5 docs on event handler arguments](https://openui5.hana.ondemand.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe) and sample `Z2UI5_CL_SMP_APP_167`. ## Source @@ -56,9 +58,9 @@ METHOD z2ui5_if_app~main. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads the button text → result: "post" - t_arg = VALUE #( ( `${$source>/text}` ) ) ) ). + arg = `${$source>/text}` ) ). client->view_display( view->stringify( ) ). @@ -85,9 +87,9 @@ METHOD z2ui5_if_app~main. )->a( n = `id` v = `button_id` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads the event parameter 'id' → result: "mainView--button_id" - t_arg = VALUE #( ( `${$parameters>/id}` ) ) ) ). + arg = `${$parameters>/id}` ) ). client->view_display( view->stringify( ) ). @@ -113,9 +115,9 @@ METHOD z2ui5_if_app~main. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` + val = `BUTTON_POST` " reads an event-object attribute → result: "press" - t_arg = VALUE #( ( `$event>sId` ) ) ) ). + arg = `$event>sId` ) ). client->view_display( view->stringify( ) ). @@ -157,8 +159,8 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION. )->tag( `Button` )->a( n = `text` v = `post` )->a( n = `press` v = client->_event( - val = `BUTTON_POST` - t_arg = VALUE #( ( `$` && client->_bind( name ) ) ) ) ). + val = `BUTTON_POST` + arg = `$` && client->_bind( name ) ) ). client->view_display( view->stringify( ) ). diff --git a/docs/cookbook/expert_more/value_help.md b/docs/cookbook/expert_more/value_help.md index 2778b992..79521f02 100644 --- a/docs/cookbook/expert_more/value_help.md +++ b/docs/cookbook/expert_more/value_help.md @@ -116,9 +116,7 @@ CLASS z2ui5_cl_sample_f4 IMPLEMENTATION. )->a( n = `title` v = `{CARRNAME}` )->a( n = `description` v = `{CARRID}` )->a( n = `type` v = `Active` - )->a( n = `press` v = client->_event( - val = `PICK` - t_arg = VALUE #( ( `${CARRID}` ) ) ) ). + )->a( n = `press` v = client->_event( val = `PICK` arg = `${CARRID}` ) ). client->popup_display( popup->stringify( ) ).