2011 Oct 11 6:38 AM
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
2011 Oct 11 6:54 AM
Call CHECK_CHANGED_DATA method in CL_GUI_ALV_GRID.
I believe enough content available here, so you can search.
Regards,
Diwakar
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
2011 Oct 11 6:54 AM
Call CHECK_CHANGED_DATA method in CL_GUI_ALV_GRID.
I believe enough content available here, so you can search.
Regards,
Diwakar
2011 Oct 11 7:50 AM
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.
2011 Oct 11 1:34 PM
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.
2011 Oct 11 1:50 PM
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
2011 Oct 11 2:00 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |