Sie sind auf Seite 1von 5

PROGRAM

zpr_alv_split.

CLASS : event_class DEFINITION DEFERRED.


DATA: it_tab TYPE TABLE OF mara,
wa_tab LIKE LINE OF it_tab,
it_temp LIKE it_tab,
gs_layout TYPE lvc_s_layo,
ok_code
TYPE sy-ucomm,
*
save_code
LIKE ok_code,
len
TYPE sy-index.

DATA : wa_rows
it_rows

TYPE lvc_s_row,
TYPE lvc_t_row.

DATA: custom_container TYPE REF TO cl_gui_custom_container,


grid TYPE REF TO cl_gui_alv_grid,
custom_container2 TYPE REF TO cl_gui_custom_container,
splitter TYPE REF TO cl_gui_splitter_container,
grid2 TYPE REF TO cl_gui_alv_grid,
event_receiver TYPE REF TO event_class,
cont1 TYPE REF TO cl_gui_container,
cont2 TYPE REF TO cl_gui_container.
*gs_layout-sel_mode = 'A'.
*---------------------------------------------------------------------*
*
CLASS event_class DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS event_class DEFINITION.
PUBLIC SECTION.
CLASS-METHODS user_command FOR EVENT
double_click OF cl_gui_alv_grid
IMPORTING e_row.
ENDCLASS.
"event_class DEFINITION
*---------------------------------------------------------------------*
*
CLASS EVENT_CLASS IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS event_class IMPLEMENTATION.
METHOD user_command.
CALL METHOD grid->get_selected_rows
IMPORTING

et_index_rows = it_rows.
CLEAR it_temp.
LOOP AT it_rows INTO wa_rows.
len = wa_rows-index.
READ TABLE it_tab INTO wa_tab INDEX len.
APPEND wa_tab TO it_temp.
ENDLOOP.
call screen 9000.
ENDMETHOD.
ENDCLASS.
"EVENT_CLASS IMPLEMENTATION
*&--------------------------------------------------------------------*
*&
Module STATUS_9000 OUTPUT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'GUI'.
* SET TITLEBAR 'xxx'.
IF custom_container IS INITIAL.
CREATE OBJECT custom_container
EXPORTING
container_name = 'CC'.
CREATE OBJECT splitter
EXPORTING
align
= 15
parent
= custom_container
rows
= 1
columns
= 2
EXCEPTIONS
cntl_error
= 1
cntl_system_error = 2
others
= 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD splitter->get_container
EXPORTING
row
= 1
column
= 1
receiving
container = cont1.
CALL METHOD splitter->get_container
EXPORTING
row
= 1
column
= 2
receiving
container = cont2.
CREATE OBJECT grid

EXPORTING
i_parent = cont1.
SELECT * FROM mara INTO TABLE it_tab UP TO 10 ROWS.

CALL METHOD grid->set_table_for_first_display


EXPORTING
i_structure_name
= 'MARA'
is_layout
= gs_layout
CHANGING
it_outtab
= it_tab
EXCEPTIONS
invalid_parameter_combination = 1
program_error
= 2
too_many_lines
= 3
OTHERS
= 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT grid2
EXPORTING
i_parent = cont2.
ENDIF.

CALL METHOD grid2->set_table_for_first_display


EXPORTING
*
i_buffer_active
=
*
i_bypassing_buffer
=
*
i_consistency_check
=
i_structure_name
= 'MARA'
*
is_variant
=
*
i_save
=
*
i_default
= 'X'
*
is_layout
=
*
is_print
=
*
it_special_groups
=
*
it_toolbar_excluding
=
*
it_hyperlink
=
*
it_alv_graphics
=
*
it_except_qinfo
=
*
ir_salv_adapter
=
CHANGING
it_outtab
= IT_TEMP
*
it_fieldcatalog
=
*
it_sort
=
*
it_filter
=
EXCEPTIONS
invalid_parameter_combination = 1
program_error
= 2
too_many_lines
= 3
others
= 4
.
IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO


*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->user_command FOR grid.
ENDMODULE.
" STATUS_9000 OUTPUT
*&--------------------------------------------------------------------*
*&
Module USER_COMMAND_9000 INPUT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
MODULE user_command_9000 INPUT.
clear ok_code.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
" USER_COMMAND_9000 INPUT
*&--------------------------------------------------------------------*
*&
Module STATUS_9001 OUTPUT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
SET PF-STATUS 'GUI'.
* SET TITLEBAR 'xxx'.
IF custom_container2 IS INITIAL.
CREATE OBJECT custom_container2
EXPORTING
container_name = 'CC1'.
CREATE OBJECT grid2
EXPORTING
i_parent = cont2.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name
= 'MARA'
CHANGING
it_outtab
= it_temp
EXCEPTIONS
invalid_parameter_combination = 1
program_error
= 2
too_many_lines
= 3
OTHERS
= 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

ENDIF.

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.
ENDMODULE.
" STATUS_9001 OUTPUT
*&--------------------------------------------------------------------*
*&
Module USER_COMMAND_9001 INPUT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
MODULE user_command_9001 INPUT.
clear ok_code.
ok_code = sy-ucomm.
* save_code = ok_code.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
" USER_COMMAND_9001

INPUT

Das könnte Ihnen auch gefallen