2007 May 09 1:04 PM
I am able to get all live classes of a dynpro by using method cl_gui_cfw=>get_living_dynpro_controls. (Also thanks to this forum).
The resulting table has a reference to a class like ...
.
How do I use this reference to:
1. Get the objects for it?
2. How can I then free the object from memory by using the "free" method.
I guess I am asking how to dynamically assign it, then make sure it has a free method and then to use the method to actually free it.
Hello Uwe
My first reaction was "NO it cannot be that easy!!". It almost was but on the second line I get a short dump. Then I realised why: the other live control in the table was a sub class of the first class and as a result it was cleared on the first call.
So I modified the call to be a recursive call (of the form) as follows...
form clear_live_controls .
DATA:
gt_list TYPE cnto_control_list,
gt_wa like line of gt_list.
REFRESH: gt_list.
CALL METHOD cl_gui_cfw=>get_living_dynpro_controls
IMPORTING
control_list = gt_list.
describe table gt_list lines tab_lines.
if tab_lines = 0.
* Nothing
else.
loop at gt_list into gt_wa.
gt_wa->free( ).
exit.
endloop.
perform clear_live_controls.
endif.
endform. " clear_live_controlsThis took care of it.
Many thanks for your help.
Regards
2007 May 09 1:17 PM
Hello Johan
Method cl_gui_cfw=>get_living_dynpro_controls return the living control instance in a table type CNTO_CONTROL_LIST (TYPE REF TO CL_GUI_CONTROL OCCURS 0, type-pool CNTO).
Thus, simply loop over the itab because CL_GUI_CONTROL is the superclass of all other GUI controls:
DATA:
lo_control TYPE REF TO cl_gui_control,
lt_controls TYPE cnto_control_list.
" lt_controls contains the living control instances
LOOP AT lt_controls INTO lo_control.
lo_control->free( ).
ENDLOOP.Regards
Uwe
2007 May 09 1:47 PM
Hello Uwe
My first reaction was "NO it cannot be that easy!!". It almost was but on the second line I get a short dump. Then I realised why: the other live control in the table was a sub class of the first class and as a result it was cleared on the first call.
So I modified the call to be a recursive call (of the form) as follows...
form clear_live_controls .
DATA:
gt_list TYPE cnto_control_list,
gt_wa like line of gt_list.
REFRESH: gt_list.
CALL METHOD cl_gui_cfw=>get_living_dynpro_controls
IMPORTING
control_list = gt_list.
describe table gt_list lines tab_lines.
if tab_lines = 0.
* Nothing
else.
loop at gt_list into gt_wa.
gt_wa->free( ).
exit.
endloop.
perform clear_live_controls.
endif.
endform. " clear_live_controlsThis took care of it.
Many thanks for your help.
Regards
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |