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

Destroy Container Object

michael_fallenbchel
Active Participant
0 Likes
6,014

Hi experts,

I have a problem with my Dynpro:

On this, I have a Tabstrip, 2 of then contains a Container which I use for an ALV.

Generating and filling this ALV I do in an external function, so I only know how the container is called.

On the top of this dynpro, I have listbox where I can choose a table - regarding my selection, the 2 tables will be filled.

No the problem: it could be, that after choosing a table from my listbox, the second ALV is filled. Now I choose another table in the listbox - nothing is "behind" this choosen table and the second ALV should be empty. But it's not so - because I don't call my function to create the ALV because I don't have a table to use.

Now the qeustino - is there a way to "clear" my custom container only by knowing the way of it? Something like

Clear container

Thanks in advance

Michael

Moderator message - Moved to the correct forum

Edited by: Rob Burbank on Sep 22, 2009 8:59 AM

16 REPLIES 16
Read only

aabhas_wilmar
Contributor
0 Likes
3,645

Try using FREE containter.

Hope you are also calling method REFRESHDISPLAY... (not near the system to tell you exact name) in PBO.

Edited by: Aabhas K Vishnoi on Sep 22, 2009 9:48 PM

Edited by: Aabhas K Vishnoi on Sep 22, 2009 9:49 PM

Read only

0 Likes
3,644

That's not possbile - I can't work with the container.

I create the container in my function:

CREATE OBJECT gs_container-o_container
        EXPORTING
          container_name = container_name.

I only know the container_name in my program. As you can see, the container is saved in an table (gs_container), which is dynamically filled.

I have no chance in the program to work with the container - only the container_name I have...

I called the function this way:

CALL FUNCTION 'ZZ_CREATE_ALV'
      EXPORTING
        container_name = 'T_ALV_BSP'
        tab_name       = ztool_buttons-tab_name
        alv_id         = '2'
      CHANGING
        output_tab     = <itab>.

container_name is my container (a custom container on the dynpro), tab_name is the name of the table I chose in the dropdown, alv_id means it's the second ALV and output_tab is the table I want to show in the ALV.

When <itab> is not assigned, I won't call the function - so if it has been called with an assinged itab, ALV will be filled, after that, itab is unassinged, function won't be called and so my ALV would keep the old itab.

I tried

T_ALV_BSP->free

Not right. Any other ideas?

Read only

0 Likes
3,644

have you tried:

call method cl_gui_cfw=>flush.

Read only

0 Likes
3,644

Sure, sorry, forget the metion this.

It also won't work...

Read only

0 Likes
3,644

hi,

you can use the free on your own container.. why not use that?

Read only

0 Likes
3,644

Hi,

how to do this?

I tried this way:

DATA: T_ALV_BSP TYPE REF TO cl_gui_custom_container.

and then

call method T_ALV_BPS=>FREE

Wont work because the container is always initial (I never create it in the program, only in my function)

Read only

0 Likes
3,644

As the container is only known in the function group, you have to free/destroy it in the function group, insure that it is defined in the TOP part of the function group and create a new function module in the same function group that will FREE it. Call this Z_FREE_ALV in the calling report.

You may need to keep the relation between the object container id and the container name in an internal table of the FG TOP include if multiple containers are managed.

Regards,

Raymond

Read only

0 Likes
3,644

you would be creating a screen on your program right? and a custom container where you are displaying your elements.

so? free this container.

else,

change the FM, pass some check flag kind of field and free the container there.

Read only

0 Likes
3,644

I won't change my function - so I have to check how to free my container.

It must be possible to say T_ALV-BS=> free and then all the kinds and relations would be deleted that are related to exactly this container...

Read only

0 Likes
3,644

Hello again,

I don't know how to free my container - so I thought about making a new fuction (Z_FREE_CONTAINER), where I make this.

Problem - How to get the name of the the container in my custom container?

I just know the name of this (T_ALV_BSP) - how to get the name of the related container?

Read only

0 Likes
3,644

Use the same parameters as in Z_CREATE_ALV. Also in Z_CREATE_ALV you should store in the function group data the values of container name, alv_id and container object created, so the second FM Z_FREE_CONTAINER will easily find the container id when reading a static internal table (and delete the record once container is freed)

Regards,

Raymond

Read only

0 Likes
3,644

Sure - but then I need to create the ALV with the function.

When I work an other way - it won't work.

Isn't there a way to say - this is my custom control (T_ALV_BSP), destroy all childs and everything what is related to this?

Read only

0 Likes
3,644

Did you try to use the LIFETIME parameter of objects you created ?

Read only

0 Likes
3,644

I've never used this...how to work with this?

Have I to enter how many seconds it should resist? Because Lifetime is type I...

Read only

0 Likes
3,644

For lifetime description look here:

[lifetime|http://help.sap.com/saphelp_nw70/helpdata/en/06/3fa1a59f2811d2bd68080009b4534c/content.htm]

These constants are attributes of class cl_gui_control.

However, I'm not sure if this will do you any good. haven't read the entire post (yet).

Read only

Former Member
0 Likes
3,644

enable the list with user command.

and at PBO you can check the do this job of clearing the container by using method : "FREE" of cl_gui_alv_grid

and also use : call method cl_gui_cfw=>flush.

Edited by: Soumyaprakash Mishra on Sep 22, 2009 5:18 PM