Skip to content

Commit 6f88fbd

Browse files
authored
Update tables.md
1 parent b11e8fe commit 6f88fbd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/development/model/tables.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,47 @@ CLASS z2ui5_cl_sample_tree IMPLEMENTATION.
145145
ENDMETHOD.
146146
ENDCLASS.
147147
```
148+
149+
### Nested Structures
150+
It is alsp possible to bind nested structure, just use `struc/component` in the binding, as follows:
151+
```abap
152+
CLASS z2ui5_cl_sample_nested_structures DEFINITION PUBLIC.
153+
PUBLIC SECTION.
154+
INTERFACES z2ui5_if_app.
155+
ENDCLASS.
156+
157+
CLASS z2ui5_cl_sample_nested_structures IMPLEMENTATION.
158+
METHOD z2ui5_if_app~main.
159+
160+
TYPES:
161+
BEGIN OF ty_s_tab,
162+
product TYPE string,
163+
BEGIN OF s_details,
164+
create_date TYPE string,
165+
create_by TYPE string,
166+
END OF s_details,
167+
END OF ty_s_tab.
168+
DATA mt_itab TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
169+
170+
mt_itab = VALUE #(
171+
( product = 'table' s_details = VALUE #( create_date = `01.01.2023` create_by = `Peter` ) )
172+
( product = 'chair' s_details = VALUE #( create_date = `25.10.2022` create_by = `Frank` ) )
173+
( product = 'sofa' s_details = VALUE #( create_date = `12.03.2024` create_by = `George` ) ) ).
174+
175+
DATA(tab) = z2ui5_cl_xml_view=>factory( )->table( client->_bind_local( mt_itab ) ).
176+
177+
DATA(lo_columns) = tab->columns( ).
178+
lo_columns->column( )->text( text = `Product` ).
179+
lo_columns->column( )->text( text = `Created at` ).
180+
lo_columns->column( )->text( text = `By` ).
181+
182+
DATA(lo_cells) = tab->items( )->column_list_item( ).
183+
lo_cells->text( `{PRODUCT}` ).
184+
lo_cells->text( `{S_DETAILS/CREATE_DATE}` ).
185+
lo_cells->text( `{S_DETAILS/CREATE_BY}` ).
186+
187+
client->view_display( tab ).
188+
189+
ENDMETHOD.
190+
ENDCLASS.
191+
```

0 commit comments

Comments
 (0)