Report using a tree structure
I have found function modules RS_TREE_CONSTRUCT and rs_tree_list_display
but they enable me in having only 1 line at one level of the heirarchy , my requirement is to have multiple lines at one level of the tree.
I have found a function module TREEV_CREATE_LIST_TREE which i can not figure out how to use . Any help from the experts ?
hi,
check the below example of a list tree which is expandable and collapsable,
CLASS LCL_EVT_HDLR DEFINITION DEFERRED. " definition is given later
CLASS CL_GUI_CFW DEFINITION LOAD. " global class to be loaded
DATA:G_EVENT(50), " to hold the event
G_NODE_KEY TYPE TV_NODEKEY, "holds the node key
G_ITEM_NAME TYPE TV_ITMNAME,
G_KEY TYPE TV_ITMNAME,
G_CHECK TYPE AS4FLAG.
DATA:G_EVT_HDLR TYPE REF TO LCL_EVT_HDLR, "reference variable to the
"class implemented
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_TREE TYPE REF TO CL_GUI_LIST_TREE,
G_OK_CODE TYPE SY-UCOMM.
TYPES:ITEM_TABLE_TYPE LIKE STANDARD TABLE OF MTREEITM
WITH DEFAULT KEY.
TABLES:MARA.
SELECTION-SCREEN BEGIN OF SCREEN 123.
SELECT-OPTIONS:S_MATNR FOR MARA-MATNR.
SELECTION-SCREEN END OF SCREEN 123.
SELECTION-SCREEN BEGIN OF SCREEN 200.
SELECT-OPTIONS:S_ERNAM FOR MARA-ERNAM.
SELECTION-SCREEN END OF SCREEN 200.
CLASS lcl_evt_hdlr DEFINITION
CLASS LCL_EVT_HDLR DEFINITION.
PUBLIC SECTION.
METHODS:
*---- methods for action handling for nodes
NODE_DBL_CLK
FOR EVENT NODE_DOUBLE_CLICK
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY,
HANDLE_NODE_KEY_PRESS
FOR EVENT NODE_KEYPRESS
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY KEY,
*---- methods for action handling for Items
ITEM_DBL_CLK
FOR EVENT ITEM_DOUBLE_CLICK
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY ITEM_NAME,
HANDLE_ITEM_KEY_PRESS
FOR EVENT ITEM_KEYPRESS
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY ITEM_NAME KEY,
*---- other methods for action handling
HANDLE_EXPAND_NO_CHILDREN
FOR EVENT EXPAND_NO_CHILDREN
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY.
HANDLE_CHECKBOX
FOR EVENT CHECKBOX_CHANGE
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY ITEM_NAME CHECKED.
ENDCLASS. "lcl_evt_hdlr DEFINITION
CLASS lcl_evt_hdlr IMPLEMENTATION
CLASS LCL_EVT_HDLR IMPLEMENTATION.
METHOD NODE_DBL_CLK.
this method handles the node double click event of the tree control
and shows the key of the double clicked node in a dynpro field
G_EVENT = 'NODE_DOUBLE_CLICK'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ' '.
CASE NODE_KEY.
WHEN 'Root'.
*call transaction 'VA03'.
*CALL FUNCTION 'ZFUNC_SCREEN'
EXPORTING
PRG_NAME = 'ybasic3'.
CALL METHOD G_CUSTOM_CONTAINER->LINK
EXPORTING
REPID = SY-REPID
DYNNR = '0123'.
CALL SELECTION-SCREEN 123.
case sy-ucomm.
when 'BACK'.
LEAVE PROGRAM.
endcase.
WHEN 'Child1'.
CALL METHOD G_CUSTOM_CONTAINER->LINK
EXPORTING
REPID = SY-REPID
DYNNR = '0200'.
CALL SELECTION-SCREEN 200.
LEAVE PROGRAM.
ENDCASE.
ENDMETHOD. "node_dbl_clk
METHOD ITEM_DBL_CLK.
G_EVENT = 'ITEM_DOUBLE_CLICK'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
ENDMETHOD. "ITEM_DBL_CLK
METHOD HANDLE_NODE_KEY_PRESS.
G_EVENT = 'NODE_KEYPRESS'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ' '.
G_KEY = KEY.
ENDMETHOD. "HANDLE_NODE_KEY_PRESS
METHOD HANDLE_ITEM_KEY_PRESS.
G_EVENT = 'ITEM_KEYPRESS'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
G_KEY = KEY.
ENDMETHOD. "HANDLE_ITEM_KEY_PRESS
METHOD HANDLE_EXPAND_NO_CHILDREN.
G_EVENT = 'EXPAND_NO_CHILDREN'.
G_NODE_KEY = NODE_KEY.
ENDMETHOD. "handle_EXPAND_NO_CHILDREN
METHOD HANDLE_CHECKBOX.
G_EVENT = 'CHECKBOX_HANDLING'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
G_CHECK = CHECKED.
ENDMETHOD. "HANDLE_CHECKBOX
ENDCLASS. "lcl_evt_hdlr IMPLEMENTATION
*------ start-of-selection.
START-OF-SELECTION.
CREATE OBJECT G_EVT_HDLR. "create an object for the class
*lcl_evt_hdlr
SET SCREEN 100.
MODULE pbo_100 OUTPUT
MODULE PBO_100 OUTPUT.
SET PF-STATUS 'BUT'.
IF G_TREE IS INITIAL.
the tree control has not yet been created
create a tree control and insert nodes into it.
PERFORM CREATE_AND_INIT_TREE.
ENDIF.
ENDMODULE. "pbo_100 OUTPUT
MODULE pai_100 INPUT
MODULE PAI_100 INPUT.
DATA:RETURN_CODE TYPE I.
CL_GUI_CFW=>DISPATCH must be called if events are registered
that trigger PAI
this method calls the event handler method of an event
CALL METHOD CL_GUI_CFW=>DISPATCH
IMPORTING
RETURN_CODE = RETURN_CODE.
IF RETURN_CODE <> CL_GUI_CFW=>RC_NOEVENT.
" a control event occured => exit PAI
CLEAR G_OK_CODE.
EXIT.
ENDIF.
*at user-command.
G_OK_CODE = SY-UCOMM.
CASE G_OK_CODE.
WHEN 'BACK'. " Finish program
IF NOT G_CUSTOM_CONTAINER IS INITIAL.
" destroy tree container (detroys contained tree control, too)
CALL METHOD G_CUSTOM_CONTAINER->FREE
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
CLEAR G_CUSTOM_CONTAINER.
CLEAR G_TREE.
ENDIF.
LEAVE PROGRAM.
ENDCASE.
CAUTION: clear ok code!
CLEAR G_OK_CODE.
ENDMODULE. "pai_100 INPUT
*& Form create_and_init_tree
text
--> p1 text
<-- p2 text
FORM CREATE_AND_INIT_TREE .
DATA:NODE_TABLE TYPE TREEV_NTAB,
ITEM_TABLE TYPE ITEM_TABLE_TYPE,
EVENTS TYPE CNTL_SIMPLE_EVENTS,
EVENT TYPE CNTL_SIMPLE_EVENT.
create a container for the tree control.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING
the container is linked to the custom control with the
name 'TREE_CONTAINER' on the dynpro
CONTAINER_NAME = 'TREE_CONTAINER'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
create a list tree control
CREATE OBJECT G_TREE
EXPORTING
PARENT = G_CUSTOM_CONTAINER
NODE_SELECTION_MODE = CL_GUI_LIST_TREE=>NODE_SEL_MODE_SINGLE
ITEM_SELECTION = 'X'
WITH_HEADERS = ' '
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CREATE_ERROR = 2
FAILED = 3
ILLEGAL_NODE_SELECTION_MODE = 4
LIFETIME_ERROR = 5.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
*------- KEY = enter
CALL METHOD G_TREE->ADD_KEY_STROKE
EXPORTING
KEY = CL_TREE_CONTROL_BASE=>KEY_ENTER
EXCEPTIONS
FAILED = 1
ILLEGAL_KEY = 2
CNTL_SYSTEM_ERROR = 3.
IF SY-SUBRC <> 0.
MESSAGE W006 WITH 'ADD_KEY_STROKE'.
ENDIF.
define the events which will be passed to the backend
node double click
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_NODE_DOUBLE_CLICK.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_ITEM_DOUBLE_CLICK.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_NODE_KEYPRESS.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_ITEM_KEYPRESS.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_EXPAND_NO_CHILDREN.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_CHECKBOX_CHANGE.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
*------ register the events
CALL METHOD G_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
assign event handlers in the application class to each desired events
SET HANDLER G_EVT_HDLR->NODE_DBL_CLK FOR G_TREE.
SET HANDLER G_EVT_HDLR->ITEM_DBL_CLK FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_NODE_KEY_PRESS FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_ITEM_KEY_PRESS FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_EXPAND_NO_CHILDREN FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_CHECKBOX FOR G_TREE.
add some nodes to the tree control
PERFORM BUILD_NODE_AND_ITEM_TABLE USING NODE_TABLE ITEM_TABLE.
CALL METHOD G_TREE->ADD_NODES_AND_ITEMS
EXPORTING
NODE_TABLE = NODE_TABLE
ITEM_TABLE = ITEM_TABLE
ITEM_TABLE_STRUCTURE_NAME = 'mtreeitm'
EXCEPTIONS
FAILED = 1
CNTL_SYSTEM_ERROR = 3
ERROR_IN_TABLES = 4
DP_ERROR = 5
TABLE_STRUCTURE_NAME_NOT_FOUND = 6.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
ENDFORM. " create_and_init_tree
*& Form build_node_and_item_table
text
-->P_NODE_TABLE text
-->P_ITEM_TABLE text
FORM BUILD_NODE_AND_ITEM_TABLE USING
NODE_TABLE TYPE TREEV_NTAB
ITEM_TABLE TYPE ITEM_TABLE_TYPE.
DATA:NODE TYPE TREEV_NODE,
ITEM TYPE MTREEITM.
build the node table
node with key 'root'.
CLEAR NODE.
NODE-NODE_KEY = 'Root'. " key of the node
CLEAR NODE-RELATKEY. " root node has no parent node
CLEAR NODE-RELATSHIP.
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. " the width of the item is adjusted to its "
" content (text)
APPEND NODE TO NODE_TABLE.
node with key 'child1'.
CLEAR NODE.
NODE-NODE_KEY = 'Child1'. "key of the node
NODE-RELATKEY = 'Root'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
APPEND NODE TO NODE_TABLE.
node with key 'Subchild1' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild1'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
APPEND NODE TO NODE_TABLE.
node with key 'subchild2' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild2'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
APPEND NODE TO NODE_TABLE.
node with key 'subchild3' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild3'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
APPEND NODE TO NODE_TABLE.
node with key 'subchild4' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild4'.
NODE-RELATKEY = 'Child1'.
NODE-DISABLED = ' '.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
APPEND NODE TO NODE_TABLE.
node with key 'child2'.
CLEAR NODE.
NODE-NODE_KEY = 'Child2'. "key of the node
NODE-RELATKEY = 'Root'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
NODE-EXPANDER = 'X'. " The node is marked with a '+', although
" it has no children. When the user clicks on the
" + to open the node, the event expand_nc is
" fired. The programmerr can
" add the children of the
" node within the event handler of the expand_nc
" event (see callback handle_expand_nc).
APPEND NODE TO NODE_TABLE.
items of the nodes
item with key 'root'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Root'.
ITEM-ITEM_NAME = '1'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT. " text item
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO. "the width of the item
"is adjusted to its content
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP. "use proportional font
" for the item
ITEM-TEXT = 'object'.
APPEND ITEM TO ITEM_TABLE.
item with key 'child1'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Child1'.
ITEM-ITEM_NAME = '11'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = 'dynpros'.
APPEND ITEM TO ITEM_TABLE.
item with key 'child2'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Child2'.
ITEM-ITEM_NAME = '12'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = 'programme'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'Subchild1'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild1'.
ITEM-ITEM_NAME = '111'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 11.
ITEM-TEXT = 'include'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'SubChild2'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '112'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 4. " the width of the item is 4 chars
ITEM-IGNOREIMAG = 'X'. " see documentation of structure treev_item
ITEM-USEBGCOLOR = 'X'.
ITEM-T_IMAGE = '@01@'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '113'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 4. " the width of the item is 4 chars
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = '0100'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '114'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 11.
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = ' mueller'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '115'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = ' comment to dynpro 100'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'SubChild3'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild3'.
ITEM-ITEM_NAME = '121'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 20.
ITEM-IGNOREIMAG = 'X'.
ITEM-USEBGCOLOR = 'X'.
ITEM-T_IMAGE = '@02@'.
ITEM-TEXT = ' 0200 harryhirsch'.
ITEM-CHOSEN = 'X'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild3'.
ITEM-ITEM_NAME = '122'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = ' comment to dynpro 200'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild4'.
ITEM-ITEM_NAME = '144'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 20.
ITEM-IGNOREIMAG = 'X'.
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = ' select'.
ITEM-CHOSEN = 'X'.
ITEM-DISABLED = ' '.
APPEND ITEM TO ITEM_TABLE.
ENDFORM. " build_node_and_item_table
Hope it helps you,
Regards,
Similar Messages
-
Listing File Hierarchy in console using a Tree structure
first off i'm a college student. i'm not that good at java... we got this CA in class and try as i might i just can't get my head around it
i was wondering if someone who know a bit more about java then i do would point me in the right direction, were i'm going wrong in my code
i have to list out sub-files and sub-directorys of a folder (i.e. C:/test) to console using tree structure
like this
startingdir
dir1 //subfolder of startingdir
dir11 //subfolder of dir1
dir111 //subfolder of dir11
dir12 //subfolder of dir1
file1A // document on dir1
dir2 //subfolder of startingdir
Tree.java
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.Deque;
public class Tree<E> {
// Each Tree object is an unordered tree whose
// elements are arbitrary objects of type E.
// This tree is represented by a reference to its root node (root), which
// is null if the tree is empty. Each tree node contains a link to its
// parent and a LinkedList of child nodes
private Node root;
//////////// Constructor ////////////
public Tree () {
// Construct a tree, initially empty.
root = null;
//////////// Accessors ////////////
public boolean isEmpty () {
// Return true is and only if this tree is empty.
return (root == null);
public Node root () {
// Return the root node of this tree, or null if this tree is empty.
return root;
public Node parent (Node node) {
// Return the parent of node in this tree, or null if node is the root node.
return node.parent;
public void makeRoot (E elem) {
// Make this tree consist of just a root node containing element elem.
root = new Node(elem);
public Node addChild (Node node, E elem) {
// Add a new node containing element elem as a child of node in this
// tree. The new node has no children of its own. Return the node
// just added.
Node newChild = new Node(elem);
newChild.parent = node;
node.children.addLast(newChild);
return newChild;
public E element (Node node) {
return node.getElement();
//////////// Iterators ////////////
public Iterator childrenIterator (Node node) {
return node.children.iterator();
public Iterator nodesPreOrder () {
// Return an iterator that visits all nodes of this tree, with a pre-order
// traversal.
return new Tree.PreOrderIterator();
//////////// Inner classes ////////////
public class Node {
// Each Tree.Node object is a node of an
// unordered tree, and contains a single element.
// This tree node consists of an element (element),
// a link to its parent
// and a LinkedList of its children
private E element;
private Node parent;
private LinkedList<Node> children;
private Node (E elem) {
// Construct a tree node, containing element elem, that has no
// children and no parent.
this.element = elem;
this.parent = null;
children = new LinkedList<Node>();
public E getElement () {
// Return the element contained in this node.
return this.element;
public String toString () {
// Convert this tree node and all its children to a string.
String children = "";
// write code here to add all children
return element.toString() + children;
public void setElement (E elem) {
// Change the element contained in this node to be elem.
this.element = elem;
public class PreOrderIterator implements Iterator {
private Deque<Node> track; //Java recommends using Deque rather
// than Stack. This is used to store sequence of nomempty subtrees still
//to be visited
private PreOrderIterator () {
track = new LinkedList();
if (root != null)
track.addFirst(root);
public boolean hasNext () {
return (! track.isEmpty());
public E next () {
Node place = track.removeFirst();
//stack the children in reverse order
if (!place.children.isEmpty()) {
int size = place.children.size(); //number of children
ListIterator<Node> lIter =
place.children.listIterator(size); //start iterator at last child
while (lIter.hasPrevious()) {
Node element = lIter.previous();
track.addFirst(element);
return place.element;
public void remove () {
throw new UnsupportedOperationException();
FileHierarchy.java
import java.io.File;
import java.util.Iterator;
public class FileHierarchy {
// Each FileHierarchy object describes a hierarchical collection of
// documents and folders, in which a folder may contain any number of
// documents and other folders. Within a given folder, all documents and
// folders have different names.
// This file hierarchy is represented by a tree, fileTree, whose elements
// are Descriptor objects.
private Tree fileTree;
//////////// Constructor ////////////
public FileHierarchy (String startingDir, int level) {
// Construct a file hierarchy with level levels, starting at
// startingDir
// Can initially ignore level and construct as many levels as exist
fileTree = new Tree();
Descriptor descr = new Descriptor(startingDir, true);
fileTree.makeRoot(descr);
int currentLevel = 0;
int maxLevel = level;
addSubDirs(fileTree.root(), currentLevel, maxLevel);
//////////// File hierarchy operations ////////////
private void addSubDirs(Tree.Node currentNode, int currentLevel,
int maxLevel) {
// get name of directory in currentNode
// then find its subdirectories (can add files later)
// for each subdirectory:
// add it to children of currentNode - call addChild method of Tree
// call this method recursively on each child node representing a subdir
// can initially ignore currentLevel and maxLevel
Descriptor descr = (Descriptor) currentNode.getElement();
File f = new File(descr.name);
File[] list = f.listFiles();
for (int i = 0; i < list.length; ++i) {
if (list.isDirectory()) {
File[] listx = null;
fileTree.addChild(currentNode, i);
if (list[i].list().length != 0) {
listx = list[1].listFiles();
addSubDirs(currentNode,i,1);
} else if (list[i].isFile()) {
fileTree.addChild(currentNode, i);
// The following code is sample code to illustrate how File class is
// used to get a list of subdirectories from a starting directory
// list now contains subdirs and files
// contained in dir descr.name
////////// Inner class for document/folder descriptors. //////////
private static class Descriptor {
// Each Descriptor object describes a document or folder.
private String name;
private boolean isFolder;
private Descriptor (String name, boolean isFolder) {
this.name = name;
this.isFolder = isFolder;
FileHierarchyTest.javapublic class FileHierarchyTest {
private static Tree fileTree;
public static void main(String[] args) {
FileHierarchy test = new FileHierarchy ("//test", 1);
System.out.println(test.toString());Denis,
Do you have [red hair|http://www.dennisthemenace.com/]? ;-)
My advise with the tree structure is pretty short and sweet... make each node remember
1. it's parent
2. it's children
That's how the file system (inode) actually works.
<quote>
The exact reasoning for designating these as "i" nodes is unsure. When asked, Unix pioneer Dennis Ritchie replied:[citation needed]
In truth, I don't know either. It was just a term that we started to use. "Index" is my best guess, because of the
slightly unusual file system structure that stored the access information of files as a flat array on the disk, with all
the hierarchical directory information living aside from this. Thus the i-number is an index in this array, the
i-node is the selected element of the array. (The "i-" notation was used in the 1st edition manual; its hyphen
became gradually dropped).</quote> -
Updating data using a tree structure?
Hi,
I need to change some hierarchical data and wondered the best way to do it.
Basically I have a menu table which I query as a tree structure:
select menu_name, level, option_text, displayed
from menu_option
start with menu_name = 'CONTROL' and option_number >= 0
connect by prior command_line = menu_name
command line has the next menu in the level, unless its a leaf!
What I want to do is, if a 'parent' has the displayed flag set to N, change all the children underneath to N as well. Whats the neatest way to do this in PL/SQL or SQL statements?
Thanks,
Tracey.How about
update menu_option m1
set displayed = 'N'
where exists
(select 1
from menu_option m2
where m2.displayed = 'N'
start with m2.menu_name = m1.menu_name
connect by prior m2.menu_name = m2.command_line) -
Tree structure format in report.
Hi all,
I have got a report to develop where in i have to display the ouptut of the report
in a tree structure.Can anybody tell me how to proceed with this ?? This is
basically an interactive report where clicking on one of the node will take us to
another page.
Thanks and Regards.
syed.HI
Refer this code.
REPORT YMS_ALVTREEDEMO .
*Data Declaration
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_ekpo TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_emptytab TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko,
wa_ekpo TYPE t_ekko.
DATA: ok_code like sy-ucomm, "OK-Code
save_ok like sy-ucomm.
*ALV data declarations
DATA: fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE.
DATA: gd_fieldcat TYPE lvc_t_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv.
*ALVtree data declarations
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: gd_tree TYPE REF TO cl_gui_alv_tree,
gd_hierarchy_header TYPE treev_hhdr,
gd_report_title TYPE slis_t_listheader,
gd_logo TYPE sdydo_value,
gd_variant TYPE disvariant.
*Create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
*Includes
*INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
*INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
*INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
*Start-of-selection.
START-OF-SELECTION.
ALVtree setup data
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.
PERFORM build_report_title USING gd_report_title gd_logo.
PERFORM build_variant.
Display ALVtree report
call screen 100.
*& Form DATA_RETRIEVAL
Retrieve data into Internal tables
FORM data_retrieval.
SELECT ebeln
UP TO 10 ROWS
FROM ekko
INTO corresponding fields of TABLE it_ekko.
loop at it_ekko into wa_ekko.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
FROM ekpo
appending TABLE it_ekpo
where ebeln eq wa_ekko-ebeln.
endloop.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
Please not there are a number of differences between the structure of
ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
For example the field seltext_m is replace by scrtext_m in ALVtree.
fieldcatalog-fieldname = 'EBELN'. "Field name in itab
fieldcatalog-scrtext_m = 'Purchase Order'. "Column text
fieldcatalog-col_pos = 0. "Column position
fieldcatalog-outputlen = 15. "Column width
fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)
fieldcatalog-key = 'X'. "Key Field? (X or SPACE)
fieldcatalog-do_sum = 'X'. "Sum Column?
fieldcatalog-no_zero = 'X'. "Don't display if zero
APPEND fieldcatalog TO gd_fieldcat.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-scrtext_m = 'PO Iten'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-scrtext_m = 'Status'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-scrtext_m = 'Item change date'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-scrtext_m = 'Material Number'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-scrtext_m = 'PO quantity'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-scrtext_m = 'Order Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-scrtext_m = 'Net Price'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 7.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-scrtext_m = 'Price Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form build_hierarchy_header
build hierarchy-header-information
-->P_L_HIERARCHY_HEADER structure for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'(013).
p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form BUILD_REPORT_TITLE
Build table for ALVtree header
<-> p1 Header details
<-> p2 Logo value
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-key "Not Used For This Type(H)
ls_line-info = 'PO ALVTree Display'.
APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
APPEND ls_line TO pt_report_title.
ENDFORM.
*& Form BUILD_VARIANT
Build variant
form build_variant.
Set repid for storing variants
gd_variant-report = sy-repid.
endform. " BUILD_VARIANT
Check these programs.
e.g
BCALV_TREE_01 ALV tree control: build up the hierarchy tree
BCALV_TREE_02 ALV tree control: event handling
BCALV_TREE_03 ALV tree control: use an own context menu
BCALV_TREE_04 ALV tree control: add a button to the toolbar
BCALV_TREE_05 ALV tree control: add a menu to the toolbar
BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree
RSDEMO_DRAG_DROP_TREE_MULTI
BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree
Reward all helpfull answers.
Regards.
Jay -
Tree Structure Implementation in Java.
1>
How should i implement a "Tree Structure" in Java Based application.?How would i map the entries to the database table?how many tables will i require for this implementation.?
List records<String> = new ArrayList<String>();
records.add("null");
records.add("Product");
records.add("Category");
records.add("P1");
records.add("P2");
records.add("P3");
records.add("C1");
records.add("C2");
records.add("C3");
so how should i implement a Tree Structure for the above record set.
//P1,P2,P3 belong to Parent {Product}
//C1,C2,C3 belong to Parent {Category}
Sample code provided will be helpfulHow should i implement a "Tree Structure" in Java Based application.?The quotes suggest you don't know what a tree structure is, regardless of the development language. Fix that first (your understanding of what a tree structure is). [url http://en.wikipedia.org/wiki/Tree_structure]Here is probably a good start.
How would i map the entries to the database table?how many tables will i require for this implementation.?It depends on what your tree structure represents, in particular it depends on whether the leaves and intermediate nodes of the trees have are homogeneous (e.g. have a common interface). There is no general rule.
I suggest you start by looking in the Java API at all the classes whose names start with 'Tree' (TreeSet and TreeMap are probably the best ones to start with) and read the documentation carefully. Then try to write some code that uses one and come back if/when you have any problems.(sorry Winston) I think this is a very bad advice.
These classes are particular implementations, respectively of a set (in the mathematical sense) and of a map (associative table), which happen to use a "tree structure" for their internal business. Their API doesn't help building a custom "tree structure" (they may be used that way, but it's certainly not the easiest nor even a particular handy way to build tree structures).
Maybe their implementation may be a good example of how to build a Tree structure, but they use a particular type of tree (+red-black tree), not a general one. This may or may not be the OP's case, I wouldn't bet on it.
OP you're welcome to come back with more specific questions and details. Good luck with Java.
Edited by: jduprez on Oct 16, 2010 2:45 PM
Edited by: jduprez on Oct 16, 2010 2:49 PM
After checking the Javadoc: indeed TreeSet only uses a TreeMap for its implementation, so the only one out of the two which does directly uses a tree structure in its implementation is TreeMap.
Edited by: jduprez on Oct 16, 2010 2:51 PM
And, to reiterate, I stand by my claim that TreeMap is not a good example of a general Tree structure: in particular it uses a tree to map keys to values, its main business is the "mapping" part, not the tree as a storage medium. Neither the keys nor the values know anything about their "children". -
I am designing a new program and am examining the various data structures that are available for use. This program I am desiging is basically a database, with various attributes of and employee - eg Name, Id, dept etc.
What are the advantages & disadvantages of using the tree structure to store this data instead of using the standard linear list?
Many ThanksOk, if you're a programmer or even maybe a software engineer you SHOULD definetly know what the advantages and disadvantages are. Heck, you should even know what the runtime complexity, in standard "Big-Oh" notation, of a search for each structure.
Ny
I am designing a new program and am examining the
various data structures that are available for use.
This program I am desiging is basically a database,
with various attributes of and employee - eg Name, Id,
dept etc.
What are the advantages & disadvantages of using the
tree structure to store this data instead of using the
standard linear list?
Many Thanks -
Hi,
I have a table which contains the hierarchial data upto 4 levels. I needed to have the information of all the four levels in a row, so I created 3 tree structured views and one another view using the tree structured views as below
--To get the great grand parent id for the children*
CREATE OR REPLACE VIEW VR_PO_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
partner_organization_id,
partner_common_name,
partner_organization_type
FROM partner_organization po
START WITH po.org_entity_above_id IS NULL
CONNECT BY PRIOR po.partner_organization_id = po.org_entity_above_id
ORDER BY po.partner_organization_id;
-- level 2 (grant parent) id
CREATE OR REPLACE VIEW VR_PO_AREA_TR AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
partner_organization_id,
partner_common_name,
partner_organization_type
FROM partner_organization vcpo
START WITH vco.partner_organization_type = 'AREA'
CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
ORDER BY vcpo.partner_organization_id;
--level 3 (parent) id*
CREATE OR REPLACE VIEW VR_PO_REGION_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
vcpo.partner_organization_id,
vcpo.partner_common_name,
vcpo.partner_type
FROM partner_organization vcpo
START WITH vcpo.partner_organization_type = 'REGION'
CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
ORDER BY vcpo.partner_organization_id;
---and finally created a view to have all the levels in a single row
CREATE OR REPLACE VIEW VR_PO_ALL_TREE AS
SELECT pot.pathlength,
po.partner_organization_id,
po.partner_common_name,
pot.root_po int_partner_org_id,
pot.intl_po_name int_partner_common_name,
vpat.root_po area_partner_org_id,
vpat.area_po_name area_partner_common_name,
vprt.root_po region_partner_org_id,
vprt.region_po_name region_partner_common_name
FROM partner_organization po
JOIN vr_po_tree pot
ON pot.partner_organization_id = po.partner_organization_id
LEFT outer JOIN vr_po_area_tr vpat
ON vpat.partner_organization_id = po.partner_organization_id
LEFT OUTER JOIN vr_po_region_tree vprt
ON vprt.partner_organization_id = po.partner_organization_id;
All the views are working fine, very fast, giving the expected output.
if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
Is the view vr_po_all_tree is cause for this problem?, in such a case can any one help me to rewrite the view with a simple query to give the same results?
Thanks in advance.
Nattu
Edited by: Nattu on Nov 26, 2009 8:25 PM
Edited by: Nattu on Nov 27, 2009 11:48 AM
Edited by: Nattu on Nov 27, 2009 11:55 AMHi,
if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
Is the view vr_po_all_tree is cause for this problem?As Sven said, ORA-00600 is the sign of some low-level problem, and you should seek a solution from Oracle support. Your views are not the cause of this problem; most likely, the views trigger something that would not be a problem except for a installatin problem or maybe a bug.
We can try to find a work-around for you, but don't ignore the problem.
in such a case can any one help me to rewrite the view with a simple query to give the same results?It seems very likely that you could do something that didn't involve so many CONNECT BYs and outer joins.
Post some sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
Simplify as much as possible. For example, in the first view you say:
CREATE OR REPLACE VIEW VR_PO_TREE AS
SELECT LEVEL pathlength,
connect_by_root partner_organization_id root_po,
connect_by_root partner_common_name intl_po_name,
connect_by_root is_wbti is_wbti,
connect_by_root is_sil_int is_sil_int,
connect_by_root organization_entity_code int_org_entity_code,
org_entity_above_id, partner_organization_id,
partner_organization_type,
sys_connect_by_path(partner_organization_id, '\') po_path_id,
sys_connect_by_path(partner_common_name, '\') po_path_name
FROM ...That is, you're selecting 1 pseudo-column (LEVEL), 4 CONNECT_BY_ROOTs, 3 plain columns, and 2 SYS_CONNECT_BY_PATHs.
Can you post a problem with just one of each: 1 pseudo-column, 1 CONNECT_BY_ROOT, 1 plain column, and 1 SYS_CONNECT_BY_PATH? Adding the others later should be easy.
Any information you can give about the data would be helpful.
In particular,
(a) Can org_entity_above be NULL on the same row where partner_organization_type is 'AREA' or 'REGION'?
(b) How many ancestors with partner_organization_type = 'AREA' Can a node have? 1? No more than 1? 1 or more? 0 or more?
(c) Same for 'REGION'. How many ancestors with partner_organization_type = 'REGION' Can a node have? 1? No more than 1? 1 or more? 0 or more?
(d) Can a node with partner_organization_type = 'REGION' be the ancestor of a row with partner_organization_type = 'AREA'?
(e) Other way around: can a node with partner_organization_type = 'AREA' be the ancestor of a row with partner_organization_type = 'REGION'?
Some of these questions may seem silly to you, because you know the table and the data so well. I don't, so you'll have to explain things. -
How to show alv report in tree structure
hi all,
how to show data or create a alv report in tree structure.
thanks in advance.
HarshaHi Harsha,
Its done using FM 'RS_TREE_CONSTRUCT'
and FM for displaying the tree: 'RS_TREE_LIST_DISPLAY'
Thanks
Shrila -
Event Handling for tree structure using "CL_GUI_ALV_TREE_SIMPLE"
Hi,
I have created a tree structure using class CL_GUI_ALV_TREE_SIMPLE.
Now I wanted to insert a check and give message when the user opens the last node in my structure.
I checked the events available in the class , but there in none which gets trigered when we try to open a node.
Please guide me with this scenario.
Thanks & Regards,
Omkar M.Hello Omkar
The solution is somewhat odd but apparently works. As sample report please check BCALV_TREE_SIMPLE_DEMO.
Copy this report and make the following changes:
class lcl_tree_event_receiver definition.
public section.
methods:
on_expand_no_children " new event handler method
for event expand_no_children of cl_gui_column_tree
importing NODE_KEY, " class = CL_GUI_COLUMN_TREE !!!
on_add_hierarchy_node
for event on_add_hierarchy_node of cl_gui_alv_tree_simple
importing grouplevel
index_outtab.
endclass.
CLASS lcl_tree_event_receiver IMPLEMENTATION.
METHOD on_expand_no_children.
BREAK-POINT.
ENDMETHOD. "on_expand_no_children
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_expand_no_children.
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.
* set Handler
DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->on_add_hierarchy_node
FOR tree1. " CL_GUI_ALV_TREE_SIMPLE
SET HANDLER l_event_receiver->on_expand_no_children
FOR ALL INSTANCES. " CL_GUI_COLUMN_TREE !!!
ENDFORM. " register_events
As soon as you open a node in the ALV tree the report will stop at the break-point.
Now you need to check if there are still children nodes to be displayed.
If not then trigger your special coding.
Regards
Uwe -
Creating a tree structure like Windows file explorer using Jdev
Hi All,
Is it possible to develop a tree structure like windows in JDEV and then same page I want to move to oracle apps.
This tree I am creating for Showing Employee information. Like Parents & childs under it. i.e. Managers and employee reporting to managers.
Please let me know if it is possible, if yes how , what is method of doing this.
Thanks
Ganesh ManeYes. This possible with ADF Faces RC, which provides an af:tree component. Have a look at the Fusion Order Demo, which uses the tree to implement a similar usecase to the one you describe.
http://www.oracle.com/technology/products/jdev/samples/fod/index.html
Regards,
RiC -
Tree structure in an interactive report
Hi All,
I hope someone can suggest a solution. I have 2 tables that I am trying to join in an interactive report and have a tree like structure. The table are set up like the following:
Table tools - TOOL_ID, TOOL_NAME, TOOL_DESCRIPTION
Each tool can be connected to many parts:
Tool to Parts table - PART_ID, TOOL_ID
Ideally the report that I want will show the tools data with the functionality to drill down to display the parts that are associated with that tool.
I could create another report region on the page to pass the tool_id to as a parameter and display the tool_to_part data based on that but then I will lose the functionality that comes with the interactive report (only one interactive report per page). A tree region wont give me the functionality that comes with an interactive report either allowing me perform searches on etc.
The report that I would like would something like:
+Tool ID Tool Name
Part A
Part B
Part C
where the parts data can be collapsed with the '+'
I am using APEX v4.0
Thanks
ChrisHi Chris,
You can place a detail report inline with your master TOOL report, using an iframe. I've once made a small setup for this, perhaps it's of help to you:
http://vincentdeelen.blogspot.com/2013/07/detail-section-in-line-with-report-part.html
Regards,
Vincent -
Hi
I need to create the report showing the user hierarchy in a tree like structure
how can we achieve it.?The client wants to see the entire organization hierarchy,who reports to whom in a tree like structure along with the user's designation.I achieved this through Reports using the CASE function...but the report format is not what we need.
The other procedure is through book.the user can view the hierarchy through the look in selector.but only user name is displayed.What can we do do display it along with their designations? -
How to create a tree structure using forms.
Hi,
How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
thanks in advance
Regards
KarthikThe FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
" in the online help this point to all the functions and triggers -
How to use ONE query to find out tree structure?
ID------------upperID----------Name------------------------isFolder
1------------ 0---------- Folder
1------------------------------------1
2------------ 1------------ Folder 1- Sub
Folder--------------------1
3------------ 2------------
Folder1-Item1-A--------------------------0
4------------ 1------------ Folder 1- Sub
Item-----------------------0
Hi all, if I have a table like above to demonstrate the
folders and item relationship. This structure allows the user to
create unlimited folders and items.
Now I would like to use one query to find out the tree
structure of this table, how could I do the query.
Any help on this will be highly appreciated!
Thanks,
ezAlso, see this thread:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 55788&enterthread=y -
Bookmark tree structure using Microsoft word 2007 not creating properly
I have a word document file in MS office 2007. When i am converting the word document to a PDF file using the HEADING option , the bookmarks tree structure in the PDF file is not created properly. Means that the between content of a topic is also read
as a bookmark heading while conversion. Only the heading of a topic should be read as a bookmark and the sub heading as a sub-bookmark but the content should not come in the tree structure of bookmarks in a PDF file..
For Example:- if MICROSOFT is the heading of any xyz.doc then it should be the parent bookmark. . but in my case , MICROSOFT is coming as a bookmark but the content inside this is also created as a bookmark..
So my question is that what is the internal structure of the of the MS word 2007 to convert a doc to a PDF file???
Because it is not creating the bookmarks tree structure properly...and taking the content randomly from the middle of a topic and adding it in the bookmark tree structure...(which should not happen). The font throughout the doc is the same and aligned properly..so
why it is randomly taking the between text as a bookmark...???
what is the root cause of this bug..?? how can this problem be solved..?? is there any sort of change have to be done in my word doc.?
i need an urgent help regarding this...
NOTE:- I am using MS office 2007.I tried this but didnt work for mr. Can you help? How did you PDFed??
It works for me in Word 2010 (or later) using Save As PDF. It did not work in Word 2007 using the Adobe Acrobat PDF printer nor using Word 2007's save as pdf utility. (The hyperlink showed up but was not active.) It did work using the Acrobat tab in Word
2007 (this requires Adobe Acrobat).
I did this by:
first creating the text box with the hyperlink in the body of the document and moving it into the footer area (but still not in the footer itself).
Then I used the Format tab of Text Box Tools and the Postion button (More Layout Options).
I gave it an absolute vertical position relative to the page.
Then I cut the text box, went into the footer, and pasted it there.
It might have worked to just create the text box in the footer itself.
I personally prefer it that the header and footer are not part of the active page when I am typing. This hyperlink is not clickable in Word without going into the header/footer view and I'm fine with that. The QAT workaround is just fine.
Charles Kenyon Madison, WI
Maybe you are looking for
-
Business Event not triggering the SOA BPEL Process with OA Adapter
Hello Gurus, I am working on Business event "oracle.apps.per.api.employee.create_employee" and the event is getting triggered when creating an employee from EBS. The message has come till WF_BPEL_QTAB(I could seeit) and in "READY" status.We have a SO
-
The new iphone update *****. How can I uninstall it?
The iOS7.0.2 update is terrible. The icons for the built- in apps changed. I can think of no good reason for this. It's now more difficult to find what I am looking for as I don't recognize the app icons. The background in the phone app is now gone s
-
Hi, In DB2, there is a concept called 'common table expressions'. A common table expression is like a temporary view that is defined and used for the duration of an SQL statement. You can define a common table expression for the SELECT, INSERT, and C
-
Installing Snow Leopard on New Lion formatted macbook pro
I just purchased a new 15" macbook pro and it came with lion. I need to revert back to snow leopard for a couple of my programs because they aren't currently supported. When I try to boot from the snow leopard disc to add a partition to my hard drive
-
Dear all I have one server running Windows Server 2008 R2 and that is part of our AD domain. This server is getting 2 network interface with IP addresses in 2 different VLANs. We would like to have only one IP address added to our AD DNS but unfortun