Skip to content

Commit 5832a79

Browse files
authored
update (#1)
1 parent e65622b commit 5832a79

9 files changed

+764
-86
lines changed

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"homepage": "https://github.com/oblomov-dev/abap2UI5#readme",
2222
"devDependencies": {
2323
"@abaplint/cli": "^2.97.17",
24-
"@abaplint/runtime": "^2.6.32",
24+
"@abaplint/runtime": "^2.6.35",
2525
"@abaplint/database-sqlite": "^2.6.0",
2626
"express": "^4.18.2",
27-
"@abaplint/transpiler-cli": "^2.6.32"
27+
"@abaplint/transpiler-cli": "^2.6.35"
2828
}
2929
}

src/00/z2ui5_cl_app_demo_35.clas.abap

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ CLASS z2ui5_cl_app_demo_35 DEFINITION PUBLIC.
44

55
INTERFACES z2ui5_if_app.
66

7-
DATA mt_draft TYPE REF TO data.
8-
DATA mv_test TYPE REF TO data.
7+
DATA mt_table TYPE REF TO data.
8+
DATA mv_name TYPE string.
99

1010
PROTECTED SECTION.
1111

@@ -29,7 +29,7 @@ ENDCLASS.
2929

3030

3131

32-
CLASS Z2UI5_CL_APP_DEMO_35 IMPLEMENTATION.
32+
CLASS z2ui5_cl_app_demo_35 IMPLEMENTATION.
3333

3434

3535
METHOD z2ui5_if_app~main.
@@ -61,14 +61,21 @@ CLASS Z2UI5_CL_APP_DEMO_35 IMPLEMENTATION.
6161
CASE app-get-event.
6262

6363
WHEN 'BUTTON_POST'.
64-
* client->popup_message_toast( |{ product } { quantity } - send to the server| ).
65-
app-view_popup = 'POPUP_CONFIRM'.
64+
65+
CREATE DATA mt_table TYPE STANDARD TABLE OF (mv_name).
66+
FIELD-SYMBOLS <tab> TYPE table.
67+
ASSIGN mt_table->* TO <tab>.
68+
69+
SELECT FROM (mv_name)
70+
FIELDS *
71+
INTO CORRESPONDING FIELDS OF TABLE @<tab>
72+
UP TO 100 ROWS.
73+
6674

6775
WHEN 'BUTTON_CONFIRM'.
6876
client->popup_message_toast( |confirm| ).
6977
app-view_popup = ''.
7078

71-
7279
WHEN 'BUTTON_CANCEL'.
7380
client->popup_message_toast( |cancel| ).
7481
app-view_popup = ''.
@@ -84,75 +91,56 @@ CLASS Z2UI5_CL_APP_DEMO_35 IMPLEMENTATION.
8491
METHOD z2ui5_on_init.
8592

8693
app-view_main = 'VIEW_MAIN'.
87-
88-
CREATE DATA mv_test TYPE string.
89-
FIELD-SYMBOLS <field> type string.
90-
assign mv_test->* to <field>.
91-
<field> = 'test'.
92-
93-
CREATE DATA mt_draft TYPE STANDARD TABLE OF z2ui5_t_draft.
94-
95-
SELECT FROM z2ui5_t_draft
96-
FIELDS *
97-
ORDER BY uuid
98-
INTO TABLE @DATA(lt_data)
99-
UP TO 10 ROWS
100-
.
101-
102-
types ty_t_draft type STANDARD TABLE OF z2ui5_t_draft.
103-
FIELD-SYMBOLS <tab> TYPE ty_t_draft.
104-
105-
assign mt_draft->* to <tab>.
106-
<tab> = lt_data.
94+
mv_name = `Z2UI5_T_DRAFT`.
10795

10896
ENDMETHOD.
10997

11098

11199
METHOD z2ui5_on_render.
112100

113-
DATA(lo_view) = Z2UI5_CL_XML_VIEW=>factory( )->shell( )->page(
114-
title = 'abap2UI5 - First Example'
101+
DATA(lo_view) = z2ui5_cl_xml_view=>factory( )->shell( )->page(
102+
title = 'abap2UI5 - Change the table type with RTTI'
115103
navbuttonpress = client->_event( 'BACK' )
116104
shownavbutton = abap_true
117105
)->header_content(
118106
)->link(
119107
text = 'Source_Code' target = '_blank'
120-
href = Z2UI5_CL_XML_VIEW=>hlp_get_source_code_url( app = me get = client->get( ) )
108+
href = z2ui5_cl_xml_view=>hlp_get_source_code_url( app = me get = client->get( ) )
121109
)->get_parent(
122-
)->simple_form( title = 'Form Title' editable = abap_true
123-
)->content( 'form'
124-
)->title( 'Input'
125-
)->label( 'quantity' ).
110+
)->simple_form( title = 'SE16' editable = abap_true
111+
)->content( `form`
112+
)->title( 'Table'
113+
)->label( 'Name' ).
126114

127-
128-
FIELD-SYMBOLS <field> type string.
129-
ASSIGN mv_test->* to <field>.
130-
131-
lo_view->input( client->_bind( val = <field> check_gen_data = abap_true ) ).
115+
lo_view->input( client->_bind( mv_name ) ).
132116

133117
lo_view->button(
134-
text = 'post'
118+
text = 'search'
135119
press = client->_event( 'BUTTON_POST' )
136120
).
137121

138-
FIELD-SYMBOLS <tab> type STANDARD TABLE.
139-
assign mt_draft->* to <tab>.
140-
DATA(tab) = lo_view->get_parent( )->get_parent( )->simple_form( title = 'Table' editable = abap_true
141-
)->content( 'form' )->table(
142-
items = client->_bind( val = <tab> check_gen_data = abap_true )
143-
).
122+
IF mt_table IS BOUND.
123+
124+
FIELD-SYMBOLS <tab> TYPE STANDARD TABLE.
125+
ASSIGN mt_table->* TO <tab>.
126+
DATA(tab) = lo_view->get_parent( )->get_parent( )->simple_form( title = 'Table' editable = abap_true
127+
)->content( 'form' )->table(
128+
items = client->_bind( val = <tab> check_gen_data = abap_true )
129+
).
144130

145-
tab->columns(
146-
)->column(
147-
)->text( 'UUID' )->get_parent(
148-
)->column(
149-
)->text( 'UUID_PREV' ).
150-
151-
tab->items( )->column_list_item(
152-
)->cells(
153-
)->input( '{UUID}'
154-
)->input( '{UUID_PREV}'
155-
).
131+
DATA(lt_fields) = lcl_db=>get_fieldlist_by_table( <tab> ).
132+
133+
DATA(lo_columns) = tab->columns( ).
134+
LOOP AT lt_fields INTO DATA(lv_field) FROM 2.
135+
lo_columns->column( )->text( lv_field ).
136+
ENDLOOP.
137+
138+
DATA(lo_cells) = tab->items( )->column_list_item( selected = '{SELKZ}' )->cells( ).
139+
LOOP AT lt_fields INTO lv_field FROM 2.
140+
lo_cells->input( `{` && lv_field && `}` ).
141+
ENDLOOP.
142+
143+
ENDIF.
156144

157145
app-next-xml_main = lo_view->get_root( )->xml_get( ).
158146

0 commit comments

Comments
 (0)