Вертикальный Toolbar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
CLASS lcl_events DEFINITION. PUBLIC SECTION. CLASS-METHODS: on_clicked FOR EVENT clicked OF cl_gui_container_bar_xt IMPORTING id container sender. CLASS-METHODS: on_empty FOR EVENT empty OF cl_gui_container_bar_xt IMPORTING sender. CLASS-METHODS: on_closed FOR EVENT closed OF cl_gui_container_bar_xt IMPORTING id sender. ENDCLASS. CLASS lcl_events IMPLEMENTATION. METHOD on_clicked. MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'. ENDMETHOD. METHOD on_empty. BREAK-POINT. ENDMETHOD. METHOD on_closed. BREAK-POINT. ENDMETHOD. ENDCLASS. INITIALIZATION. TRY. DATA(o_splitter) = NEW cl_gui_splitter_container( parent = cl_gui_container=>default_screen no_autodef_progid_dynnr = abap_true rows = 1 columns = 2 ). o_splitter->set_column_width( id = 1 width = 10 ). DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ). DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ). DATA(it_captions) = VALUE sbptcaptns( ( caption = 'ABAP' icon = icon_abap no_close = abap_false name = 'CAP1' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ( caption = 'ABC' icon = icon_abc no_close = abap_false name = 'CAP2' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ). DATA(o_toolbar_xt) = NEW cl_gui_container_bar_xt( active_id = 1 " Nr. des aktiven Eintrages parent = o_container_left " Einbettung in linken Container captions = it_captions " Einträge style = cl_gui_container_bar_xt=>c_style_fix " Style: Fix = Feste Anordnung, Outlook = Anordnung klappt close_buttons = abap_true ). " Schließen Kreuze anzeigen DATA(lv_caption) = VALUE sbptcaptn( caption = 'Activate' icon = icon_activate no_close = abap_false name = 'CAP3' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ). DATA(lv_id) = 0. o_toolbar_xt->add_cell( EXPORTING caption = lv_caption CHANGING id = lv_id ). DATA(o_cont) = o_toolbar_xt->get_container( id = lv_id ). o_toolbar_xt->set_active( id = lv_id ). SET HANDLER lcl_events=>on_clicked FOR o_toolbar_xt. SET HANDLER lcl_events=>on_empty FOR o_toolbar_xt. SET HANDLER lcl_events=>on_closed FOR o_toolbar_xt. DATA: it_sflight TYPE STANDARD TABLE OF sflight. SELECT * FROM sflight INTO TABLE @it_sflight. DATA: o_salv TYPE REF TO cl_salv_table. cl_salv_table=>factory( EXPORTING r_container = o_container_right IMPORTING r_salv_table = o_salv CHANGING t_table = it_sflight ). o_salv->get_functions( )->set_all( ). o_salv->display( ). cl_abap_list_layout=>suppress_toolbar( ). WRITE: space. CATCH cx_root INTO DATA(e_txt). ENDTRY. |
Второй вариант:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
CLASS lcl_events DEFINITION. PUBLIC SECTION. CLASS-METHODS: on_clicked FOR EVENT clicked OF cl_gui_container_bar_2 IMPORTING id container sender. CLASS-METHODS: on_empty FOR EVENT empty OF cl_gui_container_bar_2 IMPORTING sender. CLASS-METHODS: on_closed FOR EVENT closed OF cl_gui_container_bar_2 IMPORTING id sender. ENDCLASS. CLASS lcl_events IMPLEMENTATION. METHOD on_clicked. MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'. ENDMETHOD. METHOD on_empty. BREAK-POINT. ENDMETHOD. METHOD on_closed. BREAK-POINT. ENDMETHOD. ENDCLASS. INITIALIZATION. TRY. DATA(o_splitter) = NEW cl_gui_splitter_container( parent = cl_gui_container=>default_screen no_autodef_progid_dynnr = abap_true rows = 1 columns = 2 ). o_splitter->set_column_width( id = 1 width = 10 ). DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ). DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ). DATA(it_captions) = VALUE sbptcaptns( ( caption = 'ABAP' icon = icon_abap no_close = abap_false name = 'CAP1' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ( caption = 'ABC' icon = icon_abc no_close = abap_false name = 'CAP2' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ). DATA(o_toolbar) = NEW cl_gui_container_bar_2( active_id = 1 " parent = o_container_left " captions = it_captions " style = cl_gui_container_bar_2=>c_style_tile " close_buttons = abap_false ). " DATA(lv_caption) = VALUE sbptcaptn( caption = 'Activate' icon = icon_activate no_close = abap_false name = 'CAP3' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ). DATA(lv_id) = 0. o_toolbar->add_cell( EXPORTING caption = lv_caption CHANGING id = lv_id ). DATA(o_cont) = o_toolbar->get_container( id = lv_id ). o_toolbar->set_active( id = lv_id ). SET HANDLER lcl_events=>on_clicked FOR o_toolbar. SET HANDLER lcl_events=>on_empty FOR o_toolbar. SET HANDLER lcl_events=>on_closed FOR o_toolbar. DATA: it_sflight TYPE STANDARD TABLE OF sflight. SELECT * FROM sflight INTO TABLE @it_sflight. DATA: o_salv TYPE REF TO cl_salv_table. cl_salv_table=>factory( EXPORTING r_container = o_container_right IMPORTING r_salv_table = o_salv CHANGING t_table = it_sflight ). o_salv->get_functions( )->set_all( ). o_salv->display( ). cl_abap_list_layout=>suppress_toolbar( ). WRITE: space. CATCH cx_root INTO DATA(e_txt). ENDTRY. |
Третий вариант:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
CLASS lcl_events DEFINITION. PUBLIC SECTION. CLASS-METHODS: on_clicked FOR EVENT clicked OF cl_gui_container_bar IMPORTING id container sender. ENDCLASS. CLASS lcl_events IMPLEMENTATION. METHOD on_clicked. MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'. ENDMETHOD. ENDCLASS. INITIALIZATION. TRY. DATA(o_splitter) = NEW cl_gui_splitter_container( parent = cl_gui_container=>default_screen no_autodef_progid_dynnr = abap_true rows = 1 columns = 2 ). o_splitter->set_column_width( id = 1 width = 10 ). DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ). DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ). DATA(it_captions) = VALUE sbptcaptns( ( caption = 'ABAP' icon = icon_abap no_close = abap_false name = 'CAP1' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ( caption = 'ABC' icon = icon_abc no_close = abap_false name = 'CAP2' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ( caption = 'Activate' icon = icon_activate no_close = abap_false name = 'CAP3' invisible = abap_false pre_inst = abap_false reuse_cnt_of = '' ) ). DATA(o_toolbar) = NEW cl_gui_container_bar( active_id = 1 parent = o_container_left captions = it_captions ). SET HANDLER lcl_events=>on_clicked FOR o_toolbar. DATA: it_sflight TYPE STANDARD TABLE OF sflight. SELECT * FROM sflight INTO TABLE @it_sflight. DATA: o_salv TYPE REF TO cl_salv_table. cl_salv_table=>factory( EXPORTING r_container = o_container_right IMPORTING r_salv_table = o_salv CHANGING t_table = it_sflight ). o_salv->get_functions( )->set_all( ). o_salv->display( ). cl_abap_list_layout=>suppress_toolbar( ). WRITE: space. CATCH cx_root INTO DATA(e_txt). ENDTRY. |