Application Development 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: 

Question about triggering event for ALV dropdown

Former Member
0 Kudos

Hi all,

I'm using the OO Grid and had a dropdown in one of the column. Normally, once I change the value in the dropdown, I will have to press ENTER to trigger the Data_Changed event. Is there any possible way to get this event fire right after the value in the dropdown is selected i.e without having to press Enter or double click.

Any kind of help will be very much appreciated.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Whenever user interacts with the grid and changes the cell values..

DATA CHANGED event is triggered...

See the below sample code, hope this helps:

----


  • Class Definition

----


CLASS <reciever class> DEFINITION.

PUBLIC SECTION.

METHODS:

      • Handle hotspot

handle_hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id

e_column_id,

      • Data Changed

handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed,

      • Data changed Finished

handle_data_changed_finished

FOR EVENT data_changed_finished OF cl_gui_alv_grid

IMPORTING e_modified.

ENDCLASS.

----


  • Class implementation

----


CLASS <receiver class> IMPLEMENTATION.

      • Data Changed

METHOD handle_data_changed.

PERFORM data_changed USING er_data_changed.

ENDMETHOD.

      • Data Finished

METHOD handle_data_changed_finished.

PERFORM data_changed_finished.

ENDMETHOD.

      • Hotspot clicked

METHOD handle_hotspot_click.

perform hotspot_click USING e_row_id

e_column_id.

ENDMETHOD.

ENDCLASS.

DATA:

w_event TYPE REF TO lcl_brly_frt_event_receiver.

Thanks

Former Member
0 Kudos

Hello,

You can try using the method CHECK_CHANGED_DATA.This will return a parameter whenever there is a change in the ALV Grid.

call methiod gref_grid_trvald->check_changed_data

IMPORTING

e_valid = g_valid .

IF g_valid <> dmct_true.

...logic

Regards,

Beejal

**Reward if this helps

Former Member
0 Kudos

Hi,

THanks for the reply. I knew that DATA_CHANGED event will be trigger. Currently, I trigger the DATA_CHANGED event by

METHOD GRID->REGISTER_EDIT_EVENT

EXPORTING

I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.

THis is where I need to press on Enter to trigger the DATA_CHANGED event. THis is not what I want. I want the some event to be fired right away whenever I select the data in the dropdown. I'm not sure if this is possible.

Former Member
0 Kudos

Maybe my question is confusing. What I need is to fire an event right after I select a value from my dropdown list in my OO grid. I want to know what event is this and how to put it in code.

My dropdown is done using the field catalog DRDN_FIELD method.

0 Kudos

Hi,

This can't be done there is no event for listbox change unfortunately (I have had this same problem). The closest you are going to get is to still use the REGISTER_EDIT_EVENT but use the event type MC_EVT_MODIFIED which will fire DATA_CHANGED as soon as you leave the field and it's value has changed. So if you change the drop down value, then click on any other field the data_changed will run.

This is a bit limiting but it is the closest you will get to what you want to do.

From

De Wildt