‎2009 Sep 22 12:35 PM
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 containerThanks in advance
Michael
Moderator message - Moved to the correct forum
Edited by: Rob Burbank on Sep 22, 2009 8:59 AM
‎2009 Sep 22 12:47 PM
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
‎2009 Sep 22 12:55 PM
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->freeNot right. Any other ideas?
‎2009 Sep 22 12:57 PM
‎2009 Sep 22 12:59 PM
‎2009 Sep 22 1:15 PM
hi,
you can use the free on your own container.. why not use that?
‎2009 Sep 22 1:17 PM
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=>FREEWont work because the container is always initial (I never create it in the program, only in my function)
‎2009 Sep 22 1:51 PM
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
‎2009 Sep 22 1:52 PM
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.
‎2009 Sep 22 1:54 PM
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...
‎2009 Sep 23 8:17 AM
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?
‎2009 Sep 23 8:40 AM
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
‎2009 Sep 23 8:48 AM
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?
‎2009 Sep 23 9:50 AM
‎2009 Sep 23 9:57 AM
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...
‎2009 Sep 23 12:07 PM
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).
‎2009 Sep 22 12:47 PM
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