ALV & Set focus
I have a simple reporting web dynpro component. I am using the ALV functionality. The ALV output can be quite long and the user must scroll up & down the list when investigating list. When the user finds something interesting from the list, he will click a button in the ALV row, and this will open a popup window (=another web dynpro component).
The user can then do certain operations in the popup and click a button and this will update the data in the main component (the button will trigger an event, the event handler is in the main component, etc.). In other words the data in the ALV node will be updated. Now the user will close the popup, and here is the problem: the focus of the ALV is returned to the top of the list. So now the user needs to find again the same position in the report where he was before he opened the popup, and this is not user-friendly at all. I want to return the focus of the screen back to the same position where the users was before opening the popup.
Yes, I know that there is the method SET_FOCUS in the interface controller of the ALV component. Basically this methods does exactly what I am looking for. So basically if I was on row 50, I can set the focus back to row 50. Unfortunately SET_FOCUS method does not seem to be working properly when there is a popup window in use:
- I am triggering an event from the popup component. The main component reacts to this method, does the calculations etc. and then updates the data used displayed by the ALV. Then I try to set the focus with the SET_FOCUS method. The method seems to be executed without problems, but as soon as the popup window is closed, the ALV is displayed starting from the first row.
- Even if I do the following the SET_FOCUS is not working: Call the close_window method to close the window and then set the focus after that (I can even put a “WAIT UP TO 10 SECONDS” between these two operations, but the result is the same – actually the window is closed after 10 seconds…)
Can you suggest any workarounds for my problem? How to set the focus to certain row of an ALV after a popup window is closed?
It's me again. It seems that I found a workaroud for my problem. Hope it will help you. I set a timedtrigger element to trigger my button action (I told you above that the focus could be changed if I press on a button but not automatically after enter on cell). It's a little annoying because it has a 1 second delay but it works. Maybe you can set a timedtrigger to trigger your action - which set the focus - after you close the popup.