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: 

ALV Grid Handle Edit Event (Lost Focus)

Former Member
0 Kudos

Hi all,

I have some problems with the ALV Grid.

Target:

I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?

Thanks Stefan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In PBO,

call method o_alvgrid->register_edit_event

exporting

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.

LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.

CASE <lfs_fieldcat>-fieldname.

WHEN 'X'.

<lfs_fieldcat>-coltext = 'X'.

<lfs_fieldcat>-checkbox = 'X'.

<lfs_fieldcat>-edit = 'X'.

9 REPLIES 9

Former Member
0 Kudos

In PBO,

call method o_alvgrid->register_edit_event

exporting

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.

LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.

CASE <lfs_fieldcat>-fieldname.

WHEN 'X'.

<lfs_fieldcat>-coltext = 'X'.

<lfs_fieldcat>-checkbox = 'X'.

<lfs_fieldcat>-edit = 'X'.

0 Kudos

Hi thanks for this answer,

but I'm not sure how I have to catch this event -

sorry for this newbie question

Thanks Stefan

0 Kudos

See this link

http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm

If u want i will send u sample code. Give me ur mail id

0 Kudos

Hi,

Use ths also along with ur code:

    CALL METHOD o_alvgrid->register_edit_event
                    EXPORTING
                       i_event_id = cl_gui_alv_grid=>mc_evt_modified.

DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid .

Hope that helps you,

Regards,

Anjali

0 Kudos

Hi,

thanks for help - bt it dosn't work 100% correct -

I have implement

CALL METHOD gv_alv_cw->register_edit_event

EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .

set handler gv_eventhandler->handle_data_changed for gv_alv_cw.

set handler gv_eventhandler->handle_data_changed_finished for gv_alv_cw.

and the methods handle_data_changed_finished and handle_data_changed

But if I change the value of a column (simple text) and leave the column via Tab or by clicking (one times) on the next column the event dosn't raise. But the normal way to fill the table is pressing tab switching between columns - So I have to get the event after pressing the tab or mouse.

Thanks

Stefan

0 Kudos

Hi,

there is a way to say thanks in SDN

Kindly reward points for the answers which helped u.

0 Kudos

You should do the coding in this order.

1° Create ALV object

2° Do the link between Event handler and the ALV via the set handler.

3° Fielcat creation

4° CAll ALV method set_table_for_first_display.

5° Call ALV method register_edit_event.

*/ REgister the return key as event

CALL METHOD gref_alv_up->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified

Former Member
0 Kudos

Hi,

Check this Demo program BCALV_EDIT_03

Former Member
0 Kudos

Use Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.

CLASS lcl_event_receiver DEFINITION.

METHODS:

*$ Check the change

handle_data_changed FOR EVENT data_changed

OF cl_gui_alv_grid

IMPORTING er_data_changed

e_ucomm

e_onf4

e_onf4_before

e_onf4_after,

handle_data_changed_finished

FOR EVENT data_changed_finished

OF cl_gui_alv_grid

IMPORTING e_modified

et_good_cells

sender,

ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION