Skip to Content

Trigger data changed event in alv grid even if 'ENTER' is not pressed

Hello Experts,

Is there a way that my data_changed event gets triggered even if if the user justs

input a value and not pressing enter?

Also, when I add or delete rows in my al grid, how do I also trigger the said event?

Hope you can help me guys. Thank you and take care!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 10, 2010 at 09:21 AM

    call the method CL_GUI_ALV_GRID -> CHECK_CHANGED_DATA . this method does Verification of Changes and Triggers Event DATA_CHANGED

    u can check in debugg mode. the above method will trigger DATA_CHANGED event. so write your logic wat ever u need to perform inside the method of the event DATA_CHANGED

    sample code

    call this below method in ur PAI of ur screen.

    CALL METHOD CL_GUI_ALV_GRID->check_changed_data

    IMPORTING

    e_valid = w_valid.

    also you need to register the events in PBO of ur screen.I hope u have done as

    CALL METHOD CL_GUI_ALV_GRID->register_edit_event

    EXPORTING

    i_event_id = cl_gui_alv_grid=>mc_evt_modified.

    CALL METHOD CL_GUI_ALV_GRID->register_edit_event

    EXPORTING

    i_event_id = cl_gui_alv_grid=>mc_evt_enter.

    • Instantiate the event or it won't work.

    CREATE OBJECT w_event_receiver.

    SET HANDLER w_event_receiver->handle_data_changed FOR w_alvgd2.

    and the method will be declared in global section of the program as

    CLASS lcl_grid_event_receiver DEFINITION.

    PUBLIC SECTION.

    METHODS: handle_data_changed

    FOR EVENT data_changed OF cl_gui_alv_grid

    IMPORTING er_data_changed,

    endclass.

    CLASS lcl_grid_event_receiver IMPLEMENTATION.

    METHOD handle_data_changed.

    *event is ttriggered when data is changed in the output

    PERFORM check_data USING er_data_changed

    t_data.

    ENDMETHOD.

    endclass.

    inside routine Check_data, u have to write ur logic

    Its works for me. please check

    thanks

    sangeetha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 10, 2010 at 07:00 AM

    If you're talking about classical ABAP dynpro's there's no way any event is fired unless user presses enter, uses some function key, etc. This is actually a feature, because you want to minimize the number of roundtrips between the application server and the presentation server. So the user has to explicitly do something (apart from just entering data) to fire the PAI/PBO processing sequence...

    Cannot comment on your ALV question, because I don't understand it... 😉

    Add comment
    10|10000 characters needed characters exceeded