Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_GUI_CUSTOM_CONTAINER

Former Member
0 Likes
4,795

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

2 REPLIES 2
Read only

Former Member
0 Likes
1,476

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

Read only

Former Member
0 Likes
1,476

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.