Простое окно с ALV Grid с использованием класса cl_salv_table и обработкой двойного клика.
CLASS lcl_popup_alv DEFINITION. PUBLIC SECTION. METHODS: call_popup IMPORTING it_aufnr TYPE aufnr_t. PRIVATE SECTION. TYPES: BEGIN OF ty_data, aufnr TYPE afko-aufnr, matnr1 TYPE afko-plnbez, END OF ty_data. DATA: mt_data TYPE TABLE OF ty_data. METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table IMPORTING row column. ENDCLASS. CLASS lcl_popup_alv IMPLEMENTATION. METHOD call_popup. DATA: lo_alv TYPE REF TO cl_salv_table, lo_functions TYPE REF TO cl_salv_functions_list, lo_settings TYPE REF TO cl_salv_display_settings, lo_events TYPE REF TO cl_salv_events_table. " Выбор данных REFRESH: mt_data. " Вызов ALV TRY. cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv CHANGING t_table = mt_data ). CATCH cx_salv_msg. RETURN. ENDTRY. lo_functions = lo_alv->get_functions( ). * lo_functions->set_all( 'X' ). lo_settings = lo_alv->get_display_settings( ). lo_settings->set_list_header( 'Данные' ). lo_events = lo_alv->get_event( ). SET HANDLER on_double_click FOR lo_events. IF lo_alv IS BOUND. lo_alv->set_screen_popup( start_column = 5 end_column = 100 start_line = 1 end_line = 10 ). lo_alv->display( ). ENDIF. ENDMETHOD. METHOD on_double_click. DATA: ls_data LIKE LINE OF mt_data. CHECK row > 0. READ TABLE mt_data INTO ls_data INDEX row. CHECK sy-subrc = 0. CASE column. WHEN 'AUFNR'. CHECK ls_data-aufnr IS NOT INITIAL. SET PARAMETER ID 'BR1' FIELD ls_data-aufnr. CALL TRANSACTION 'COR3' AND SKIP FIRST SCREEN. ENDCASE. ENDMETHOD. ENDCLASS. DATA: lo_popup_alv TYPE REF TO lcl_popup_alv, lt_aufnr TYPE aufnr_t. CREATE OBJECT lo_popup_alv. lo_popup_alv->call_popup( it_aufnr = lt_aufnr ).
Комментариев нет:
Отправить комментарий