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 modifying cell content

Former Member
0 Kudos

Hi ,

I'm woking on a class based ALV GRID program.

In it i have to change the content of one cell when another cell content is changed.

I have done the using

  • 1.Handle data changed in grid

METHOD handle_data_changed.

PERFORM data_changed USING er_data_changed.

ENDMETHOD.

*2

DAta : pw_data_changed2 TYPE REF TO

cl_alv_changed_data_protocol.

CALL METHOD pw_data_changed2->modify_cell

EXPORTING i_tabix = pwl_row_id

i_fieldname = pw_fldname

i_value = pw_fldvalue.

The problem is the cell contents are changing only when i press enter button. Is there any way as soon as i change the contents of one cell other cell contents also changes.

Regards

Srikanth

7 REPLIES 7

Former Member
0 Kudos

Hi

Try to use the method to refresh the output table: REFRESH_TABLE_DISPLAY.

Max

Former Member
0 Kudos

After calling the method CALL METHOD o_alvgrid->set_table_for_first_display....

Use the below code:

  • Register events

CALL METHOD o_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

CALL METHOD o_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

In ALV, atleast u have to Press a tab or press enter to activate the ALV event.

Regards,

Prakash.

uwe_schieferstein
Active Contributor
0 Kudos

Hello Srikanth

The reason for your problems is that you first have to pass PAI (followed by PBO) before your changes are reflected on the ALV grid. That's why you have to press the ENTER button.

However, you can force the ALV to go through PAI/PBO. After having changed the cell contents call method

CL_GUI_CFW=>SET_NEW_OK_CODE

(e.g. with ENTER as ok-code).

After your event handling methods have finished the control framework will call PAI of the dynpro with the newly set ok-code. You don't have to handle this ok-code at all, it is just required to pass PAI followed by PBO.

Perhaps in the PBO modules it may be necessary to call

CL_GUI_CFW=FLUSH

to ensure that the control displays the most current data.

Regards

Uwe

0 Kudos

hanks for the suggetions .

When I add the

CALL METHOD w_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

My earlier statements to display the error messages from

CL_ALV_CHANGED_DATA_PROTOCOL are not working (CL_ALV_CHANGED_DATA_PROTOCOL=>ADD_PROTOCOL_ENTRY).

But when I comment

CALL METHOD w_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

and press enter then the error messages in the popup window are displayed.

I tried using CL_GUI_CFW=FLUSH also. But it also not working.

why CL_ALV_CHANGED_DATA_PROTOCOL=>ADD_PROTOCOL_ENTRY is not working when i add mc_evt_modified .

0 Kudos

Hi Uwe,

This doesn't work. It seems that the ALV is out of the loop once the focus is not set on it anymore. My impression is that once the focus is lost, the control itself should check and trigger the changed_data event. This is actually quite a bug, isn't it? Things are especially bad when several docking containers are on the same page, because there it doesn't make sense for the user to press enter after setting the focus on the alv grid.

I will try to make the method SAVE_DATA of the class cl_gui_alv_grid public so that I trigger the check myself.

I tried to inherit the cl_gui_alv_grid or to copy it but the modifications are extensive.

Cheers,

Ioan.

0 Kudos

Hello Everyone,

The answer to this question can be found in looking the function group SE16N:

the method

go_alv_hck->check_changed_data

can be called to check the consistency, even if the user did not press Enter.

Cheers,

Ioan.

Former Member
0 Kudos

Hi Srikanth,

Go through the below examples in your system for reference,

<b>BCALV_EDIT_01</b> This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.

<b>BCALV_EDIT_02</b> This report illustrates how to set chosen cells of an ALV Grid Control editable.

Regards,

Azaz Ali.