2007 Sep 20 1:40 AM
I want to build a tree that contained more than 5 nodes, use the table mtreesnode-node_key to build the node_key ,but this fields only 12 characters long.
Is there a good method to come true?
thanks
example:
CLEAR node.
///the key is only 12 charactors
CONCATENATE i_mtree-swerk i_mtree-beber i_mtree-tplnr
INTO node-node_key.
*
CONCATENATE i_mtree-swerk i_mtree-beber INTO str1.
node-relatkey = str1.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-hidden = ''.
node-disabled = ''.
node-isfolder = 'X'.
CLEAR node-n_image.
CLEAR node-exp_image.
CLEAR node-expander.
*
node-text = i_mtree-pltxt.
APPEND node TO node_table.
2007 Sep 24 7:55 AM
Thanks very much.
i think this is the best answer to solve this problem now,
but it has a fault. if you want to add more node_key, you have to build a temp table to record the node_key.
The T-CODE IH01's source codes contain the answer ,but i can't understand.
Thanks very much.
i think this is the best answer to solve this problem now,
but it has a fault. if you want to add more node_key, you have to build a temp table to record the node_key.
The T-CODE IH01's source codes contain the answer ,but i can't understand.
2007 Sep 24 3:08 AM
I'm not 100% sure I understand the question, but the problem seems to be that the combined length of i_mtree-swerk i_mtree-beber i_mtree-tplnr can exceed 12 characters... so instead you could set up a second internal table as follows:
data:
g_node_key(12) type n,
begin of gs_key_lookup,
key_numc like g_node_key,
swerk like iloa-swerk,
beber like iloa-beber,
tplnr like iloa-tplnr,
end of gs_key_lookup,
gt_key_lookup like gs_key_lookup occurs 100.and in your logic to build "node-node_key" simply add an entry to the table above for each new element, and retrieve entries from the internal table when you need to decode a node_key... something like...
data:
ls_key_lookup like gs_key_lookup.
* ///the key is only 12 charactors
move-corresponding i_mtree to ls_node_key.
add 1 to g_node_key. "unique ID per node
ls_node_key-node_key = g_node_key.
append ls_node_key to gt_node_key. "for lookups to decode node-node_key
clear: node.
node-node_key = g_node_key. "unique key links into gt_node_key
*" etc etcJonathan
2007 Sep 24 7:55 AM
Thanks very much.
i think this is the best answer to solve this problem now,
but it has a fault. if you want to add more node_key, you have to build a temp table to record the node_key.
The T-CODE IH01's source codes contain the answer ,but i can't understand.
2007 Sep 24 8:07 AM
Actually I think they are using something quite similar (at first glance at least)... the gt_node_objects is of type gtype_node_objects which has node_key in it.. and "hier" is a parallel internal table i.e. the sy-tabix of hier = sy-tabix of the gt_node_objects... the result is the same as above ... the g_node_key counter defined in the example above is the equivalent of using sy-tabix - I just prefer to make my own key.
Jonathan
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |