|
| 1 | +CLASS z2ui5_cl_demo_app_160 DEFINITION |
| 2 | + PUBLIC |
| 3 | + FINAL |
| 4 | + CREATE PUBLIC . |
| 5 | + |
| 6 | + PUBLIC SECTION. |
| 7 | + |
| 8 | + INTERFACES z2ui5_if_app . |
| 9 | + |
| 10 | + TYPES: |
| 11 | + BEGIN OF s_output, |
| 12 | + index TYPE i, |
| 13 | + set_sk TYPE c LENGTH 10, |
| 14 | + matnr TYPE matnr, |
| 15 | + description TYPE c LENGTH 50, |
| 16 | + is_total TYPE i, |
| 17 | + pl_total TYPE i, |
| 18 | + %_total TYPE p LENGTH 2 DECIMALS 1, |
| 19 | + is_01_prev TYPE i, |
| 20 | + pl_01 TYPE i, |
| 21 | + %_01 TYPE p LENGTH 2 DECIMALS 1, |
| 22 | + is_02_prev TYPE i, |
| 23 | + pl_02 TYPE i, |
| 24 | + %_02 TYPE p LENGTH 2 DECIMALS 1, |
| 25 | + is_03_prev TYPE i, |
| 26 | + pl_03 TYPE i, |
| 27 | + %_03 TYPE p LENGTH 2 DECIMALS 1, |
| 28 | + is_q01_prev TYPE i, |
| 29 | + pl_q01 TYPE i, |
| 30 | + %_q01 TYPE p LENGTH 2 DECIMALS 1, |
| 31 | + is_q02_prev TYPE i, |
| 32 | + pl_q02 TYPE i, |
| 33 | + %_q02 TYPE p LENGTH 2 DECIMALS 1, |
| 34 | + is_q03_prev TYPE i, |
| 35 | + pl_q03 TYPE i, |
| 36 | + %_q03 TYPE p LENGTH 2 DECIMALS 1, |
| 37 | + is_q04_prev TYPE i, |
| 38 | + pl_q04 TYPE i, |
| 39 | + %_q04 TYPE p LENGTH 2 DECIMALS 1, |
| 40 | + END OF s_output . |
| 41 | + |
| 42 | + DATA check_initialized TYPE abap_bool . |
| 43 | + DATA mt_output TYPE STANDARD TABLE OF s_output. |
| 44 | + DATA client TYPE REF TO z2ui5_if_client. |
| 45 | + |
| 46 | + PROTECTED SECTION. |
| 47 | + |
| 48 | + METHODS load_output_table . |
| 49 | + METHODS on_event. |
| 50 | + METHODS render_main_screen. |
| 51 | + |
| 52 | + PRIVATE SECTION. |
| 53 | +ENDCLASS. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +CLASS z2ui5_cl_demo_app_160 IMPLEMENTATION. |
| 58 | + |
| 59 | + |
| 60 | + METHOD load_output_table. |
| 61 | + |
| 62 | + DATA ls_output TYPE s_output. |
| 63 | + CLEAR mt_output. |
| 64 | + |
| 65 | + DO 10 TIMES. |
| 66 | + ls_output-index = sy-index. |
| 67 | + ls_output-set_sk = 'Test'. |
| 68 | + ls_output-matnr = '1234567'. |
| 69 | + ls_output-description = 'Test'. |
| 70 | + |
| 71 | + APPEND ls_output TO mt_output. |
| 72 | + |
| 73 | + ENDDO. |
| 74 | + |
| 75 | + ENDMETHOD. |
| 76 | + |
| 77 | + |
| 78 | + METHOD on_event. |
| 79 | + |
| 80 | + DATA: lt_event_arguments TYPE string_table. |
| 81 | + |
| 82 | + CASE client->get( )-event. |
| 83 | + |
| 84 | + WHEN 'PL_TOTAL_CHANGE'. |
| 85 | + |
| 86 | + lt_event_arguments = client->get( )-t_event_arg. |
| 87 | + DATA(lv_id_event) = lt_event_arguments[ 1 ]. |
| 88 | + |
| 89 | + DATA(lv_tab_index) = lt_event_arguments[ 2 ]. |
| 90 | + DATA(ls_row_submit) = mt_output[ lv_tab_index ]. |
| 91 | + |
| 92 | + DATA(lv_id_parent) = lt_event_arguments[ 3 ]. |
| 93 | + |
| 94 | + client->message_box_display( lv_tab_index && lv_id_event && lv_id_parent ). |
| 95 | + |
| 96 | + ENDCASE. |
| 97 | + |
| 98 | + client->view_model_update( ). |
| 99 | + |
| 100 | + ENDMETHOD. |
| 101 | + |
| 102 | + |
| 103 | + METHOD render_main_screen. |
| 104 | + |
| 105 | + DATA(view) = z2ui5_cl_xml_view=>factory( ). |
| 106 | + DATA(page) = view->page( title = 'Test App' enablescrolling = abap_false class = 'sapUiResponsivePadding--header sapUiResponsivePadding--content sapUiResponsivePadding--footer' ). |
| 107 | + DATA(table) = page->flex_box( height = '85vh' )->ui_table( alternaterowcolors = 'true' visiblerowcountmode = 'Auto' fixedrowcount = '1' selectionmode = 'None' rows = client->_bind_edit( mt_output ) ). |
| 108 | + DATA(columns) = table->ui_columns( ). |
| 109 | + |
| 110 | + columns->ui_column( width = '5.2rem' sortproperty = 'SET_SK' filterproperty = 'SET_SK' )->text( text = 'Column 1' )->ui_template( )->text( text = `{SET_SK}` ). |
| 111 | + columns->ui_column( width = '5rem' sortproperty = 'MATNR' filterproperty = 'MATNR' )->text( text = 'Column 2' )->ui_template( )->text( text = `{MATNR}` ). |
| 112 | + columns->ui_column( width = '20rem' sortproperty = 'DESCRIPTION' filterproperty = 'DESCRIPTION' )->text( text = 'Column 3' )->ui_template( )->text( text = `{DESCRIPTION}` ). |
| 113 | + columns->ui_column( width = '5rem' sortproperty = 'IS_TOTAL' filterproperty = 'IS_TOTAL' )->text( text = 'Column 4' )->ui_template( )->text( text = `{IS_TOTAL}` ). |
| 114 | + |
| 115 | + columns->ui_column( width = '5rem' sortproperty = 'PL_TOTAL' filterproperty = 'PL_TOTAL' )->text( text = 'Column 5' )->ui_template( )->input( |
| 116 | + value = `{PL_TOTAL}` submit = client->_event( val = 'PL_TOTAL_CHANGE' t_arg = VALUE #( |
| 117 | + ( `${$source>/id}` ) |
| 118 | + ( `${INDEX}` ) |
| 119 | +* ( `$source.oParent.sId` ) |
| 120 | + ( `$event.oSource.oParent.sId` ) |
| 121 | + ) ) editable = abap_true type = 'Number' ). |
| 122 | + |
| 123 | + columns->ui_column( width = '4rem' sortproperty = '%_TOTAL' filterproperty = '%_TOTAL' )->text( text = 'Column 6' )->ui_template( )->text( text = `{%_TOTAL} %` ). |
| 124 | + |
| 125 | + columns->ui_column( width = '5rem' sortproperty = 'IS_01_PREV' filterproperty = 'IS_01_PREV' )->text( text = 'Column 7' )->ui_template( )->text( text = `{IS_01_PREV}` ). |
| 126 | + columns->ui_column( width = '5rem' sortproperty = 'PL_01' filterproperty = 'PL_01' )->text( text = 'Column 8' )->ui_template( )->input( value = `{PL_01}` editable = abap_true type = 'Number' ). |
| 127 | + columns->ui_column( width = '4rem' sortproperty = '%_01' filterproperty = '%_01' )->text( text = 'Column 9' )->ui_template( )->text( text = `{%_01} %` ). |
| 128 | + |
| 129 | + columns->ui_column( width = '5rem' sortproperty = 'IS_02_PREV' filterproperty = 'IS_02_PREV' )->text( text = 'Column 10' )->ui_template( )->text( text = `{IS_02_PREV}` ). |
| 130 | + columns->ui_column( width = '5rem' sortproperty = 'PL_02' filterproperty = 'PL_02' )->text( text = 'Column 11' )->ui_template( )->input( value = `{PL_02}` editable = abap_true type = 'Number' ). |
| 131 | + columns->ui_column( width = '4rem' sortproperty = '%_02' filterproperty = '%_02' )->text( text = 'Column 12' )->ui_template( )->text( text = `{%_02} %` ). |
| 132 | + |
| 133 | + columns->ui_column( width = '5rem' sortproperty = 'IS_03_PREV' filterproperty = 'IS_03_PREV' )->text( text = 'Column 13' )->ui_template( )->text( text = `{IS_03_PREV}` ). |
| 134 | + columns->ui_column( width = '5rem' sortproperty = 'PL_03' filterproperty = 'PL_03' )->text( text = 'Column 14' )->ui_template( )->input( value = `{PL_03}` editable = abap_true type = 'Number' ). |
| 135 | + columns->ui_column( width = '4rem' sortproperty = '%_03' filterproperty = '%_03' )->text( text = 'Column 15' )->ui_template( )->text( text = `{%_03} %` ). |
| 136 | + |
| 137 | + columns->ui_column( width = '5rem' sortproperty = 'IS_Q01_PREV' filterproperty = 'IS_Q01_PREV' )->text( text = 'Column 16' )->ui_template( )->text( text = `{IS_Q01_PREV}` ). |
| 138 | + columns->ui_column( width = '5rem' sortproperty = 'PL_Q01' filterproperty = 'PL_Q01' )->text( text = 'Column 17' )->ui_template( )->text( text = `{PL_Q01}` ). "Nicht editierbar, da im Detail geplant |
| 139 | + columns->ui_column( width = '4rem' sortproperty = '%_Q01' filterproperty = '%_Q01' )->text( text = 'Column 18' )->ui_template( )->text( text = `{%_Q01} %` ). |
| 140 | + |
| 141 | + columns->ui_column( width = '5rem' sortproperty = 'IS_Q02_PREV' filterproperty = 'IS_Q02_PREV' )->text( text = 'Column 19' )->ui_template( )->text( text = `{IS_Q02_PREV}` ). |
| 142 | + columns->ui_column( width = '5rem' sortproperty = 'PL_Q02' filterproperty = 'PL_Q02' )->text( text = 'Column 20' )->ui_template( )->input( value = `{PL_Q02}` editable = abap_true type = 'Number' ). |
| 143 | + columns->ui_column( width = '4rem' sortproperty = '%_Q02' filterproperty = '%_Q02' )->text( text = 'Column 21' )->ui_template( )->text( text = `{%_Q02} %` ). |
| 144 | + |
| 145 | + columns->ui_column( width = '5rem' sortproperty = 'IS_Q03_PREV' filterproperty = 'IS_Q03_PREV' )->text( text = 'Column 22' )->ui_template( )->text( text = `{IS_Q03_PREV}` ). |
| 146 | + columns->ui_column( width = '5rem' sortproperty = 'PL_Q03' filterproperty = 'PL_Q03' )->text( text = 'Column 23' )->ui_template( )->input( value = `{PL_Q03}` editable = abap_true type = 'Number' ). |
| 147 | + columns->ui_column( width = '4rem' sortproperty = '%_Q03' filterproperty = '%_Q03' )->text( text = 'Column 24' )->ui_template( )->text( text = `{%_Q03} %` ). |
| 148 | + |
| 149 | + columns->ui_column( width = '5rem' sortproperty = 'IS_Q04_PREV' filterproperty = 'IS_Q04_PREV' )->text( text = 'Column 25' )->ui_template( )->text( text = `{IS_Q04_PREV}` ). |
| 150 | + columns->ui_column( width = '5rem' sortproperty = 'PL_Q04' filterproperty = 'PL_Q04' )->text( text = 'Column 26' )->ui_template( )->input( value = `{PL_Q04}` editable = abap_true type = 'Number' ). |
| 151 | + columns->ui_column( width = '4rem' sortproperty = '%_Q04' filterproperty = '%_Q04' )->text( text = 'Column 27' )->ui_template( )->text( text = `{%_Q04} %` ). |
| 152 | + |
| 153 | + client->view_display( view->stringify( ) ). |
| 154 | + |
| 155 | + ENDMETHOD. |
| 156 | + |
| 157 | + METHOD z2ui5_if_app~main. |
| 158 | + |
| 159 | + me->client = client. |
| 160 | + |
| 161 | + IF check_initialized = abap_false. |
| 162 | + check_initialized = abap_true. |
| 163 | + |
| 164 | + load_output_table( ). |
| 165 | + render_main_screen( ). |
| 166 | + RETURN. |
| 167 | + ENDIF. |
| 168 | + |
| 169 | + on_event( ). |
| 170 | + |
| 171 | + ENDMETHOD. |
| 172 | +ENDCLASS. |
0 commit comments