08-14-2013 9:28 AM
Dear Developers,
i am facing a problem with the event data_changed on a screen that uses multiple editable ALVs.
The user is able to switch through the editable fields of each ALV and enter values. If he presses the TAB-Key my event-handler is processed and the cursor jumps to the next field.
The problem is: If the user entered something into the last editable field of the actual ALV and presses TAB, the ALV loses focus without raising data_changed event.
I know, that i can force the data_changed by calling method check_changed_data of CL_GUI_ALV_GRID, but as no event is triggered by losing focus, i cant do that. Regular PAI is too late to react on the data entered. And pressing enter in a screen where you want to enter many data right away is not acceptable.
Is there any other way to react on filling the last editable field?
I use CL_GUI_ALV_GRID for ALVs and edit-event CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
Thanks in advance!
08-20-2013 8:54 AM
In another application an ALV placed on a popup-dynpro shows the same behaviour. If you push the tab-key focus is set to a button of the gui-status without raising event data_changed.
08-20-2013 9:56 AM
08-20-2013 10:16 AM
Hi Sandeep,
thanks for your answer, but the problem is, that my event handler is not executed, if i edit the last editable cell of the ALV and then press the tab-key. If i press Enter it is processed. If i click on a field of this particular ALV it is processed. But if i leave the ALV by pressing TAB after editing/changing the last editable field, the Event data_changed is not raised by the ALV.
regards
Jan Martin
08-20-2013 11:19 AM
Hi,
Use the below code
USE this EVENT
METHODS: HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED_FINISHED OF CL_GUI_ALV_GRID
IMPORTING E_MODIFIED
ET_GOOD_CELLS.
if O_GRID2 is initial.
pass V_STABLE parameters as 'X'
CALL METHOD O_GRID2->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
ERROR = 1
OTHERS = 2.
CALL METHOD O_GRID2->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_SAVE = 'X'
I_DEFAULT = 'X'
IS_LAYOUT = WA_LAYOUT
CHANGING
IT_OUTTAB = IT_MATNR
IT_FIELDCATALOG = IT_FCAT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ELSE.
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = O_GRID2.
CALL METHOD O_GRID2->REFRESH_TABLE_DISPLAY
EXPORTING
IS_STABLE = V_STABLE
EXCEPTIONS
FINISHED = 1
OTHERS = 2.
endif.
Regards
Bharath
08-20-2013 12:06 PM
Hi Bharath,
this Event is neither raised by cl_gui_alv_grid if you tab out of the grid...
Thanks anyways!
08-20-2013 11:30 AM
There is an EVENT of alv DATA_CHANGED_FINISH try putting the logic of the last cell in this also.
Regards
08-20-2013 12:01 PM
Hi Mohammed Yakub,
thanks for your answer. I tried (data_changed_finish) again. It is not raised, if the ALV loses focus. Besides the Signature is useless for my usecase. i do check the given Data on data_changed. data_changed_finished is supposed to be used to change/update displayed data, according to some sap-note i read the other day...
regards
Jan Martin
08-23-2013 3:31 PM
Does nobody have a solution? Is there a SAP-Note? I can not imagine, that this behaviour would be normal. Do you need code examples? It can not be right, that data_changed is not raised, after editing the last field and not pressing enter. It makes the whol mc_event_modified Kind of useless - in my opinion..
Please help!