Application Development and Automation 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: 
Read only

Editable ALV

Former Member
0 Likes
1,170

Hi all,

I have created an ALV using set_table_for_first_display, where one of the field is set to editable.

I have two buttons, one for save the changed data and other to edit the layout. Initially when the layout is displayed for first time, all the fields should be in non-editable mode. When user click on edit button, the particular field should be displayed in editable mode. All the above steps are working fine. But when user make some changes in the editable field and click on save button. The changed data in the internal table is not getting captured. How to handle this issue?

Thanks,

Stanley

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,091

Call CHECK_CHANGED_DATA method in CL_GUI_ALV_GRID.

I believe enough content available here, so you can search.

Regards,

Diwakar

Call CHECK_CHANGED_DATA method in CL_GUI_ALV_GRID.

I believe enough content available here, so you can search.

Regards,

Diwakar

5 REPLIES 5
Read only

Former Member
0 Likes
1,092

Call CHECK_CHANGED_DATA method in CL_GUI_ALV_GRID.

I believe enough content available here, so you can search.

Regards,

Diwakar

Read only

Former Member
0 Likes
1,091

Hi,

First u need to call check_changed_data method and then if e_valid is 'x'. Then u need to write an event for handling chaged data.

Please find the code below for your reference.

For event handling you have to write the local class as below.

class lcl_tree_event_handler definition.

public section.

methods:

handle_data_changed

for event data_changed of cl_gui_alv_grid

importing er_data_changed,

endclass.

class lcl_tree_event_handler implementation.

method handle_data_changed.

er_data_changed """this is the changed data, which you want.

endmethod.

endclass.

data: g_event_handler type ref to lcl_tree_event_handler.

create object g_event_handler.

Now check whethwr the data is changed or not.

call method g_grid->check_changed_data

importing e_valid = g_valid.

check not g_valid is initial.

call method cl_gui_cfw=>dispatch.

call method g_event_handler->handle_data_changed.

This can help you, please check and revert back.

Thanks,

Radhika.

Read only

Former Member
0 Likes
1,091

Hi,

Whenever some value is changed in ALV, it need to be refreshed and updated in the internal table. So if you save the data wthout refreshing it, the data will not get updated in internal table.

You can double click the ALV before pressing the save button or Before save option refresh the ALV using 'Refresh' method of ALV GRID.

Read only

Former Member
0 Likes
1,091

hi Stanley..

First u are add one field in table as char(1) and define field catlog

DEFINE fieldcate.

w_fieldcat-col_pos = &1.

w_fieldcat-fieldname = &2.

w_fieldcat-scrtext_m = &3.

w_ fieldcat-checkbox = &7.

w_fieldcat-fix_column = &8.

w_fieldcat-lowercase = &9.

APPEND w_fieldcat TO t_fieldcat.

CLEAR w_fieldcat.

thn

LOOP AT itab INTO wa.

IF wa_feed-chk EQ 'X'.

wa-line_col = 'C500'.

CLEAR : ls_celltab , lt_celltab .

REFRESH : lt_celltab .

ls_celltab-fieldname = 'field name'.

ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

endloop.

when 'funcode'.

loop at it where chk = 'X'.

and update table..

Hope this is useful for u..

Regards

Vshal

Read only

0 Likes
1,091

Hi all,

Problem got solved.

Thanks for your contribution.