Generating trees in list

Hi,
I have to generate a tree kind of list(nodes collapsable and expandable)based on a table.
My table is containing 3 fields relevent to this task.
one field(F1) contains nodes, second field(f2) contains the parent node of node in F1, the third field(f3) contains one of its child node.
-> A NODE IN F1 HAVING F2 AS EMPTY WILL BE A ROOT NODE WHICH COMES IN THE UPPERMOST LEVEL.
->A NODE MAY HAVE MULTIPLE CHILD NODES, i.e. DIFFERENT F3 ENTRIES WILL EXIST FOR A COMBINATION OF F1 AND F2.
My requirement is... Can anyone tell me the relevant FUNCTION MODULE which takes these fields as input and generate me tree structure(nodes collapseble and expandable) in list...???

hi,
check the sample code...
REPORT  ZTEST_TREE.
TABLES: KNVH.
TYPES: BEGIN OF WORKTYPE,
         LEVEL(2),
         HKUNNR LIKE KNVH-KUNNR,
         KUNNR  LIKE KNVH-HKUNNR,
       END OF WORKTYPE.
DATA: IT_KNVH TYPE TABLE OF WORKTYPE,
      WA_KNVH LIKE LINE OF IT_KNVH,
      IT_TEMP TYPE TABLE OF WORKTYPE,
      WA_TEMP LIKE LINE OF IT_TEMP,
      IT_WORK TYPE TABLE OF WORKTYPE,
      WA_WORK LIKE LINE OF IT_WORK.
DATA : BEGIN OF IT_NODES OCCURS 0.
        INCLUDE STRUCTURE SNODETEXT.
DATA : END OF IT_NODES.
CONSTANTS: NUMBER_OF_LEVELS TYPE I VALUE 6.
PARAMETER: P_HKUNNR LIKE KNVH-HKUNNR.
START-OF-SELECTION.
* Parent = 1. hierarchy node
WA_TEMP-KUNNR = P_HKUNNR.
APPEND WA_TEMP TO IT_TEMP.
WA_WORK-KUNNR = WA_TEMP-KUNNR.
WA_WORK-LEVEL = 1.
APPEND WA_WORK TO IT_WORK.
* Reading customer hierarchy (max. 6 level)
DO NUMBER_OF_LEVELS TIMES.
  CHECK NOT IT_TEMP IS INITIAL.
  SELECT KUNNR HKUNNR
    FROM KNVH
    INTO CORRESPONDING FIELDS OF TABLE IT_KNVH
    FOR ALL ENTRIES IN IT_TEMP
    WHERE HKUNNR = IT_TEMP-KUNNR.
  LOOP AT IT_KNVH INTO WA_KNVH.
    WA_KNVH-LEVEL = SY-INDEX + 1.
    APPEND WA_KNVH TO IT_WORK.
  ENDLOOP.
  IT_TEMP[] = IT_KNVH[].
ENDDO.
* Hierarchy nodes -> tree control
LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 1.
  PERFORM MAKE_NODE.
  LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 2 AND
                                     HKUNNR = WA_WORK-KUNNR.
    PERFORM MAKE_NODE.
    LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 3 AND
                                       HKUNNR = WA_WORK-KUNNR.
      PERFORM MAKE_NODE.
      LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 4 AND
                                         HKUNNR = WA_WORK-KUNNR.
        PERFORM MAKE_NODE.
        LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 5 AND
                                           HKUNNR = WA_WORK-KUNNR.
          PERFORM MAKE_NODE.
          LOOP AT IT_WORK INTO WA_WORK WHERE LEVEL = 6 AND
                                          HKUNNR = WA_WORK-KUNNR.
            PERFORM MAKE_NODE.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDLOOP.
  ENDLOOP.
ENDLOOP.
* Making the tree control
CALL FUNCTION 'RS_TREE_CONSTRUCT'
       TABLES
            NODETAB      = IT_NODES
       EXCEPTIONS
            TREE_FAILURE = 1.
* Display the tree control
  DATA : F15 TYPE C.
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
       EXPORTING
            CALLBACK_PROGRAM      = SY-REPID
       IMPORTING
            F15                   = F15 .
FORM MAKE_NODE.
  IT_NODES-NAME = 'test'.
  IT_NODES-COLOR = 1.
  IT_NODES-INTENSIV = 1.
  IT_NODES-TEXT = WA_WORK-KUNNR.
  IT_NODES-TLENGTH = 16.
  IT_NODES-TLEVEL = WA_WORK-LEVEL.
  IT_NODES-TCOLOR = 1.
  IT_NODES-TINTENSIV = 1.
  APPEND IT_NODES.
