Skip to content

Commit a56d442

Browse files
authored
Update (#4)
* update * update * update * update * update
1 parent d66ffe9 commit a56d442

12 files changed

+1172
-145
lines changed

Diff for: src/01/z2ui5_cl_sample_variant_01.clas.abap

+73-20
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
END OF ty_s_tab.
1616
TYPES ty_t_table TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
1717

18-
DATA mt_table TYPE ty_t_table.
18+
DATA mv_tabname TYPE string.
19+
DATA mr_table TYPE REF TO data.
1920
DATA mt_filter TYPE z2ui5_cl_util=>ty_t_filter_multi.
2021

2122
PROTECTED SECTION.
@@ -36,6 +37,12 @@
3637

3738
METHOD on_event.
3839

40+
41+
IF sy-subrc <> 0.
42+
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
43+
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
44+
ENDIF.
45+
3946
CASE client->get( )-event.
4047

4148
WHEN 'LIST_OPEN'.
@@ -59,21 +66,59 @@
5966

6067
METHOD set_data.
6168

62-
mt_table = VALUE #(
63-
( product = 'table' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
64-
( product = 'chair' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
65-
( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
66-
( product = 'computer' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
67-
( product = 'oven' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
68-
( product = 'table2' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
69-
).
70-
71-
z2ui5_cl_util=>filter_itab(
72-
EXPORTING
73-
filter = mt_filter
74-
CHANGING
75-
val = mt_table
76-
).
69+
* DATA lt_range TYPE rs_t_rscedst.
70+
*
71+
* LOOP AT mt_filter INTO DATA(ls_filter).
72+
* LOOP AT ls_filter-t_range INTO DATA(ls_range).
73+
*
74+
* INSERT VALUE #(
75+
* fnam = ls_filter-name
76+
* sign = ls_range-sign
77+
* option = ls_range-option
78+
* low = ls_range-low
79+
* high = ls_range-high
80+
* ) INTO TABLE lt_range.
81+
*
82+
* ENDLOOP.
83+
* ENDLOOP.
84+
*
85+
* DATA lv_result TYPE string.
86+
** data lt_where type rsdmd_t_where.
87+
* CALL FUNCTION 'RSDS_RANGE_TO_WHERE'
88+
* EXPORTING
89+
* i_t_range = lt_range
90+
** i_th_range =
91+
** i_r_renderer =
92+
* IMPORTING
93+
* e_where = lv_result
94+
** e_t_where = lt_where
95+
** EXCEPTIONS
96+
** internal_error = 1
97+
** others = 2
98+
* .
99+
100+
101+
* select from (mv_tabname)
102+
* fields
103+
* *
104+
* where (lv_result)
105+
* into table @mr_table->*.
106+
107+
* mt_table = VALUE #(
108+
* ( product = 'table' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
109+
* ( product = 'chair' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
110+
* ( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
111+
* ( product = 'computer' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
112+
* ( product = 'oven' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
113+
* ( product = 'table2' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
114+
* ).
115+
116+
* z2ui5_cl_util=>filter_itab(
117+
* EXPORTING
118+
* filter = mt_filter
119+
* CHANGING
120+
* val = mt_table
121+
* ).
77122

78123
ENDMETHOD.
79124

@@ -88,7 +133,12 @@
88133
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
89134
).
90135

91-
DATA(vbox) = view->vbox( ).
136+
DATA(vbox) = view->vbox( )->input(
137+
value = client->_bind_edit( mv_tabname )
138+
description = `Tablename`
139+
).
140+
141+
vbox->button( text = `GO` press = client->_event( 'TAB' ) ).
92142

93143
DATA(lo_multiselect) = z2ui5add_cl_var_selscreen=>factory( mt_filter ).
94144

@@ -99,7 +149,7 @@
99149
).
100150

101151
DATA(tab) = vbox->table(
102-
items = client->_bind( val = mt_table )
152+
items = client->_bind( val = mr_table->* )
103153
)->header_toolbar(
104154
)->overflow_toolbar(
105155
)->toolbar_spacer(
@@ -132,8 +182,11 @@
132182

133183
IF mv_check_initialized = abap_false.
134184
mv_check_initialized = abap_true.
135-
mt_filter = z2ui5_cl_util=>filter_get_multi_by_data( mt_table ).
136-
DELETE mt_filter WHERE name = `SELKZ`.
185+
mv_tabname = `T100`.
186+
187+
CREATE DATA mr_table TYPE STANDARD TABLE OF (mv_tabname) WITH EMPTY KEY.
188+
mt_filter = z2ui5_cl_util=>filter_get_multi_by_data( mr_table->* ).
189+
* DELETE mt_filter WHERE name = `SELKZ`.
137190
view_display( ).
138191
RETURN.
139192
ENDIF.

Diff for: src/01/z2ui5_cl_sample_variant_01.clas.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<VSEOCLASS>
66
<CLSNAME>Z2UI5_CL_SAMPLE_VARIANT_01</CLSNAME>
77
<LANGU>E</LANGU>
8-
<DESCRIPT>popup - popop_get_range_multi without popup</DESCRIPT>
8+
<DESCRIPT>ranges on integrated</DESCRIPT>
99
<STATE>1</STATE>
1010
<CLSCCINCL>X</CLSCCINCL>
1111
<FIXPT>X</FIXPT>

Diff for: src/01/z2ui5_cl_sample_variant_02.clas.abap

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
CLASS z2ui5_cl_sample_variant_02 DEFINITION PUBLIC.
2+
3+
PUBLIC SECTION.
4+
5+
INTERFACES z2ui5_if_app.
6+
7+
TYPES:
8+
BEGIN OF ty_s_tab,
9+
selkz TYPE abap_bool,
10+
product TYPE string,
11+
create_date TYPE string,
12+
create_by TYPE string,
13+
storage_location TYPE string,
14+
quantity TYPE i,
15+
END OF ty_s_tab.
16+
TYPES ty_t_table TYPE STANDARD TABLE OF ty_s_tab WITH EMPTY KEY.
17+
18+
DATA mt_table TYPE ty_t_table.
19+
DATA mt_filter TYPE z2ui5_cl_util=>ty_t_filter_multi.
20+
21+
PROTECTED SECTION.
22+
DATA client TYPE REF TO z2ui5_if_client.
23+
DATA mv_check_initialized TYPE abap_bool.
24+
METHODS on_event.
25+
METHODS view_display.
26+
METHODS set_data.
27+
28+
PRIVATE SECTION.
29+
ENDCLASS.
30+
31+
32+
CLASS z2ui5_cl_sample_variant_02 IMPLEMENTATION.
33+
34+
35+
METHOD on_event.
36+
37+
CASE client->get( )-event.
38+
WHEN `BUTTON_START`.
39+
set_data( ).
40+
client->view_model_update( ).
41+
WHEN `PREVIEW_FILTER`.
42+
client->nav_app_call( z2ui5add_cl_var_pop_ranges=>factory( mt_filter ) ).
43+
WHEN 'BACK'.
44+
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
45+
ENDCASE.
46+
47+
ENDMETHOD.
48+
49+
50+
METHOD set_data.
51+
52+
mt_table = VALUE #(
53+
( product = 'table' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
54+
( product = 'chair' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
55+
( product = 'sofa' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
56+
( product = 'computer' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
57+
( product = 'oven' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 )
58+
( product = 'table2' create_date = `01.01.2023` create_by = `Peter` storage_location = `AREA_001` quantity = 400 ) ).
59+
60+
z2ui5_cl_util=>filter_itab(
61+
EXPORTING
62+
filter = mt_filter
63+
CHANGING
64+
val = mt_table ).
65+
66+
ENDMETHOD.
67+
68+
69+
METHOD view_display.
70+
71+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
72+
73+
view = view->shell( )->page( id = `page_main`
74+
title = 'abap2UI5 - Select-Options'
75+
navbuttonpress = client->_event( 'BACK' )
76+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
77+
).
78+
79+
DATA(vbox) = view->vbox( ).
80+
81+
DATA(tab) = vbox->table(
82+
items = client->_bind( val = mt_table )
83+
)->header_toolbar(
84+
)->overflow_toolbar(
85+
)->toolbar_spacer(
86+
)->button( text = `Filter` press = client->_event( `PREVIEW_FILTER` ) icon = `sap-icon://filter`
87+
)->button( text = `Go` press = client->_event( `BUTTON_START` ) type = `Emphasized`
88+
)->get_parent( )->get_parent( ).
89+
90+
DATA(lo_columns) = tab->columns( ).
91+
lo_columns->column( )->text( text = `Product` ).
92+
lo_columns->column( )->text( text = `Date` ).
93+
lo_columns->column( )->text( text = `Name` ).
94+
lo_columns->column( )->text( text = `Location` ).
95+
lo_columns->column( )->text( text = `Quantity` ).
96+
97+
DATA(lo_cells) = tab->items( )->column_list_item( ).
98+
lo_cells->text( `{PRODUCT}` ).
99+
lo_cells->text( `{CREATE_DATE}` ).
100+
lo_cells->text( `{CREATE_BY}` ).
101+
lo_cells->text( `{STORAGE_LOCATION}` ).
102+
lo_cells->text( `{QUANTITY}` ).
103+
104+
client->view_display( view->stringify( ) ).
105+
106+
ENDMETHOD.
107+
108+
109+
METHOD z2ui5_if_app~main.
110+
111+
me->client = client.
112+
113+
IF mv_check_initialized = abap_false.
114+
mv_check_initialized = abap_true.
115+
mt_filter = z2ui5_cl_util=>filter_get_multi_by_data( mt_table ).
116+
DELETE mt_filter WHERE name = `SELKZ`.
117+
view_display( ).
118+
RETURN.
119+
ENDIF.
120+
121+
IF client->get( )-check_on_navigated = abap_true.
122+
TRY.
123+
DATA(lo_value_help) = CAST z2ui5add_cl_var_pop_ranges( client->get_app( client->get( )-s_draft-id_prev_app ) ).
124+
IF lo_value_help->result( )-check_confirmed = abap_true.
125+
mt_filter = lo_value_help->result( )-t_filter.
126+
set_data( ).
127+
client->view_model_update( ).
128+
ENDIF.
129+
CATCH cx_root.
130+
ENDTRY.
131+
RETURN.
132+
ENDIF.
133+
134+
IF client->get( )-event IS NOT INITIAL.
135+
on_event( ).
136+
ENDIF.
137+
138+
ENDMETHOD.
139+
ENDCLASS.

Diff for: src/01/z2ui5_cl_sample_variant_02.clas.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>Z2UI5_CL_SAMPLE_VARIANT_02</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>popup - ranges with save</DESCRIPT>
9+
<STATE>1</STATE>
10+
<CLSCCINCL>X</CLSCCINCL>
11+
<FIXPT>X</FIXPT>
12+
<UNICODE>X</UNICODE>
13+
</VSEOCLASS>
14+
</asx:values>
15+
</asx:abap>
16+
</abapGit>

0 commit comments

Comments
 (0)