Displaying icons in tree view control

Hi all
        i am trying to display  icons in my tree view control.I am using beow code but i am not getting the ouput.Please help me.
Type-pools : fibs,stree , ICON.
data : t_node type snodetext.
data : node_tab like t_node occurs 0 with header line,
       it_icon_id type icon-id.
clear : node_tab, node_tab[].
select single id from icon into it_icon_id
       where name = 'ICON_CUSTOMER'.
node_tab-type = 'T'.
node_tab-name = 'Earth'.
node_tab-tlevel = '01'.
node_tab-nlength = '5'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
node_tab-NODEICON = it_icon_id.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Europe'.
node_tab-tlevel = '02'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
node_tab-NODEICON = it_icon_id.
append node_tab.
clear node_tab.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
EXPORTING
  INSERT_ID                = '000000'
  RELATIONSHIP             = ' '
  LOG                      =
  TABLES
    NODETAB                  = node_tab
EXCEPTIONS
  TREE_FAILURE             = 1
  ID_NOT_FOUND             = 2
  WRONG_RELATIONSHIP       = 3
  OTHERS                   = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
  DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
  DATA: wa_type TYPE stree_ctl_type_mapping.
  CLEAR: type_mapping[].
    wa_type-type = 'A'.
    wa_type-icon = '@A0@'.
    APPEND wa_type TO type_mapping.
CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'
EXPORTING
    CONTROL_PATTERN             = 'PH'
    MULTIPLE_SELECTION          = 'X'
     TYPE_MAPPING                = type_mapping.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
LAYOUT_MODE                     = ' '
  USE_CONTROL                     = STREE_USE_LIST.
Thank you.
Regards
Giri.

Here is another option using <ICON> include,
*& Report  ZKB_TREE_EXAMPLE
REPORT  zkb_tree_example.
INCLUDE <icon>.
TYPES: BEGIN OF t_sbook,
        customid TYPE sbook-customid,
        fldate TYPE sbook-fldate,
        bookid TYPE sbook-bookid,
      END OF t_sbook.
DATA: i_sbook TYPE TABLE OF t_sbook,
      w_sbook TYPE t_sbook.
SELECT-OPTIONS: s_custid FOR w_sbook-customid.
DATA: o_custom_container  TYPE REF TO cl_gui_custom_container,
      o_tree              TYPE REF TO cl_gui_simple_tree.
TYPES: t_node_table LIKE TABLE OF trstree.
DATA: i_node TYPE t_node_table,
      w_node TYPE LINE OF t_node_table.
START-OF-SELECTION.
  CALL SCREEN 9000.
*&      Module  status_9000  OUTPUT
      text
MODULE status_9000 OUTPUT.
  SET PF-STATUS '9000'.
ENDMODULE.                 " status_9000  OUTPUT
*&      Module  user_command_9000  INPUT
      text
MODULE user_command_9000 INPUT.
  CASE sy-ucomm .
    WHEN 'BACK' OR 'EXIT'.
      SET SCREEN 0.
      LEAVE SCREEN.
  ENDCASE.
ENDMODULE.                 " user_command_9000  INPUT
*&      Module  init_9000  OUTPUT
      text
MODULE init_9000 OUTPUT.
  DATA: lw_sbook TYPE t_sbook.
  SELECT customid fldate bookid FROM sbook
         INTO TABLE i_sbook WHERE customid IN s_custid.
  SORT i_sbook BY customid ASCENDING.
  CREATE OBJECT o_custom_container
       EXPORTING
            container_name              = 'TREE'
       EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
  IF sy-subrc <> 0.
    MESSAGE 'Error Creating Container' TYPE 'E'.
  ENDIF.
  CREATE OBJECT o_tree
       EXPORTING
           parent                      = o_custom_container
           node_selection_mode         =
                             cl_gui_simple_tree=>node_sel_mode_single
       EXCEPTIONS
           lifetime_error              = 1
           cntl_system_error           = 2
           create_error                = 3
           failed                      = 4
           illegal_node_selection_mode = 5.
  IF sy-subrc <> 0.
    MESSAGE 'Error Creating Tree' TYPE 'E'.
  ENDIF.
