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: 

how to capture the enter even in alv

Former Member
0 Kudos

hi, experts

my requirement is that:

i create an alv ,set it response to the enter even, if the content has changed, a class will be response it .

the code like below:

CALL METHOD g_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

CREATE OBJECT g_event_receiver.

SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.

but if the alv content has no changed, nothing will be happen, i want to do something such as popup a message even if the content has not changed and user press enter.

pls help me ,thanks

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Please check this method


  call method g_grid->check_changed_data
    importing
      e_valid = v_valid.

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

Please check this method


  call method g_grid->check_changed_data
    importing
      e_valid = v_valid.

0 Kudos

hi, i know this method ,but if the alv content has not been changed, call this method will not trigger my class to run.

0 Kudos

I don't think this is possible.

may be you can do is

during the enter key is pressed


    call method cl_gui_cfw=>set_new_ok_code
             exporting
                 new_code = 'DUMMY'.

and in the user command


 if ok_code eq 'DUMMY'
    call method g_grid->check_changed_data
      importing
        e_valid = v_valid.
    if v_valid ne c_x.
      call function 'POPUP_TO_CONFIRM'
        exporting
          titlebar              = text-025
          text_question         = text-026
          text_button_1         = text-027
          text_button_2         = text-028
          display_cancel_button = ' '
        importing
          answer                = v_answer.
endif.

a®s

Edited by: a®s on Jul 2, 2008 10:37 AM

Former Member
0 Kudos

Hello,

Please see these:

[https://wiki.sdn.sap.com/wiki/x/eXg]

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907].

Regards.