Skip to content

Commit 41615bc

Browse files
authored
Update odata.md
1 parent cd24c95 commit 41615bc

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

docs/development/model/odata.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ METHOD z2ui5_if_app~main.
5555
)->text( '{FLIGHT>Name}'
5656
)->text( '{FLIGHT>City}'
5757
)->text( '{FLIGHT>CountryCode}' ).
58-
58+
59+
client->view_display( tab->stringify( ) ).
60+
5961
client->follow_up_action( client->_event_client(
6062
val = z2ui5_if_client=>cs_event-set_odata_model
6163
t_arg = value #(
@@ -84,6 +86,8 @@ tab->items( )->column_list_item( )->cells(
8486
)->text( '{TRAVEL>BookingSupplementID}'
8587
)->text( '{TRAVEL>SupplementID}' ).
8688
89+
client->view_display( tab->stringify( ) ).
90+
8791
client->follow_up_action( client->_event_client(
8892
val = z2ui5_if_client=>cs_event-set_odata_model
8993
t_arg = value #(
@@ -109,25 +113,29 @@ In SAP contexts, OData services are often enriched with additional annotations.
109113
```
110114
We can use these SAP annotations in our UI5 view to utilize backend translations via the property `label`. Here’s an example:
111115
```abap
112-
data(tab) = page->table(
113-
items = `{TRAVEL>/Currency}`
114-
growing = abap_true ).
115116
116-
tab->header_toolbar( )->toolbar(
117-
)->title( 'table with OData model TRAVEL' ).
117+
data(tab) = page->table(
118+
items = `{TRAVEL>/Currency}`
119+
growing = abap_true ).
118120
119-
tab->columns(
120-
)->column( )->text( '{TRAVEL>/#Currency/Currency/@sap:label}' )->get_parent(
121-
)->column( )->text( '{TRAVEL>/#Currency/Currency_Text/@sap:label}' )->get_parent(
122-
)->column( )->text( '{TRAVEL>/#Currency/Decimals/@sap:label}' )->get_parent(
123-
)->column( )->text( '{TRAVEL>/#Currency/CurrencyISOCode/@sap:label}' )->get_parent(
124-
).
121+
tab->columns(
122+
)->column( )->text( '{TRAVEL>/#Currency/Currency/@sap:label}' )->get_parent(
123+
)->column( )->text( '{TRAVEL>/#Currency/Currency_Text/@sap:label}' )->get_parent(
124+
)->column( )->text( '{TRAVEL>/#Currency/Decimals/@sap:label}' )->get_parent(
125+
)->column( )->text( '{TRAVEL>/#Currency/CurrencyISOCode/@sap:label}' ).
125126
126-
tab->items( )->column_list_item( )->cells(
127-
)->text( '{TRAVEL>Currency}'
128-
)->text( '{TRAVEL>Currency_Text}'
129-
)->text( '{TRAVEL>Decimals}'
130-
)->text( '{TRAVEL>CurrencyISOCode}'
131-
).
127+
tab->items( )->column_list_item( )->cells(
128+
)->text( '{TRAVEL>Currency}'
129+
)->text( '{TRAVEL>Currency_Text}'
130+
)->text( '{TRAVEL>Decimals}'
131+
)->text( '{TRAVEL>CurrencyISOCode}' ).
132+
133+
client->view_display( tab->stringify( ) ).
134+
135+
client->follow_up_action( client->_event_client(
136+
val = z2ui5_if_client=>cs_event-set_odata_model
137+
t_arg = value #(
138+
( `/sap/opu/odata/DMO/API_TRAVEL_U_V2/` )
139+
( `TRAVEL` ) ) ) ).
132140
```
133-
The column titles are now automatically set with the correct title in the user’s language.
141+
The column titles are now automatically set with the correct title in the user’s language.

0 commit comments

Comments
 (0)