2022 Sep 08 10:20 AM
Hello experts,
I come to you as a last resort.
Behaviour
In our current ABAP-OO development project we have two different dynpro screens - let's call them Screen A and Screen B. Both of these screens contain a custom control wherein trees of items are displayed using CL_GUI_SIMPLE_TREE. The nodes of these trees each have an event handler attached to the event "NODE_DOUBLE_CLICK". The event handlers are responsible for displaying data in another custom control on each of the screens. Upon initial navigation to the screens everything works as expected, however, once each screen has been visited once, the event handler on screen A is called but will no longer refresh the data inside the custom control.
Screen B continues to work as expected. This persists until the application is restarted.
Corrective measures taken (unsuccessfully)
Our working theory is that somehow for some reason the event handlers are mixed up somewhere in the background.
We tried to unassign and reassign the event handler every time the screen is changed to no success. We also made sure that the custom controls that are used for the working lists and those used for display have different names.
We also debugged the program and ensured that internally, all data that is needed for display in the custom control is correct and gets updated.
Is there any way to ensure that the correct event handler will refresh the correct custom control? Does the custom control have to be rebuilt in some way? How does the confusion of event handlers even occur?
Best regards and thanks in advance for your efforts
2022 Sep 08 11:40 AM
It's a well-known programming issue. You must instantiate a control only once, because only the first instance is shown. After that you must refresh or flush, nothing more. Another (counter-performing) solution is to free the control (method "FREE", not ABAP "FREE") and instantiate again.
You may also look at this answer: https://stackoverflow.com/questions/56091444/alv-refresh-problem-while-navigating-from-user-command