ENDFORM.
Regards
vijay

Similar Messages

  • How to add text dynamically in  Tree view list box

    CS3/WIN<br />hi,<br />I am new in plugin development.<br />I have a Tree View List box on a dialog.<br />b I don't want to display text when i load the plugin.<br />b I want to insert text data when i click on "Insert" button on dialog. <br />I have defined  Adapter,Mgr,Observer for list box.it is working fine when i want to display data at loading time itself.but not when i click on insert button.<br />b In dialog observer i have defined this but it is not working<br /><br />b Dialog Observer::Update<br /><br />InterfacePtr<IPanelControlData> panelControlData(this, UseDefaultIID());<br />IControlView* Grid = panelControlData->FindWidget(kESSGridTVWidgetID);<br />InterfacePtr<IStringListControlData> listControlData(Grid,UseDefaultIID());<br />if (theSelectedWidget == kESSInsertButtonWidgetID && theChange == kTrueStateMessage) <br />{<br />listControlData->AddString(strText,kESSListBoxTextWidgetID); <br />}<br /><br />b it is showing error  <br />b operator new returning nil for an allocation size of 486022320 bytes<br />(..\..\..\source\components\memoryallocator\PMNew.cpp (552))<br />b Memory allocation failure<br />(c:\development\cobalt\source\public\includes\K2Allocator.h (131))<br />can any one help to get this..<br />Thanks.

    How to populate list in tree view  dynamically
    Hi,
    I am new to  Indesign Plugin creation.
    I want to create list in tree view dynamically.
    I tried wlistboxcomposite sdk sample in indesign cs4.
    I have some doubts in this.
    1. Can i write my own method in  WLBCmpTreeViewAdapter class because it's implements ListTreeViewAdapter
    If it's possible how can i call this method.
    2. In this example they populating static string in constructor like this
    WLBCmpTreeViewAdapter::WLBCmpTreeViewAdapter(IPMUnknown* boss):ListTreeViewAdapter(boss){
    K2Vector<PMString> lists;
    for (int32 i = 0; i< 12; i++){
    PMString name(kWLBCmpItemBaseKey);name.AppendNumber(i+1);name.Translate();lists.push_bac k(name);}
    InterfacePtr<IStringListData> iListData(
    this, IID_ISTRINGLISTDATA);}
    and this list is populating on loading time but my requirement is i have one button "get list" after clicking this button i have to populate the list, how can
    i achieve this.
    Pls do needful.
    Thanks
    Arun

  • TEM - Generate To Do list is not displayed

    Hi
    We are running on a 4.7 (add-on 1.0)  and are about to implement Training & Event on a global scale.
    The Master Data Catalogue for TEM is created together with the appraisal documents that we want to use.
    I have created a relationship between object D and BS (Business event appraisal) but that just gives me a chance to select which appraisal document I wan't to create.
    My problem is that I cannot get the system to display the 'Generate To Do list'.
    I hope that someone has an idea of what I'm missing to configure.
    Thanks in advance
    Ronnie Nielsen

    Are you referring to something I posted here or on my site?
    This bug was reported a few weeks back and I believe it was reported. However, the more people who report it affects them etc...
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    See www.grainge.org for RoboHelp and Authoring tips

  • Generate reports from lists in SharePoint 2013 (Office 365)

    Hello everyone,
    We are in the need to generate reports from lists in SharePoint 2013. The reports would do data mingling between lists (like a relational database) and generate the reports in HTML and maybe a link to pdf on the SharePoint site.
    We are currently generating reports in Access. This is an issue for two reasons:
    Reports cannot be generated on the fly. Whenever we want reports in pdf form, we have to go into Access and run our reports macro written in VBA. It essentially generates the reports as pdf into our synced SkyDrive, which syncs it to our SharePoint site
    Report generation cannot be done by the client. This is due to the same concept as (1). We need to generate reports in Access.
    Is there any way to do this in SharePoint 2013? Are there any apps that do this?
    Any guidance or help would be appreciated.
    FYI: Our SharePoint server is hosted on the Office 365 network. It is not a local system.
    Thanks

    One option is to run the info into a Word Template and then run Word Automation Services to convert to PDF, but I think you're still going to run into some similar issues.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Problem with 'LS' command syntax for generating 'recursive' files list

    I'm having trouble getting a recursive (-R) directory listing of the contents of a flash drive --
    -- i.e., when I run the 'ls' command with the -R switch (in Terminal), I get either a recursive directory of what appears to be 'all volumes' (i.e., a very large file) or a zero-byte (empty) file.
    Terminal also keeps reporting "No such file or directory" but I don't know what it's referring to (it reports it with both the 'zero byte' listing and the 'large file' listing).
    Obviously, I'm making some 'syntax error' but I don't know what it is.
    Assuming the following . . .
    User = MK
    Flash drive = NO NAME
    . . . what is the correct command syntax to list only the contents of the flash drive (not 'all volumes')?
    My last try (it doesn't work) was:
    *ls -RTlp /Users/MK/Volumes/NO\ NAME > /Users/MK/Documents/flashdrive.dir*
    Thanks.

    Re: the original post, I should clarify that what I'm looking for is the syntax that will generate the recursive list of the flash drive's files +without first logging the flash drive+ (NO\ NAME) +as the working folder+.
    If I do the latter, I can get the recursive listing easily enough.
    What I haven't been able to do is generate the listing without first logging NO\ NAME as the working folder.
    Thanks.

  • SDK 3.4 - Tree and List rollover update flicker

    I have a rollover issue with items in a tree or list.  When the item is rolled over in a tree or list, an update to that item is made from our server.  It seems that the update causes the rollover indication to disappear.  It's like the item is being redrawn.  Is there a way to disable the item invalidation?  Is this a bug with my sdk?
    I also have a button on the item renderer that disappears too.  It is added and removed in commit properties, since it extends TreeItemRenderer and it's displayed over the icon.  Since the icon is added and removed in commitProperties, the button has to be added and removed in commitProperties to keep it's child index above the icon.

    Here is some code.  Notice when you rollover, the highlight goes away.
    Test.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"
                         height="100%" width="100%">
         <mx:List
              dataProvider="{dp}"
              itemRollOver="onRollover()"
              labelField="label"
              height="100%"
              width="100%"/>
         <mx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   [Bindable]
                   public var dp:ArrayCollection = new ArrayCollection([new Asset(), new Asset()]);
                   protected function onRollover():void {
                             for each(var item:Object in dp)
                                  if(item is Asset)
                                       Asset(item).name += "test";
              ]]>
         </mx:Script>
    </mx:Application>
    And Asset.as:
    package
         [Bindable]
         public class Asset
              public function Asset()
              public var name:String = "test";
              public var label:String = "test";

  • Need web component to generate Tree

    I need a web component to generate Tree from SQL query (or from BC4J View). In BC4J JSP components I didn't find something like Tree. What can I use for that task?

    You should take a look at the Jdev 9.0.3 <uix:hGrid /> tag. For more information use the Jdev 9.0.3 version of the 'UIX Developer Guide'. There are also some usefull Javascript libraries at http://www.insidedhtml.com

  • Save tree the lists of which is class' object

    Hi, my question :
    how can i save tree the lists of which is class' object?
    i save tree with the help of ObjectOutputStream class, but when i read tree object from file i have leaf without name(clean leaf)
    how read and save tree in file for normal with it?
    Code of my function for save tree:
    import javax.swing.JTree;
    import java.io.*;
    import java.util.*;
    public class SaveTree {
        public SaveTree(){
        public void saveTree(JTree tree){
            try{
            ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("tree.info"));
            out.writeObject(tree);
            out.close();
            catch(Exception e){
                e.printStackTrace();
        public JTree loadTree(){
            JTree tree = new JTree();
            try{
                ObjectInputStream in = new ObjectInputStream(new FileInputStream("tree.info"));
                tree = (JTree)in.readObject();
                in.close();
            catch(Exception e){
                e.printStackTrace();
            return tree;
    }the code where i create new node as class' object
    public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            if (ADD_COMMAND.equals(command)) {
                //Add button clicked
                book = new DefaultMutableTreeNode(new BookInfo
                (name.getText(),
                "file:///"+ System.getProperty("user.dir") + "/" + ID.getText() + ".html", Integer.parseInt(ID.getText())));           
                treePanel.addObject(book);
                name.setText("");
                ID.setText("");
    }my class BookInfo
    public class BookInfo {
            public String bookName;
            public String bookURL;
            private int bookID;
            public BookInfo(String book, String filename, int ID) {
                bookID = ID;
                bookName = book;
                bookURL = filename;
                System.out.println(bookURL);
                if (bookURL == null) {
                    System.err.println("Couldn't find file: "
                                       + filename);
            public String toString() {
                return bookName;
            public int getID(){
                return bookID;
            public void setID(int ID){
                bookID = ID;
        }thanks for attention ! :)

    Jos, thanks for answer :)
    Erm, get the TreeModel from the JTree, serialize it and later deserialize it and set it as the TreeModel for your JTree again?
    kind regards,
    JosHm, i save treeModel the same way, but when i (de)serialize treeModel from file i get clean tree
    my function to save treeModel
    class Save{
    public Save(){}
    public DefaultTreeModel loadModel(DefaultTreeModel model){
            try{
                ObjectInputStream in = new ObjectInputStream(new FileInputStream("tree.info"));
                model = (DefaultTreeModel)in.readObject();
                in.close();
            catch(Exception e){
                e.printStackTrace();
            return model;
            public DefaultTreeModel saveModel(DefaultTreeModel model){
            try{
                ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("tree.info"));
                out.writeObject(model);
                out.close();
            catch(Exception e){
                e.printStackTrace();
            //return model;
    }and here i init tree with treeModel
    Save save = new Save();
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(myObject);
    DefaultTreeModel model = new DefaultTreeModel(root);
    JTree tree = new JTree(save.saveModel(model));
    JPanel panel  = new JPanel();
    panel.add(new JScrollPane(tree));
    this.add(panel);Edited by: Tmrs on May 18, 2008 6:00 AM

  • Sharing Events/Handlers for Tree and List

    I have a Tree component and a List component that both share
    very similar functionality. In particular, I have setup
    functionality to edit the labels in each component only when I
    trigger a custom event from a ContextMenu, preventing the default
    action of editing the item when it is selected.
    Since Tree extends List, I was wondering if there was some
    easy way to make a Class/Component that could contain all the logic
    for this functionality that could be shared across Tree and List
    (or any List-based) components.
    I'm basically trying to avoid duplicating code.
    Any thoughts/suggestions?
    Thanks!

    "ericbelair" <[email protected]> wrote in
    message
    news:ga8h3q$9pn$[email protected]..
    >I have a Tree component and a List component that both
    share very similar
    > functionality. In particular, I have setup functionality
    to edit the
    > labels in
    > each component only when I trigger a custom event from a
    ContextMenu,
    > preventing the default action of editing the item when
    it is selected.
    >
    > Since Tree extends List, I was wondering if there was
    some easy way to
    > make a
    > Class/Component that could contain all the logic for
    this functionality
    > that
    > could be shared across Tree and List (or any List-based)
    components.
    >
    > I'm basically trying to avoid duplicating code.
    >
    > Any thoughts/suggestions?
    I think what you're looking for is called "monkey patching",
    which involves
    putting a file of the same name and directory structure in
    your project as
    the original was in the Framework. I don't know much more
    about it than
    that, though.

  • SDN: Generate the source list by contract automatically

    Hi Experts,
    please help !!!!!can't find an answer !
    I want to set a background job of ME05 to generate the source list by contract automatically, but it seems not work. Is there anyone who knows how to set the job of ME05? Or any other way to generate the source list by contract automatically? Many thanks.

    Dear Elena,
    You can create source list automatically from an Outline aggrement.For thsi on the outline agreement overview screen , select an item for which you wish to enter source list record & choose Item --> Maintain source list.If you have not maintained a plant in the outline agreement line item, you must enter the plant for each source list record.
    Also for creating source list automatically path is
    SAP Menu> Logistic > Material management > Purchasing>master data > Source list
    This will solve your problem.
    Reward if useful
    Vivek Maitra

  • Generate the source list by contract automatically

    Hi All,
    I want to set a background job of ME05 to generate the source list by contract automatically, but it seems not work. Is there anyone who knows how to set the job of ME05? Or any other way to generate the source list by contract automatically? Many thanks.

    hi Darcy! happy new year!!!
    did you find an answer re ME05 by contract? where to find note 34349?
    thanks,
    Elena

  • Numbers-Auto Generating a numbered list in a column of cells

    Having trouble creating an auto-generating numbered list in a single column. In text inspector I choose bullets>numbers>start at 1. The first cell is filled in with a "1", but when I hit return or down arrow the 1 disappears. If I go back and type a "1" again, two "1's" appear in the same cell. I'm trying to make a table with 250 rows. Not sure what I'm missing, as I'm new to iWork.

    Numbers can fill a column or row of cells with a pattern. Type the first two numbers in the first two cells, select both cells, then click on the small circle at the lower right of the second cells & drag down to fill however many cells you want. You can see in this picture that it works for other patterns, not just consecutive numbers. I've also used it to fill across month names or dates.

  • How can I generate a text list of the library?

    I'd like to know how to generate a simple
    Artist - Album
    text list of my iTunes library.
    I'm curious why this hasn't already been added as a feature?
    The export library command is not what I'm looking for. I just want something that generates a .txt without all the XML mumbo jumbo.
    Thanks for the help.

    I like that!
    And if you want tab delimiters and column headings, you can do this:
    tell application "iTunes"
         set the_output to "TITLE" & tab & "ARTIST" & tab & "ALBUM" & return & return
         --set counter to 0
         repeat with this_track in every track of playlist "Music"
              --set counter to counter + 1
              --if counter = 50 then exit repeat
              tell this_track
                   set the_output to the_output & name & tab & artist & tab & album & return
              end tell
         end repeat
         return the_output
    end tell
    If the library is big, it takes forever to collect the text, but you can try it out on just the first 50 tracks by un-commenting (or deleting) all the "counter" lines I added.
    It would be nice to have it write directly to an untitled TextEdit document (especially if there's a lot of text to copy/paste), but I'm a beginner with AppleScript so I don't know how or if it's even possible.

  • Accountin document not generated for INVOICE LIST

    Hi GURUS,
    when i save a invoice list , i am gettind a message " no accounting document generated". when i analyse it say that accounting doc is not requred.
    then how can i post the incoming payment for the invoice list.
    i am maintaining 0 value for cond type RL00.
    THANKS

    hi GSL,
    Then , how i wl be able to enter the incomong payment for the invoice list.
    my client dont want to give any discount in cond type RL00.
    PL SUGGEST ME THE SOLUTION
    thanks

  • Generating a Price List Report

    Hi
    Currently we are working for the retail sector where we need to maintain history of changes made in the price list. Can any report be generated in SAP for giving us a history of the price list with the dates on which such changes in price list has been made. I have explained the above query in detail below with a scenario.
    Scenario :
    Date     Price List      Item Code       Item Name     Price
    1-May-08          1         HB       Handle Bar     100
    20-May-08          1         HB       Handle Bar     105
    2-Jun-08          1         HB       Handle Bar     108
    Is a report as above possible to be generated in SAP for viewing the changes in the price list. Please guys if anybody has some clue on the same throw some light.

    Hi,
    Item History is in AITM table. You can view the change details of an item in 2 ways.
    1. Goto Inventory --> Item Master Data . Select the item for which you want to view the Change in price list. Now Goto Tools --> Change Log. Now you can view the list of changes made to that item. In that window itself Click the button "Show Differences". It will show the Differences between current item settings and the changes made to it (Date wise). Or You double click the button left to Instance. It opens the Item master data screen and show the screen which is earlier to the updation.
    2. Write a query to retrieve the data from AITM table.
    SELECT T0.UpdateDate, T0.ItemCode, T0.ItemName, T0.AvgPrice FROM AITM T0 Where Condition. Type the condition you want to filter the data from table.
    Raja.S

Maybe you are looking for

  • Problem with itunes gift card, what's wrong?

    I bought a fifteen dollar gift card and when the transaction had been completed, my account balance was set to four dollars and one cent, what's wrong?

  • Cash Flow tables in 11i

    Hi hussein, I am checking an Oracle Report in 11i "CASH FLOW" setup. And I saw the ff. tables that are being accessed: gl_cash_flow_trans gl_cash_flow_codes gl_period_statuses Why can not I find these tables in our 11i database? Thanks a lot

  • Undefined error: when update datagrid in flex

    I get this error when trying to update a field in my datagrid, using LCDS 2.61 with coldfusion. Why? undefined     at mx.data::CommitResponder/result()[C:\depot\flex\branches\enterprise_bridgeman_final_hotfi xes\frameworks\mx\data\CommitResponder.as:

  • How do I transfer photos from my iPad 3 to my computer so I can make a CD

    How do I transfer photos from my iPad 3 to my computer so I can make a CD?

  • Enhance infotype 0077 screen number 2008

    Hi, I want to enhance infotype 0077 screen number 2008. Using PM01, i created enhance single screen record with infotype 0077 with version 08. But the additional field appear on screen number 2000 instead of screen number 2008. How to add the additio