05-10-2010 5:26 PM
Hello Experts ,
I have 2 questions with ALV Editable grid;
please help me if you have answers.
I created ALV grid on one of sub screens on a Tab Strip,
As soon as user types one of the columns of the ALV grid and press u2018ENTERu2019 key, it has to return corresponding details for that line.
I tried to implement this logic in ALV grid event u2018handle_data_changedu2019, but ALV internal table is not getting populated with new entry entered in the grid. but u2018double_clicku2019 event working my purpose, but user might need enter key.
and I thought I would do implement that logic in PAI event of the sub screen, u2018ENTERu2019 key not getting trigger on PAI event of the screen until cursor is on grid.
Another question 2: How do I control and not to be deleted a line on the grid (based on validation), where do I validate and by pass the delete function for a particular line, or suggest me to gray out only one line on the grid .
I would like to have delete function to work as it is ,except for some validations..
Can I implement using PAI event of the sub screen or any by ALV event.
Please suggest me..
Edited by: Ravindranath Arusam on May 13, 2010 2:42 PM
05-13-2010 8:45 PM
In DATA_CHANGED event, you will get the modified row into the attribute MP_MOD_ROWS of the impoerting object ER_DATA_CHANGED. Since this MP_MOD_ROWS is the Object reference to Data, you need to have the field symbol to get the value.
FIELD-SYMBOLS: <lft_mod_output> TYPE t_t_output.
ASSIGN er_data_changed->mp_mod_rows->* TO <lft_mod_output>.
You can get the Value of the Cell by using the method GET_CELL_VALUE of the same ER_DATA_CHANGED object and use the method MODIFY_CELL To update the value back to ALV.
To Restrict the row deletion:
When the row is deleted it is being added to Attribute mt_deleted_rows of the object ER_DATA_CHANGED. You can put the data back to the table in the DATA_CHANGE_FINISHED event. Visit this post http://help-abap.blogspot.com/2008/10/alv-disable-delete-key-on-keyboard-in.html for more information.
Regards,
Naimesh Patel
05-20-2010 10:50 PM
.... and also, the events must be registered:
ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
Regards,
Clemens
06-10-2010 7:32 PM
thankyou all for your reply, I could solve this using SAVE button and hadling the data when saving.