Tree Display

Hi guys.
I want to create a tree display based on the following SAP standard program
SAPSIMPLE_TREE_CONTROL_DEMO.
Instead of "ROOT" i would like to display all company codes.
While clicking the Company Code it should display all the plants under that specific company code.
can anyone help me out?

in the standard porgram SAPSIMPLE_TREE_CONTROL_DEMO ...
The  Root was  defualt  passed  ....  if you want to  pass  the company  code  then ...
write  a  select  query for Company code and  pass  it ...... in  the below example  i am passing the <b>Purchase  order  list  to the RooT</b>. ....
FORM create_alvtree_hierarchy .
  DATA: NODE LIKE MTREESNODE,
        ld_node type string.
  LOOP AT it_ekko INTO wa_ekko.
* Build the node table.
* Caution: The nodes are inserted into the tree according to the order
* in which they occur in the table. In consequence, a node must not
* occur in the node table before its parent node.
*   Node with key 'Root'
    <b>node-node_key = wa_ekko-ebeln.</b> " 'Root'.   "#EC NOTEXT
    " Key of the node
    CLEAR node-relatkey.      " Special case: A root node has no parent
    CLEAR node-relatship.     " node.
    node-hidden = ' '.        " The node is visible,
    node-disabled = ' '.      " selectable,
    node-isfolder = 'X'.      " a folder.
    CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
    " use default.
    CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
    " use default
    CLEAR node-expander.      " see below.
    node-text = wa_ekko-ebeln.      "'Root'.
    APPEND node TO node_table.
    LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln EQ wa_ekko-ebeln.
*     Node with key wa_ekpo-ebelp    "'Child1'
      ld_node = sy-tabix.
      concatenate wa_ekpo-ebelp ld_node into ld_node.
      node-node_key = ld_node.  "'Child1'. #EC NOTEXT
*     Node is inserted as child of the node with key wa_ekpo-ebeln  "'Root'.
      node-relatkey = wa_ekpo-ebeln.  " 'Root'.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-hidden = ' '.
      node-disabled = ' '.
      node-isfolder = ' '.
      CLEAR node-n_image.
      CLEAR node-exp_image.
      node-expander = ' '.  " The node is marked with a '+', although
*                        it has no children. When the user clicks on the
*                        + to open the node, the event
*                        expand_no_children is fired. The programmer can
*                        add the children of the
*                        node within the event handler of the
*                        expand_no_children event
*                        (see method handle_expand_no_children
*                        of class lcl_application)
      node-text = wa_ekpo-ebelp.
      APPEND node TO node_table.
    ENDLOOP.
  ENDLOOP.
* Add nodes to alv tree
  CALL METHOD GD_TREE->ADD_NODES
    EXPORTING
      TABLE_STRUCTURE_NAME = 'MTREESNODE'
      NODE_TABLE           = NODE_TABLE
    EXCEPTIONS
      FAILED                         = 1
      ERROR_IN_NODE_TABLE            = 2
      DP_ERROR                       = 3
      TABLE_STRUCTURE_NAME_NOT_FOUND = 4
      OTHERS                         = 5.
ENDFORM.                    " create_alvtree_hierarchy
reward points if it is usefull ..
Girish

