Skip to Content
0
Sep 06, 2023 at 03:24 PM

How to handle click event for buttons in ALV cells for SALV Factory method.

95 Views

Hi,

I am displaying some of the ALV cells as buttons using SALV factory method. But I am not able to trigger or handle this button click using an event 'IF_SALV_EVENTS_ACTIONS_TABLE~LINK_CLICK' of the class 'CL_SALV_EVENTS_TABLE'.

It works fine if I use that cell as a hotspot. But I want to use it as buttons only.

image.png

In below screenshot we can see that this event can also handle the button click. But it doesn't.

image.png

Below is some sample code -

* Set Cell type as Pushbutton for the Column
TRY.
lr_column ?= lo_cols->get_column( 'COUNT_PRIO1' ).
lr_column->set_cell_type( if_salv_c_cell_type=>Button ).
CATCH cx_salv_method_not_supported.
ENDTRY.

TRY.
lo_cols->set_cell_type_column( 'CELLTYPE' ).
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.

*... register to the event USER_COMMAND
DATA(lo_ref) = NEW lcl_main( ).
lo_events = go_alv->get_event( ).

*... register to the event Button Click
SET HANDLER lo_ref->on_button_click FOR lo_events.



Is there any way we can achieve this functionality in Factory ALV ?

Thanks in advance.

Attachments

image.png (15.1 kB)
image.png (50.8 kB)