Skip to Content
0
Former Member
Dec 08, 2008 at 10:01 AM

ALV grid Enter event

37 Views

Hi

I have a grid view where I can insert a new line and enter values in 2 of its columns. I wish to update other columns based on the values that the user enters in the 2 columns.

I have tried both of the following but neither gives me exactly what I want :-

i_event_id = cl_gui_alv_grid=>mc_evt_modified. " and

  • i_event_id = cl_gui_alv_grid=>mc_evt_enter.

I want the user to be able to TAB (or mouse) between the 2 columns. After entering a value and TABing away from the column then the other columns in the row should be updated. When the user is finished experimenting with values, he hits ENTER then the 2 columns should cease to be editable (I know how to enable/disable edit on cells).

If I use mc_evt_modified then TABing between the 2 columns updates the other columns nicely. However I cannot distinguish between TAB and ENTER and so cannot switch of EDIT when the user hits ENTER.

If I use mc_evt_enter then the other columns are not updated when I TAB away. This is of course correct, but not what I want. When the user hits ENTER then everything is updated and I could switch of Edit at this point.

It looks like I need a different event to DATA_CHANGED and DATA_CHANGED_FINISH. This event should be invoked when the user hits ENTER even if nothing has changed in the Grid. I have tested DOUBLE_CLICK but it does not work.

So what I really want is for the user to see the results of his changes imeadiately (using the TAB) and then to finish the insert by hitting ENTER. Remember that since the user TABed away to see the updated columns, a subsequent ENTER will not result in a DATA_CHANGED event since the Grid is unchanged.

Perhaps I am designing a bad GUI. When does one normaly switch off EDIT on cells in a newly inserted line.

Peter