Code: Alles auswählen.
DATA: lo_alv2 TYPE REF TO cl_salv_table,
lo_events TYPE REF TO cl_salv_events_table,
lo_cols TYPE REF TO cl_salv_columns_table,
lo_col TYPE REF TO cl_salv_column_table,
lo_handler TYPE REF TO lcl_eventhandler2.
* Vorbereiten des PopUps.
cl_salv_table=>factory(
EXPORTING
list_display = 'X'
IMPORTING
r_salv_table = lo_alv2
CHANGING
t_table = lt_ask_tab ).
lo_alv2->set_screen_popup(
start_column = 70
end_column = 120
start_line = 10
end_line = 20 ).
* Spalteneigenschaften setzen.
lo_cols = lo_alv2->get_columns( ).
lo_cols->set_optimize( abap_true ).
lo_col ?= lo_cols->get_column( 'EQUNR' ).
lo_col->set_optimized( abap_false ).
lo_col ?= lo_cols->get_column( 'LINE' ).
lo_col->set_visible( abap_false ).
lo_col ?= lo_cols->get_column( 'OWN_ID' ).
lo_col->set_visible( abap_false ).
lo_alv2->set_screen_status( pfstatus = 'STATUS_0101'
report = sy-repid
set_functions = lo_alv2->c_functions_all ).
lo_events = lo_alv2->get_event( ).
CREATE OBJECT lo_handler.
SET HANDLER lo_handler->handle_double_click FOR lo_events.
SET HANDLER lo_handler->handle_added_function FOR lo_events.
lo_handler->lo_popup = lo_alv2.
lo_alv2->display( ).
Code: Alles auswählen.
CLASS lcl_eventhandler2 DEFINITION.
PUBLIC SECTION.
DATA:
lo_popup TYPE REF TO cl_salv_table,
row_id TYPE salv_de_row,
command TYPE sy-ucomm.
METHODS:
handle_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row column,
handle_added_function FOR EVENT added_function OF cl_salv_events_table
IMPORTING e_salv_function.
ENDCLASS.
CLASS lcl_eventhandler2 IMPLEMENTATION.
METHOD handle_double_click.
BREAK-POINT.
row_id = row.
lo_popup->close_screen( ).
ENDMETHOD.
METHOD handle_added_function.
BREAK-POINT.
DATA: lo_selections TYPE REF TO cl_salv_selections,
lt_cells TYPE salv_t_cell,
ls_cell TYPE salv_s_cell.
CASE e_salv_function.
WHEN 'NEXT'.
lo_selections = lo_popup->get_selections( ).
lt_cells = lo_selections->get_selected_cells( ).
READ TABLE lt_cells INTO ls_cell INDEX 1.
IF sy-subrc = 0.
row_id = ls_cell-row.
command = 'A'.
ENDIF.
WHEN 'CANCEL'.
command = 'B'.
ENDCASE.
lo_popup->close_screen( ).
ENDMETHOD.
ENDCLASS.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Pinguincommander
Ich habe nämlich sowohl als auch vergebena-dead-trousers hat geschrieben:Im GUI-Status darf dem "Doppelklick" (= F2-Taste) kein Funktionscode zugewiesen sein.
EDIT:
und/oder auch der "Enter"-Taste darf kein Funktionscode zugewiesen sein.