Add ROOT Folder
  CLEAR w_node.
  w_node-node_key  = 'ROOT'.
  w_node-text      = 'Root'.
  w_node-isfolder  = 'X'.
  APPEND w_node TO i_node.
  CLEAR lw_sbook .
  LOOP AT  i_sbook INTO w_sbook.
    IF lw_sbook-customid NE w_sbook-customid.
      lw_sbook-customid = w_sbook-customid.
      CLEAR w_node.
      w_node-node_key  = w_sbook-customid.
      w_node-text      = w_sbook-customid.
      w_node-relatkey  = 'ROOT'.
      w_node-relatship = cl_gui_simple_tree=>relat_last_child.
      w_node-isfolder  = 'X'.
      APPEND w_node TO i_node.
    ENDIF.
    CLEAR w_node.
    w_node-node_key  = w_sbook-bookid.
    w_node-relatkey  = w_sbook-customid.
    w_node-relatship = cl_gui_simple_tree=>relat_last_child.
    w_node-text      = w_sbook-bookid.
<b>    w_node-n_image = icon_customer.</b>
    APPEND w_node TO i_node.
  ENDLOOP.
  CALL METHOD o_tree->add_nodes
    EXPORTING
      table_structure_name           = 'TRSTREE'
      node_table                     = i_node
    EXCEPTIONS
      failed                         = 1
      error_in_node_table            = 2
      dp_error                       = 3
      table_structure_name_not_found = 4
      OTHERS                         = 5.
  IF sy-subrc <> 0.
    MESSAGE 'Error Adding Node to Tree' TYPE 'E'.
  ENDIF.
Expand tree
  CALL METHOD o_tree->expand_root_nodes
    EXPORTING
      level_count    = 2
      expand_subtree = ' '
    EXCEPTIONS
      OTHERS         = 1.
  IF sy-subrc <> 0.
    MESSAGE 'Error Expanding Tree' TYPE 'E'.
  ENDIF.
ENDMODULE.                 " init_9000  OUTPUT
Regards
Kathirvel

