CL_GUI_SPLITTER_CONTAINER

*&---------------------------------------------------------------------*
*& Report ZLEH11
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zleh11.

class ooalv definition.

  public section.
    class-methods:split_con importing iv_type  type i
                            changing  io_grid1 type ref to cl_gui_alv_grid optional
                                      io_grid2 type ref to cl_gui_alv_grid optional
                                      io_grid3 type ref to cl_gui_alv_grid optional.

  private section.

    class-data:go_split1 type ref to cl_gui_splitter_container.
    class-data:go_split2 type ref to cl_gui_splitter_container.

    class-data:go_cc type ref to cl_gui_custom_container.
*    class-data:go_cc type ref to cl_gui_docking_container.

endclass .

class ooalv implementation.

  method:split_con.

    check go_cc is not bound.

    if go_cc is not bound.
      go_cc = new cl_gui_custom_container( container_name = 'ALV' ).
    endif.
*    if go_cc is not bound.
*      go_cc = new cl_gui_docking_container(
*      side = cl_gui_docking_container=>dock_at_LEFT
*      repid = sy-repid dynnr = sy-dynnr extension = 300 ).
*    endif.

    "iv_type 1 分割左右 2 分割上下 3上半部分割左右 4 下半部分分割左右
    case iv_type.
      when 1.
        if go_split1 is not bound.
          go_split1 = new cl_gui_splitter_container( parent = go_cc rows = 1 columns = 2 ).
          io_grid1 = new cl_gui_alv_grid( go_split1->get_container( row = 1 column = 1 ) ) .
          io_grid2 = new cl_gui_alv_grid( go_split1->get_container( row = 1 column = 2 ) ) .
        endif.
      when 2.
        if go_split1 is not bound.
          go_split1 = new cl_gui_splitter_container( parent = go_cc rows = 2 columns = 1 ).
          io_grid1 = new cl_gui_alv_grid( go_split1->get_container( row = 1 column = 1 ) ) .
          io_grid2 = new cl_gui_alv_grid( go_split1->get_container( row = 2 column = 1 ) ) .
        endif.
      when 3.
        if go_split1 is not bound.
          go_split1 = new cl_gui_splitter_container( parent = go_cc rows = 2 columns = 1 ).
        endif.
        if go_split2 is not bound.
          go_split2 = new cl_gui_splitter_container( parent = go_split1->get_container( row = 1 column = 1 ) rows = 1 columns = 2 ).
        endif.
        io_grid1 = new cl_gui_alv_grid( go_split1->get_container( row = 2 column = 1 ) ) .
        io_grid2 = new cl_gui_alv_grid( go_split2->get_container( row = 1 column = 1 ) ) .
        io_grid3 = new cl_gui_alv_grid( go_split2->get_container( row = 1 column = 2 ) ) .
      when 4.
        if go_split1 is not bound.
          go_split1 = new cl_gui_splitter_container( parent = go_cc rows = 2 columns = 1 ).
        endif.
        if go_split2 is not bound.
          go_split2 = new cl_gui_splitter_container( parent = go_split1->get_container( row = 2 column = 1 ) rows = 1 columns = 2 ).
        endif.
        io_grid1 = new cl_gui_alv_grid( go_split1->get_container( row = 1 column = 1 ) ) .
        io_grid2 = new cl_gui_alv_grid( go_split2->get_container( row = 1 column = 1 ) ) .
        io_grid3 = new cl_gui_alv_grid( go_split2->get_container( row = 1 column = 2 ) ) .
      when others.
    endcase.

  endmethod.

endclass.



start-of-selection.

  data:go_grid1 type ref to cl_gui_alv_grid.
  data:go_grid2 type ref to cl_gui_alv_grid.
  data:go_grid3 type ref to cl_gui_alv_grid.

  call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
module status_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

  ooalv=>split_con( exporting iv_type = 1 changing io_grid1 = go_grid1 io_grid2 = go_grid2 io_grid3 = go_grid3 ).


endmodule.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

*  check sy-ucomm eq 'EXIT'.
  leave to screen 0.

endmodule.

你可能感兴趣的:(CL_GUI_SPLITTER_CONTAINER)