2007 Jun 11 9:25 AM
Hi all,
maybe is a stupid question but I don't find the answer anywhere...
I'm using CL_GUI_ALV_TREE. When I build the hierarchy and set the parameters of a node, I put also IS_NODE_LAYOUT-ISFOLDER = 'X'.
In an event I have the node_key and I want the characteristic of this node and in particular if this node is a folder or not.
How to do this? What is the method to get the layout?
thanks a lot.
Giuseppe.
2007 Jun 11 9:47 AM
Hello,
chek this sample report.
<b>BCALV_GRID_DND_TREE_SIMPLE</b>
Regards,
Vasanth
2007 Jun 11 10:41 AM
hello Vasanth,
thanks, but I can't solve my problem with this report because it use a different class and it has different methods and different parametrs for the events... or I'm not able to see where it is similar.
For example it use the parameter GROUPLEVEL in the event NODE_DOUBLE_CLICK to understand if that node is a folder or not, but in my class (CL_GUI_ALV_TREE) doesn't exist.
And however this report not use parameters for LAYOUT.
I have already implemented all my report with class CL_GUI_ALV_TREE and I don't want to change all... is it possible that in this class I can't get the characteristic (layout) of a node?
2007 Jun 11 11:25 AM
Hi,
Go through the link,
http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm
Also go through the below code,
LOOP AT it_ekko INTO wa_ekko.
Build the node table.
Caution: The nodes are inserted into the tree according to the order
in which they occur in the table. In consequence, a node must not
occur in the node table before its parent node.
Node with key 'Root'
node-node_key = wa_ekko-ebeln. " 'Root'. "#EC NOTEXT
" Key of the node
CLEAR node-relatkey. " Special case: A root node has no parent
CLEAR node-relatship. " node.
node-hidden = ' '. " The node is visible,
node-disabled = ' '. " selectable,
node-isfolder = 'X'. " a folder.
CLEAR node-n_image. " Folder-/ Leaf-Symbol in state "closed":
" use default.
CLEAR node-exp_image. " Folder-/ Leaf-Symbol in state "open":
" use default
CLEAR node-expander. " see below.
node-text = wa_ekko-ebeln. "'Root'.
APPEND node TO node_table.
LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln EQ wa_ekko-ebeln.
Node with key wa_ekpo-ebelp "'Child1'
ld_node = sy-tabix.
concatenate wa_ekpo-ebelp ld_node into ld_node.
node-node_key = ld_node. "'Child1'. #EC NOTEXT
Node is inserted as child of the node with key wa_ekpo-ebeln "'Root'.
node-relatkey = wa_ekpo-ebeln. " 'Root'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-hidden = ' '.
node-disabled = ' '.
node-isfolder = ' '.
CLEAR node-n_image.
CLEAR node-exp_image.
node-expander = ' '. " The node is marked with a '+', although
it has no children. When the user clicks on the
+ to open the node, the event
expand_no_children is fired. The programmer can
add the children of the
node within the event handler of the
expand_no_children event
(see method handle_expand_no_children
of class lcl_application)
node-text = wa_ekpo-ebelp.
APPEND node TO node_table.
ENDLOOP.
ENDLOOP.
Add nodes to alv tree
CALL METHOD GD_TREE->ADD_NODES
EXPORTING
TABLE_STRUCTURE_NAME = 'MTREESNODE'
NODE_TABLE = NODE_TABLE
EXCEPTIONS
FAILED = 1
ERROR_IN_NODE_TABLE = 2
DP_ERROR = 3
TABLE_STRUCTURE_NAME_NOT_FOUND = 4
OTHERS = 5.
Regards,
Azaz Ali.
2007 Jun 11 2:03 PM
Hi,
I think the method TREE_GET_NODE_LAYOUT is useful. here you have the node layout info in ES_NODE_LAYOUT when u supply the node key to I_NODE_KEY.
Regards,
Sharat.
2007 Jun 11 2:15 PM
hi,
already I tried to use this method but it is private and when I check the code, the system return this message:
"Access to protected method "TREE_GET_NODE_LAYOUT" is not allowed."
Ther's a way to use a private method?
thanks.
Regards.
2007 Jun 11 2:18 PM
2007 Jun 11 2:29 PM
ok... the method TREE_GET_NODE_LAYOUT is called from method GET_OUTTAB_LINE that return ES_NODE_LAYOUT
thanks a lot to all.
Massimo