on 04-07-2009 3:37 PM
Hello,
I'm trying to create a tree containing a hierarchy of orgunits.
So I created a view containing a Tree and a TreeNodeType.
In my context I have the following structure :
->Context
-
>OU
-
>OU_CHILD <Recursion node on OU>
-
>Name <Attribute>
-
>Value <Attribute>
-
>has_children <Attribute>
On the initialization of my view I populate the first level of the context putting the root orgunit of my hierarchy by setting its attribute.
lo_nd_ou = wd_context->get_child_node( name = wd_this->wdctx_ou ).
lo_el_ou = lo_nd_ou->create_element( ).
lo_nd_ou->bind_element( new_item = lo_el_ou ).
lo_el_ou->set_attribute( name = 'NAME' value = node_L1-name ).
lo_el_ou->set_attribute( name = 'VALUE' value = node_L1-value ).
lo_el_ou->set_attribute( name = 'HAS_CHILDREN' value = node_L1-has_children ).
On the onLoad event I added a method to create childs orgunits and bind them to the current one.
I perform this code in a select endselect statement
lo_nd_ou = context_element->get_node( ).
lo_nd_ou_child = lo_nd_ou->get_child_node( name = 'OU_CHILD' ).
Select * from hrp1001 into wa_hrp1001
WHERE objid = wa_ouid
AND begda <= sy-datum
AND endda >= sy-datum
AND subty = 'BX02'.
SELECT * from hrp1000 into wa_hrp1000
WHERE objid = wa_hrp1001-sobid
AND begda <= sy-datum
AND endda >= sy-datum.
wa_index = wa_index + 1.
clear wa_has_children.
data wa_orgeh type orgeh.
move wa_hrp1001-sobid to wa_orgeh.
CALL FUNCTION 'Z_Z6H_OWF_OU_HAS_CHILDREN'
EXPORTING
WN_OUID = wa_orgeh
WN_VIEW = 'A'
IMPORTING
FLAG = wa_has_children.
lo_el_ou_child = lo_nd_ou_child->create_element( ).
lo_nd_ou_child->bind_element( index = wa_index new_item = lo_el_ou_child SET_INITIAL_ELEMENTS = ABAP_False ).
lo_el_ou_child->set_attribute( name = 'NAME' value = wa_hrp1000-stext ).
lo_el_ou_child->set_attribute( name = 'VALUE' value = wa_hrp1001-sobid ).
lo_el_ou_child->set_attribute( name = 'HAS_CHILDREN' value = wa_has_children ).
ENDSELECT.
ENDSELECT.
The problem I got is that It works for the first level, but when I expand the second level nothing happens even if the code is being executed and that it contains sub-orgunits to attach to this one.
Output :
Root Orgunit
|----
Level1-OU1
|----
Level1-OU2
|----
Level1-OU3 <has chidren but nothing happens when expanded>
Does anybody know the cause of this problem?
Thanks for your help.
Best regards
Hamza
Hello,
I finally found the answer by trying all possibilities.
In fact for this to work you always have to set the lead selection on the expanded node.
Regards
Hamza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No idea ?
Thanks for your help
Regards
Hamza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.