Similar Messages

  • Icon in tree view control

    Hi all
           I want to display an icon in tree view.These icons must be displayed before the node.for this purpose i am using below code.But i didn't find the icon in my output.Please help me to do this.
    Thanks in advance.
    REPORT  ZTREEVIEW_TEST_PROGRAM no standard page heading.
    Type-pools : fibs,stree.
    data : t_node type snodetext.
    data : node_tab like t_node occurs 0 with header line.
    clear : node_tab, node_tab[].
    node_tab-type = 'T'.
    node_tab-name = 'Earth'.
    node_tab-tlevel = '01'.
    node_tab-nlength = '5'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    node_tab-NODEICON = 'C:\Program Files\SAP\FrontEnd\SAPgui\bitmap\l_b_odsa'.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Europe'.
    node_tab-tlevel = '02'.
    node_tab-nlength = '6'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 4.
    node_tab-NODEICON = 'C:\Program Files\SAP\FrontEnd\SAPgui\bitmap\l_b_odsa.bmp'.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Germany'.
    node_tab-tlevel = '03'.
    node_tab-nlength = '7'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 4.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Berlin'.
    node_tab-tlevel = '04'.
    node_tab-nlength = '6'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Asia'.
    node_tab-tlevel = '02'.
    node_tab-nlength = '4'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'India'.
    node_tab-tlevel = '03-'.
    node_tab-nlength = '5'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Bombay'.
    node_tab-tlevel = '04-'.
    node_tab-nlength = '6'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    EXPORTING
      INSERT_ID                = '000000'
      RELATIONSHIP             = ' '
      LOG                      =
      TABLES
        NODETAB                  = node_tab
    EXCEPTIONS
      TREE_FAILURE             = 1
      ID_NOT_FOUND             = 2
      WRONG_RELATIONSHIP       = 3
      OTHERS                   = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
      DATA: wa_type TYPE stree_ctl_type_mapping.
      CLEAR: type_mapping[].
        wa_type-type = 'A'.
        wa_type-icon = '@BL@'.
        APPEND wa_type TO type_mapping.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
      LAYOUT_MODE                     = ' '
       USE_CONTROL                     = STREE_USE_LIST.
    Regards
    Giri

    Giri,
    you can use SAP standard icons only - see table ICON and include TYPE-POOLS: icon in your program.
    If you can't use standard icon, it will be more complex.
    Regards,
    Clemens

  • Expand=false for Tree view control

    Hi 
    I have a placed a tree view control on SharePoint 2010 master page  and given sitemap as a datasource.
    and my tree view is displaying all the links from sitemap file.
    But here the problem is all the node are getting expanded.
    Is there any way to disable that.

    Assuming you are using SPTreeview control you can set ExpandDepth property. This property gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time.
    Example: http://msdn.microsoft.com/en-us/library/ms466994(v=office.14).aspx
    Amit

  • Tree view control - populating speed - over 100 nodes

    I have a few questions about a tree view control:
    1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
    I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
    2. After we put the patch 5 of developer6, tree view control is totally unpredictable. Usually its when you programmaticaly try to select a node (ftree.set_tree_selection)...Anybody have the same problems?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Natasa Stojovska ([email protected]):
    I have a few questions about a tree view control:
    1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
    I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
    <HR></BLOCKQUOTE>
    Try taking out the 'start with' and 'connect by' clauses in your select statement if you're using them. However, this will mean that you will have to determine the levels of the tree manually and ensure that the data comes out in the same order each time you execute the select statement.
    null

  • How to add Icon in Tree View in Forms 6.0 (URGENT..!)

    Hello All,
    I want to add icons in tree view (hierarchical tree) by using
    forms 6.0.
    So pls. help me to find out the solution for the same.
    thanks
    Pradeep
    null

    Pradeep (guest) wrote:
    : Hello All,
    : I want to add icons in tree view (hierarchical tree) by using
    : forms 6.0.
    : So pls. help me to find out the solution for the same.
    : thanks
    : Pradeep
    hello pradeep,
    for adding icons in the tree, u willhave to look closely to the
    data format for the tree.in the data format used for populating
    the tree we are supplying 5 fields. the state of the tree node
    (expanded or collapsed), the depth of the node w.r.t the parent
    node, the node value, the node label(what we see on the tree)
    and the node icon which we want to use. for the node icon we
    have to provide the entire path of the icon file. that's it.
    hope this will solve the problem
    null

  • Tree view control print

    Hi all
          I want to set a print option for the tree view control along with back,exit etc options.please help me to do this.
    Thanks in regards
    Regards
    Giri

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Natasa Stojovska ([email protected]):
    I have a few questions about a tree view control:
    1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
    I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
    <HR></BLOCKQUOTE>
    Try taking out the 'start with' and 'connect by' clauses in your select statement if you're using them. However, this will mean that you will have to determine the levels of the tree manually and ensure that the data comes out in the same order each time you execute the select statement.
    null

  • How to handle tree view control in business one ui sdk

    Hi,
    Can any guide me on how to handle tree view control in business one ui sdk?
    Thanking in advance.
    With Regards,
    Ram.

    Hi Ram,
    Nowadays there are some trouble with the treeview controls in Windows XP SP2 as you can see here:
    It is said that SAP will publish a treeview control in 2005 SP1.
    Hope helps,
    Ibai Peñ

  • Total sum to be displayed in a table view control ?

    Hi,
      I am unable to display the total sum of a column in a table view control( using HTMLB ). How should one display the sum of a column ?
    THanks in advance,
    VaraPrasad

    Hi,
    it should work once you are restricting the capacity of the out put port then it should provide that much rows only otherwise its a Bug.
    Alternativily you are tellin to disaply using sorting then add a Sort operator to the output port and the display ur output port in down order.
    But first option should work just check it again.
    On which SP u r working?
    Regards,
    Govindu

  • How to display icon status in table control

    hi, i trying to display icon in table control its not displaying
    i given below statment.
    DATA: BEGIN OF WA_MARA,
            ICON1(4) TYPE C,
             END OF WA_MARA.
         INCLUDE <list>.
    MOVE ICON_GREEN_LIGHT TO IT_MARA-ICON1.
    APPEND IT_MARA..
    when i debugging it display green icon but after run the program its display ' @08@ '   in table control.
    how to display green icon in table control help me.

    Hi,
    check the link:
    Table control in custom infotypes

  • Tree view control font size

    Hello,
    (LabVIEW 8.0): I have found that the font size of the tree view items can be set at design time from the drop down list on the menu bar.  However, is it possible to make each "level" (i.e. parent = a level, child = different level, grandchild = still another level) have a different font size to clearly differentiate one level from the next?
    Thanks,
    Chris 

    try a property node...
    Attachments:
    Clipboard-2.jpg ‏76 KB

  • Tree view display along with icons

    Hi all
           Anybody please give me the complete code to display the tree view which takes input from selection screen.I also need to display icons in the tree view.please help its urgent.
    Thank you.
    Regards
    Giri

    Hi giri ,
      Chk this program SAPSIMPLE_TREE_CONTROL_DEMO
      Displaying icon in tree view

  • Tree View Icons

    Dear All,
    how can i display the icon in tree view .
    Thanks...

    You have to post in forms forum.
    Forms

  • JSF tree view GUI component and tree node actions

    Hi,
    I am new in using JSF and have a problem with my simple test application.
    The application contains a tree view control with one static tree node and a separate text area. Clicking on the tree node shall fill the text area with the string 'hello'. Seems to be very simple, but it doesn't work.
    What did I do?
    First of all I use the Sun Java Studio Creator 2.
    By double clicking on the tree node in the design window of the IDE a method called treeNode1_action() was created. I also added the String text to the session bean. treeNode1_Action() does not more than setting text='hello' ( getSessionBean().setText('hello'); ).
    The jsp file contains the line
    <ui:textArea binding="#{Page1.textArea}" id="textArea" style="height: 192px; left: 360px; top: 48px; position: absolute; width: 456px" text="#{SessionBean1.text}"/>, so the text of the text area is bound to the session property 'text'.
    Running the application and clicking on the tree node does nothing except reloading the page (no 'hello' inside the text area).
    Using the debugger showed me that the bean property text is set correctly to 'hello', also after reloading the page.
    What did I do wrong?
    What do I have to do to display 'hello' in the text area?
    I would be glad for some good advice to solve my problem and looking forward for an answer.
    Regards from germany
    Matthias

    want to remove the green patch from the jsf tree componentas u said ,, it is COMPONENET so this is a pre-made creator component that u cant chnage its attributes ,,
    instead u can extract Theam.jar file and change the icons ,, u i didnt do it before ,, but u may be find what u want there,
    hope this will help
    good luck
    Mohammed

  • Please Help(How to get RadioButtons in tree View)

    Hi.
    Sub/Requirement: How to implement RadioButtons in tree view with/without using xml file.
    I have a requirement like this i want to display RadioButton in tree view.
    I implemented tree same as which is given in sampleApplications.
    In this sampleApplications they implemted tree by using xml file.
    I also implemented tree by Generating xml file. In this xml file i get the values from the database. I am using <netui:tree > tag.
    Is it possible to implement tree without using xml file. I need to generate tree Dynamically.
    Please any one help me to come out with this solution.

    The issue here is while you are retrieving all the details, you are consistently overwriting them in the request.setAttribute() call before you get to the JSP to display them.
    Do you actually have a class/object called Student?
    That object should have attributes for classes, subjects, teachers (all of which are lists apparently)
    public class Student{
      String name;
      List classes;
      List subjects;
      List teachers;
      // appropriate getter/setter methods
    }Then you load each student, and populate its individual lists.
    That lets you pass the list of students, each student having its own lists for display.
    Hope this helps,
    evnafets

  • How to have a tree view for value node..

    Hi all,
    I need to display a tree view for a value node in web ui  just like a model node, for a custom view in a pop up. Please guide me  how to do this or let me know the process steps.
    Thanks in advance.

    Hi All,
    while debugging I found that in class CL_BSP_WD_CONTEXT_NODE_TREE , the method GET_T_TABLE the below code is not triigerring for the child node attributes ( to trigger the get method of attribute for value node).
    this call method is not triggering at all only for first coulmn its triggering ..
      LV_TN ?= ME->NODE_MAPPER->GET_NODE_OBJECT( <LINE>-NODE_KEY ).
        CONCATENATE 'GET_' COMPONENT INTO LV_METHOD.
        TRY.
            CALL METHOD LV_TN->(LV_METHOD)
              EXPORTING
                ATTRIBUTE_PATH = ''
              RECEIVING
                VALUE          = VALUE.
          CATCH CX_ROOT INTO LV_ERROR.
    I created the GETTER method inthe class CN01 and CN02. But those methods are not triggered in CALL METHOD LV_TN->(LV_METHOD). Even that class CN02 is having the  same methods. Those methods are already Implemented. May I know what was the reason Why those methods are not triggered ( getter method ). With out that Method data will not display in the Tree view. Can anybody tell me the reason why it is not happenning?
    .Please find the below .HTM code  as well.
    <chtmlb:configTree
                          actionsMaxInRow       = "5"
                       id             = "Table1"
                       nodeTable      = "<%= ZTREEVIEW->node_tab %>"
                       table          = "//ZTREEVIEW/Table"
                       noFrame        = "FALSE"
                       personalizable = "TRUE"
                       onCollapseNode = "NODECOLLAPSE"
                       selectionMode  = "MULTILINEEDIT"
                       onExpandNode   = "NODEEXPAND"
                       onRowSelection = "select" />
    Only one column was triggered another column did not get any value becasue of the above method call fail.. We are not restricted anywhere to display one column value in the output.   Even in Debugging I checked that LV_METHOD  is having the method name. CN02 class is also having the  same method, But it is not going into the method. It is coming out side. What could be  the reason I could not able to understnad.
    Please provide me some pointers on the issue....
    Thanks in advance..

