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

How to create Tree Container

former_member295881
Contributor
0 Likes
1,044

Hello Experts!!!

I need to implement a Simple Tree. Iu2019ve already get an idea from the sample program

u2018SAPSIMPLE_TREE_CONTROL_DEMOu2019 how to implement. Now when I tried to create GUI through screen painter I donu2019t see any tree control or tree container which I can use. Can somebody please tell me how can I have TREE CONTAINER

Thanks a lot

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

Hi,

You can create a Custom Container through the Dynpro. That is all you need to embed the Tree Control. As such there is nothing called Tree Container.

Below is a sample code for the Custom Container.



  CREATE OBJECT l_custom_container
        EXPORTING
          container_name              = l_tree_container_name
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                      "#EC NOTEXT
      ENDIF.
    ENDIF.

* create tree control
    CREATE OBJECT tree2
      EXPORTING
        parent                      = l_custom_container
        node_selection_mode         = cl_gui_column_tree=>node_sel_mode_single
        item_selection              = 'X'
        no_html_header              = ''
        no_toolbar                  = ''
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        illegal_node_selection_mode = 5
        failed                      = 6
        illegal_column_name         = 7.
    IF sy-subrc <> 0.
      MESSAGE x208(00) WITH 'ERROR'.                        "#EC NOTEXT
    ENDIF.

l_custom_container is the variable that will contain the name of the custom container that you defined in the Dynpro.

Thanks,

Samantak.

Hello Experts!!!

I need to implement a Simple Tree. Iu2019ve already get an idea from the sample program

u2018SAPSIMPLE_TREE_CONTROL_DEMOu2019 how to implement. Now when I tried to create GUI through screen painter I donu2019t see any tree control or tree container which I can use. Can somebody please tell me how can I have TREE CONTAINER

Thanks a lot

3 REPLIES 3
Read only

Former Member
0 Likes
689

Hi,

You can create a Custom Container through the Dynpro. That is all you need to embed the Tree Control. As such there is nothing called Tree Container.

Below is a sample code for the Custom Container.



  CREATE OBJECT l_custom_container
        EXPORTING
          container_name              = l_tree_container_name
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                      "#EC NOTEXT
      ENDIF.
    ENDIF.

* create tree control
    CREATE OBJECT tree2
      EXPORTING
        parent                      = l_custom_container
        node_selection_mode         = cl_gui_column_tree=>node_sel_mode_single
        item_selection              = 'X'
        no_html_header              = ''
        no_toolbar                  = ''
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        illegal_node_selection_mode = 5
        failed                      = 6
        illegal_column_name         = 7.
    IF sy-subrc <> 0.
      MESSAGE x208(00) WITH 'ERROR'.                        "#EC NOTEXT
    ENDIF.

l_custom_container is the variable that will contain the name of the custom container that you defined in the Dynpro.

Thanks,

Samantak.

Read only

Former Member
0 Likes
688

Hi,

Refer the thread

Read only

former_member295881
Contributor
0 Likes
688

Thanks a lot Samantak. I've see that peice of code in SAPSIMPLE_TREE_CONTROL_DEMO.