Similar Messages

  • Editable Field in ALV TREE Display Using OOPs

    Hi,
    I am trying to make a field editable on the ALV Tree display. I could create an editable check box. But could not make a field Editable. I have made EDIT = 'X' in the fieldcatalog for the particular field. but  it is not working.
    Please help me in solving this. Its very urgent.

    You do this with the following code example
      DATA: ls_layout TYPE lvc_s_layi.
      CLEAR ls_layout.
      ls_layout-class     = cl_item_tree_control=>item_class_text.
      ls_layout-editable   = 'X'.
      ls_layout-fieldname = your fieldname.
      APPEND ls_layout TO lt_layout.
    add PO header to tree
          CALL METHOD tree->add_node
            EXPORTING
              i_relat_node_key = space
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = l_node_text
              is_outtab_line   = ls_po_item
              is_node_layout   = wa_layout_node
              it_item_layout   = lt_layout
    Roy

  • Double click in ALV tree display....

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    My code as of now is as below:
    Please tell how to handle events in this report tree display and how and where to write the code for this functionlity of double click.
    FORM alv_tree.
    PERFORM build_sort_table.  “----
    table is sorted
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      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.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            i_parent              = l_custom_container
            i_node_selection_mode =
                                  cl_gui_column_tree=>node_sel_mode_multiple
            i_item_selection      = 'X'
            i_no_html_header      = ''
            i_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.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader.
      PERFORM build_comment USING
                     lt_list_commentary. “----
    already created
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    register events
      PERFORM register_events.
    create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    expand first level
      CALL METHOD tree1->expand_tree
             EXPORTING
                 i_level = 1.
    optimize column-width
      CALL METHOD tree1->column_optimize
               EXPORTING
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " alv_tree
    FORM register_events.
    define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    ENDFORM.                    " register_events

    hi
    (also check u have refresh the field)
    Check the demo program,In this double click the data fields it will display some field in screen,You can check it
    BCALV_GRID_DND_TREE
    Thanks
    Edited by: dharma raj on Jun 17, 2009 7:41 PM

  • Error when running a JHeadstart generated two-level tree display

    Dear All,
    I have a simple master detail VO/VO datamodel based on which I'd like to generate a two-level tree display. I've followed the JHeadstart dev guide meticulously.
    When I run the page I get an error:
    javax.faces.el.PropertyNotFoundException: Error getting property 'name' from bean of type oracle.jbo.uicli.binding.JUCtrlHierTypeBinding
    It turns out that this generated code in a region file is the root cause:
    <af:switcher facetName="#{node.hierType.name}">
    <!-- DEBUG:BEGIN:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2 -->
    <f:facet name="MutatieSoortTypenNode">
    <af:outputText value="#{node.Omschrijving}"/> </f:facet>
    <!-- DEBUG:END:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2-->
    <!-- DEBUG:BEGIN:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2 -->
    <f:facet name="MutatieSoortenBijTypeNode">
    <af:outputText value="#{node.Omschrijving}"/> </f:facet>
    <!-- DEBUG:END:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2-->
    </af:switcher>
    When I substituted the <af:switcher> .... </af:switcher> xml code by <af:outputText value="#{node.Omschrijving}"/>, the page displayed correctly.
    Given the fact that the code is generated, there doesn't seem to be much that I can do about it.
    We're using JDeveloper version 10.1.3.3.0 and JHeadstart version 10.1.3.2.41.
    Any help or suggestion would be much appreciated.
    Kind regards,
    Ibrahim

    Ibrahim,
    I cannot reproduce this. You are using a non-production build. Can you upgrade to JHeadstart 10.1.3.2.52?
    If the problem persists, you can work around it by creating a custom template for tree.vm which includes the af:switcher statement.
    Steven Davelaar,
    JHeadstart team.

  • Creating Variants in MIGO to block tree display in item overview

    Hi,
    I would like to know how to create Screen Variants in MIGO to hide the Tree display from the Item overview block.
    Also I wish to know how to set this variant as default settings. Because of this, user will not be able to even view the the sub-parts during GR.
    I am looking for this,  to prevent users from removing the sub-parts which are under that parent part.
    So they can be allowed to display only during display of document.
    Would be more thankful if you can send the detail steps to [email protected]
    Thanks,
    Pri

    Hi gurus,
    Can I have your advise on how to proceed for the below setting up of Screen variants in MIGO?
    Appreciate your response !
    Will sure reward for useful tips !
    regards,
    pri

  • Tree Display in WAD

    Hi all experts,
    I want to create a tree display, in which i have to hard code the some values.
    After clicking on those values I will link some reports.
    Can anybody please tell, is there any functionality available to create the tree display ?  Or I will have to go by coding in HTML / JAVA Script ?
    The display i want is like below.
    Root
          aaa
                 aaa1
                 aaa2
           bbb
                 bbb1
                 bbb2.
    by clicking on aaa1 it will have another link.
    Regards
    Vinay

    Hi Gillian,
    My requirement is I have to just hard code the tree like structure in WAD.  Later on I can link the things. 
    I have created and called the images, which on clicking, will change.. eg,, Plus and Minus., and open respective subtrees.
    Now the problem is I will have to join those images with horizontal and vertical lines. 
    That seems bit difficult. 
    I am new to WAD and JAVASCRIPT.
    Thats why I am searching <b>is there any code / functionality is available in javascript, which will give the tree like structure.</b>
    Waiting for your reply..
    Regards
    Vinay

  • I am displaying status (traffic signal ) in output screen in tree display

    hi all,
    i am displaying status (traffic signal ) in output screen in tree display but instead its displaying <b>@08@</b> like text format....is there any need of conversion....
    but it works in normal ALV grid layout.
    please suggest a solution....... !
    regards.
    sivaram.

    You need to do the following three steps in order to have "status" indicators on your ALV list:
    (1) Add a status or exception field to your itab definition, e.g.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES:  status(4)    TYPE c.      " status field for LED / traffic light
    INCLUDE TYPE KNB1.
    TYPES: END OF ty_s_outtab.
    DATA:
      gt_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                               WITH DEFAULT KEY.
    (2) Define the status field in the layout (LVC_S_LAYO):
      gs_layout-excp_fname = 'STATUS'.  " name of the status/exception field
      gs_layout-excp_led = 'X'.  " display LEDs, else traffic lights
    (3) Loop over the itab and set the appropriate status:
      LOOP AT gt_outtab INTO ls_outtab.
        IF ( <condition is fulfilled> ).
          ls_outtab-status = '3'.   " green
       ELSEIF ( <condition partially fulfilled> ).
          ls_outtab-status = '2'.   " yellow
       ELSE.
          ls_outtab-status = '1'.   " red
       ENDIF.
        MODIFY gt_outtab FROM ls_outtab.
      ENDLOOP.
    reward  points if it is usefull....
    Girish

  • Tree Display - Hierarchies

    Hello Experts,
                   I am trying to display a hierarchy from BI in VC. There are at least two workarounds methods that are found in SDN. Does anyone know when or which SP a tree display UI element is supported in VC?
    I am using NW 7 sp13.
    Thank you,
    Kiran

    Marcel,
    Based on Adobe's documentation, Flex 3 supports hierarchies. Do you know if VC in CE 7.1 supports Flex 3?
    Thanks,
    Kiran

  • Collape/expand in tree display.

    hi experts,
    how to implement expand/collapse function key in tree display.
    thanks in advance.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Nov 6, 2011 3:47 PM

    Hi Charu,
    Go through below sample.
    Link: [ALV TREE|http://wiki.sdn.sap.com/wiki/display/ABAP/CallFMtogeneratealvtreeanddealwithuseraction].
    Regards,
    Maruthi

  • JSPs and tree displays

    Has anyone made a tree display (like you can with javascript) using JSPs? If so, can you give me some direction as to how to get it accomplished?
    I want to grab the items from the backend and use JSPs to display the items in a tree structure similar to an explorer folders display.

    excuse me for my english
    It really depend on the way you design you database.
    Assume you have a table that contains item and it's parent id and a itemtype to indicates the category and items. So, the first level category's parent id will always be 0. So, you first select all category id with parent id equals zero and the you write a recursive function which will return you a string with it's child.
    hope this will help.

  • How do i update a tree display?

    I've created a tree, which will only be used as a display for values, but i'm not sure how to correctly update the tree if a value is changed.
    I just want to update the text for the changed node, and display the new view of the tree.
    Does anyone know a staight forward approach to doing this?
    Thanks in Advance!

    Apple - Support - iPod - Repair pricing
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipod
    How do I get my iPod serviced?
    Easy! If your iPod is still covered by Apple's Limited Warranty for iPod, we recommend you use theOnline Service Assistant. You may also contact Apple Technical Support, or take your iPod to your local Apple Retail Store to make service arrangements.
    Attention iPod shuffle customers: Service for iPod shuffle is performed by means of an express replacement program, via Online Service Assistant or Apple Technical Support. For more details, please review the Express Replacement Service tab on the left.

  • No tree displayed with WHERE clause (data issue?)

    I tried this on the apex.oracle.com workspace after it didnt run in our setup, and I ran into the same issue.
    I cant get the tree to display when I add a WHERE clause to the query.
    I know this isnt a problem with the WHERE clause, and has something to do with the data.
    If I just delete the data I dont want from the table (data_type <> 'S'), it WORKS, even with the WHERE clause.
    I have checked running the SQL, and the root element is returned.
    When I look at the HTML source of the page, I can see the js object created, though it seems to be constructed incorrectly.
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "DATA_TEXT" as title,
    null as icon,
    "ID" as value,
    null as tooltip,
    null as link
    from "#OWNER#"."T_ROOT_CAUSE_TEMPLATE"
    where (data_type='S' or id=346)
    start with id=346
    connect by prior "ID" = "PARENT"
    order siblings by "DATA_SEQUENCE"

    Just in case if you didn't know it, you can use WITH factoring clause when creating a tree. It makes it possible to create as many "tables" as you need, while the final hierarchical query (that is responsible for the way the tree looks like) is a simple one. This (+WITH+) approach is convenient as you can avoid repeating inline views and/or subqueries.
    For example, your query might have looked like this:
    with s_type as
      (select * from t_template
       where data_type = 'S'
          or id = 346
    select
      case when connect_by_isleaf = 1 then 0
           when level = 1 then 1
           else -1
      end as status,
      level,
      data_text as title,
      null as icon,
      id as value,
      null as tooltip,
      null as link
    from
      s_type
    start with id=346
    connect by prior id = parent
    order siblings by data_sequence

  • ALVOOPS with Two Tree display not clearing the prevoious fetched data

    I have screen 2000 (Main tree) and 3000 (Sub tree). From main tree an item is double click the corresponding item id is to be taken and populate the data based on the id and display in second Sub tree. I did the process.
    My problem is
    1st time the data is populating.
    2nd time fetching the 2nd id then process and creating the second tree data
    But finally display the 1st data
    I tried using Delete_all_node, cleared the table, free the container but no use
    Please help me.
    Regards,
    Anand Babu R

    I have screen 2000 (Main tree) and 3000 (Sub tree). From main tree an item is double click the corresponding item id is to be taken and populate the data based on the id and display in second Sub tree. I did the process.
    My problem is
    1st time the data is populating.
    2nd time fetching the 2nd id then process and creating the second tree data
    But finally display the 1st data
    I tried using Delete_all_node, cleared the table, free the container but no use
    Please help me.
    Regards,
    Anand Babu R

  • Tree Display in List

    I would like to display a Tree report in a list.
    I zeroed in on the following function group SEUT which contains the following
    function module RS_TREE_LIST_DISPLAY.
    Can some one provide me with the procedure to follow to go about using the
    functions in the Function group in order to achieve a display of the hierarchical
    tree in a list ???

    Hi
    Go to tcode DWDM>Controls->Tree Controls.
    you will find examples of program....
    (OR)
    Tcode SE83 -->Tree control....
    Reward points for useful Answers
    Regards
    Anji

  • Call Transaction in ALV Tree Display on Double Click

    Hi Experts,
    How can i call any Transaction on Double clicking  a field in ALV Tree?
    I'm able to call the transaction when Double clicked a field but it is not reading the value of the field on which i double click. It calls the transaction skipping the first screen with always the same value of the field.
          E.g : Whether i click on Purchase order no.  450000010 or 450000003 it displays the purchase order 4500000010 after it goes to ME23N transaction skipping the first screen.
            I am Trying Method ITEM_DOUBLE_CLICK of Class CL_GUI_COLUMN_TREE
    by passing the parameter NODE_KEY.But it's not working.
    Thanks & Regards,
    Vinit Ranjan

    hi
    (also check u have refresh the field)
    Check the demo program,In this double click the data fields it will display some field in screen,You can check it
    BCALV_GRID_DND_TREE
    Thanks
    Edited by: dharma raj on Jun 17, 2009 7:41 PM

Maybe you are looking for

  • How to get my Music and videos from my Macbook pro to apple TV

    I have some music and videos from my macbook that i have added to itunes from CD's and DVDs. Whenever i try to play music or movies on my apple TV it says that there is no music in the library. Is this because the items were not bought on itunes and

  • In AFAR amount is not calculate in 2008

    Hello Experts, while doing T Code : AFAR for fiscal year 2007 that time amount is calculate. i.e: Old amt. , New amt. , Difference amt 123.00 ; 23.00 ; 100.00 while doing T Code : AFAR for fiscal year 2008 that time amount is calculate. i.e: Old amt.

  • Has anyone had experience with these 2.5 IDE enlosures...?

    Hello, Has anyone had any experience with 2.5 " HD enclosures as seen on site like ebay for a buck...it says ts only wnodows based but its USB right? Super slim 2.5 inch USB2.0/1.1 Aluminium Hard Disk Drive Case/Enclosure transfer-rate of up to 480 M

  • AF:AUTOSUGGESTBEHAVIOR available in  AF:QUERY

    hi, the question is : when will AF:AUTOSUGGESTBEHAVIOR be available with AF:QUERY. Guess there is a Bug 12769579 (enhancement request) already raised for this. want to understand when would this be implemented and released with what version of ADF/JD

  • Student edition Adobe Acrobat XI Pro?

    How do I download my new student edition Adobe Acrobat XI Pro? I have the software download cardwith the serial number. When I go to the download page it is only available as a trial download in Portugese! I am in Australia. This has wasted a lot of