Maybe you are looking for

  • Outlook Sync Problem with Torch 9800

    I have always problems to Sync my 9800 to Outlook, I know this problem is caused because for some reason son calendar entries with Attendees field starting  ""< fails, and I get the message: Error encountered. Error Code 0x80040fb3. Check Documentati

  • I can't print to my RICOH AFICIO SP C410DN

    I've tried for a week now to figure out how to coneect my RICOH AFICIO SP C410DN to no avail. HELP? My printer is connected via an ehternet cable from my modem to the ethernet port on my printer. I go to Printers & Scanners and it will not find it. W

  • Business scenarios

    hi to all this is reddy i am preparing a questionaire of a project, and it is releated to few scenarois, we have no information about the exact business of the firm, and i am preparing a document releated to the business scenarios like OTC,MTO, Sales

  • Missing Batches Number (Nonsplit Batch or Split Batch) in Invoice

    Hi guys, I need some help on you guys on following: I have a SO without batches information and I have interco PO with batches information. I create Invoice base on SO, therefore Invoice doesn't capture Batch or Split Batches information from PO. Is

  • CS6 "There was an error writing metadata" message PC and Mac

    I have seen this in the forums but looks like no one has an answer yet. Adobe chat support was totally not helpful. I am getting an error message when trying to apply keywords to some images in Bridge. The error is very non-specific, all it says is "