Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

User command in CL_GUI_ALV_GRID

Former Member
0 Likes
1,796

Hi,

I have displayed ALV using the class CL_GUI_ALV_GRID. I want to trigger a user command when I click on the Box of a record in the ALV displayed. How can I acheive this? I know to capture using a separate button on the application tool bar, but here I want to capture the command once I click on the Box of the ALV.

Thanks,

Sarath.C

Hi,

I have displayed ALV using the class CL_GUI_ALV_GRID. I want to trigger a user command when I click on the Box of a record in the ALV displayed. How can I acheive this? I know to capture using a separate button on the application tool bar, but here I want to capture the command once I click on the Box of the ALV.

Thanks,

Sarath.C

3 REPLIES 3
Read only

gerd_rother
Active Participant
0 Likes
1,259

Hi Sarath,

You can define that column as hotspot and process event hotspot_click or you just process event double_click.

Regards, Gerd Rother

Read only

0 Likes
1,259

solved.

Read only

0 Likes
1,259

The situation is solved as below,

----


CLASS lcl_alv_wrapper DEFINITION INHERITING FROM cl_gui_alv_grid.

PUBLIC SECTION.

METHODS : constructor,

set_delay_time,

click FOR EVENT delayed_changed_sel_callback OF cl_gui_alv_grid.

ENDCLASS. "lcl_alv_wrapper DEFINITION

----


CLASS lcl_alv_wrapper IMPLEMENTATION.

METHOD constructor.

super->constructor( i_parent = cl_gui_container=>default_screen ).

SET HANDLER me->click FOR ALL INSTANCES.

ENDMETHOD. "constructor

METHOD set_delay_time.

me->set_delay_change_selection( 10 ).

ENDMETHOD. "set_delay_time

METHOD click.

MESSAGE 'Hello' TYPE 'I'.

ENDMETHOD. "click

ENDCLASS. "lcl_alv_wrapper IMPLEMENTATION

DATA : grid TYPE REF TO lcl_alv_wrapper,

layout TYPE lvc_s_layo,

table TYPE STANDARD TABLE OF makt.

AT SELECTION-SCREEN OUTPUT.

CREATE OBJECT grid.

SELECT * FROM makt INTO CORRESPONDING FIELDS OF TABLE table UP TO 27 ROWS.

layout-sel_mode = 'D'.

grid->set_table_for_first_display( EXPORTING i_structure_name = 'MAKT'

is_layout = layout

CHANGING it_outtab = table ).

grid->register_delayed_event( i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select ).

grid->set_delay_time( ).

Thanks,

Sarath.C