Code: Alles auswählen.
*Datenstruktur für Interne Tabele**************************
TYPES: BEGIN OF filter,
id TYPE gui_text,
von TYPE gui_text,
bis type gui_text,
END OF filter.
*Workarea und Interne Tabelle
DATA: filter_wa TYPE filter,
filter_itab TYPE TABLE OF filter.
....
*Methode um Daten an die Interne-Tabelle "filter_itab" anzuhängen*****************************************
METHOD fill_filter_itab.
filter_wa-id = id.
filter_wa-von = von.
filter_wa-bis = bis.
APPEND filter_wa TO filter_itab.
endmethod. "fill_filter_itab
....
* Methode um ALV-Grid zu füllen
METHOD fill_list.
DATA: list_layout TYPE lvc_s_layo.
CONCATENATE 'Titel_Name' 'ID' INTO list_layout-grid_title SEPARATED BY space.
list_layout-smalltitle = 'X'. "The list title has small fonts,
list_layout-cwidth_opt = 'X'. "the column width is adjusted,
list_layout-no_toolbar = 'X'. "the toolbar is suppressed.
CALL METHOD list_viewer->set_table_for_first_display
EXPORTING
i_structure_name = 'zp5_filter'
is_layout = list_layout
CHANGING
it_outtab = filter_itab.
ENDMETHOD.
...
*Methode die das DoubleClick-Event abfängt, speichert den aktuellen "node_key" in variable "ID"
METHOD handle_node_double_click.
id = node_key(2) + 4.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
....
*Funktion für den "hinzufüge" Button
MODULE user_command_0200 INPUT.
CASE okcode.
WHEN 'CANCEL'.
LEAVE.
WHEN 'ADD'. "hinzufüge" Button
CALL METHOD screen_init=>fill_filter_itab. " Werte in Interne-Tabelle füllen
CALL METHOD: screen_init=>fill_list, "ALV-Grid bereitstellen
screen_init=>list_viewer->set_visible EXPORTING visible = 'X'. " list_viewer ist von Typ cl_gui_alv_grid
ENDCASE.
ENDMODULE. .
Code: Alles auswählen.
* Methode um ALV-Grid zu füllen
METHOD fill_list.
DATA: list_layout TYPE lvc_s_layo.
CONCATENATE 'Titel_Name' 'ID' INTO list_layout-grid_title SEPARATED BY space.
list_layout-smalltitle = 'X'. "The list title has small fonts,
list_layout-cwidth_opt = 'X'. "the column width is adjusted,
list_layout-no_toolbar = 'X'. "the toolbar is suppressed.
CALL METHOD list_viewer->set_table_for_first_display
EXPORTING
i_structure_name = 'zp5_filter'
is_layout = list_layout
CHANGING
it_outtab = filter_itab.
CALL METHOD list_viewer->refresh_table_display.
ENDMETHOD.
....
Code: Alles auswählen.
......
*Funktion für den "hinzufüge" Button
MODULE user_command_0200 INPUT.
CASE okcode.
WHEN 'CANCEL'.
LEAVE.
WHEN 'ADD'. "hinzufüge" Button
CALL METHOD screen_init=>fill_filter_itab. " Werte in Interne-Tabelle füllen
CALL METHOD: screen_init=>fill_list, "ALV-Grid bereitstellen
screen_init=>list_viewer->set_visible EXPORTING visible = 'X'. " list_viewer ist von Typ cl_gui_alv_grid
CALL METHOD list_viewer->refresh_table_display.
ENDCASE.
ENDMODULE. .
Code: Alles auswählen.
*Methode zum füllen des ALV_Grids
METHOD fill_list.
IF list_viewer IS INITIAL .
Create Object: list_viewer EXPORTING i_parent = container.
CONCATENATE 'ID'
'von'
'bis'
INTO list_layout-grid_title SEPARATED BY space.
list_layout-smalltitle = 'X'. "The list title has small fonts,
list_layout-cwidth_opt = 'X'. "the column width is adjusted,
list_layout-no_toolbar = 'X'. "the toolbar is suppressed.
CALL METHOD list_viewer->set_table_for_first_display
EXPORTING
i_structure_name = 'zp5_filter'"'ZP5_Filter'
is_layout = list_layout
CHANGING
it_outtab = filter_itab."filter_itab.
ELSE .
CALL METHOD list_viewer->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF .
ENDMETHOD.