‎2008 Jun 03 10:29 AM
Hi xperts,
I am using CL_GUI_CUSTOM_CONTAINER class in one of my module pool program. Could you please explain me what is the usage of Free method in this class in detail, if possible with some examples.
Thanks,
Rahul
‎2008 Jun 03 11:28 AM
Hi,
The FREE-method is the destructor for the object-reference of the class CL_GUI_CUSTOM_CONTAINER.
Example:
Free-text-field on dynpro 2000.
DATA: gr_text_container TYPE REF TO cl_gui_custom_container,
gr_text TYPE REF TO cl_gui_textedit.
CREATE OBJECT gr_text_container
EXPORTING
container_name = 'GR_TEXT_CONTAINER'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT gr_text
EXPORTING
parent = gr_text_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
wordwrap_to_linebreak_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5.Now the user is leaving this dynpro (e.g. back-button), therefore you should free the object-reference:
CALL METHOD gr_text_container->free( ).
CLEAR: gr_text_container,
gr_text.
CALL METHOD cl_gui_cfw=>flush.Hope it helps.
Regards,
Sven
‎2008 Jun 03 12:33 PM
it will free memory occupied by object..
suppose u wann display 2 alv dynamically then u can delete existing one and make new
example to free
CALL METHOD picture->free
EXCEPTIONS cntl_error = 1
cntl_system_error = 2.