5 Replies Latest reply: Apr 3, 2012 4:24 PM by Valentin Catalin RSS

changing the container of ALV Tree

Biju.T. John
Currently Being Moderated

i have a Container of type cl_gui_splitter_container  say Main_container

and i have a two tree of type cl_gui_alv_tree  say tree1 , and tree2.

i am setting the parent of the tree1 as the Main_container.

 

now  say ..on a button click event is it possible to set Main_contaner as parent of tree2.

the parent is only asked during create object of tree ,

i couldnt find any method or way to set the parent container after object creation or is it possible?

 

is it like one container per tree or i can place multiple trees on the same container ?

  • Re: changing the container of ALV Tree
    Rajeev Goswami
    Currently Being Moderated

    Hi ,

    It seems that you want to display two  trees in one container , that's why you are  using splitter  container.

    For this first you need to create a main container of type cl_gui_custom_container , while creating object pass the name of container same as created in screen.

    Then create  splitter container object and  split main container in 1 row and 2 column by passing parameter rows = 1 and columns = 2 ,

    EX.

    CREATE OBJECT splitter EXPORTING 
                                  parent = main_container 
                                  rows = 1
                                 columns = 2.
    

    then get the reference  of first and second  splitted container using method "get_container" of class cl_gui_splitter_container  in cont1 and cont2 .

    DATA cont1 TYPE REF TO cl_gui_container.
    DATA cont2 TYPE REF TO cl_gui_container.
    CALL METHOD splitter->get_container 
                                 EXPORTING row = 1 
                                                      column = 1 
                                 RECEIVING container = cont1.
    
    CALL METHOD splitter->get_container 
                            EXPORTING row = 1 
                                                 column = 2 
                            RECEIVING container = container_2.
    

    While creating the object tree1 pass parent as cont1 and tree2 pass cont2.

     

    I hope this info may be usefull for you. for more info follow this articale

    Splitting the Custom Container and Display more than one ALV

    [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/50f1786c-a627-2e10-07b9-fefe548376ad]

     

    if you have any qurey please let me know

    Regards,

    Rajeev Goswami

     

    Edited by: rajeevgoswami1 on Feb 27, 2012 1:32 PM

     

    Edited by: rajeevgoswami1 on Feb 27, 2012 1:32 PM

  • Re: changing the container of ALV Tree
    Biju.T. John
    Currently Being Moderated

    i am using splitter container , my UI is similar to SE80 , on the top container  i have tool bar (vertical) and below on the bottom  i have the tree ,when the user clicks the buttons on the tool bar , depending on the context different trees should be shown on the bottom container . the problem is that  the first tree that is displayed will always be shown . if i want to show another tree i have to destroy the container and recreate it and then display the tree, if i create a tree and pass the existing container (without destroying)  the initial tree that was displayed will be shown and  not the new one.

    • Re: changing the container of ALV Tree
      Rajeev Goswami
      Currently Being Moderated

      Hi ,

      Each container will be associated to only one tree at a time , so its not possible to bind multiple trees in one single container.

      To achieve functionality like SE80 screen go for subscreens and custom container for each subscreen. then no need to distroy the tree.

      Change your layout as follows:

      1. Create a main screen .

      2. In top of screen  create vertical tool bar.

      3. In bottom create a subscreen area

      4. Create  subscreens with custom container  as many trees you want to display .

      5. Depending upon the botton clicked  display the subscreen and display tree in its container. 

       

      If you have any query please let me know.

      Regards,

      Rajeev Goswami

  • Re: changing the container of ALV Tree
    Biju.T. John
    Currently Being Moderated

    thanks for the valuable inputs ,

    but as i mentioned i am using splitter container along with docking container, coz i want the screen to be re sizable  like SE 80.

    but with the approach you mentioned i think it wouldn't be re sizable .

  • Re: changing the container of ALV Tree
    Valentin Catalin
    Currently Being Moderated

    Hi Biju,

     

    I have solved a similar problem just by having a new splitter control (let say with 2 columns and 1 row) in the given container and connect each tree with one of the new splitter control containers. Then, depending on what user is choosing just make visible or not those containers.

     

    Like initially container 1 is visible and container 2 is invisible. User action - container 1 becomes invisible and container 2 becomes visible.

     

    Take a look at the following methods of the splitter control which can be used to hide / display containers:

    set_column_width

    set_column_sash

     

    BR

Actions