Creating dynamic tree in Apex 4.0
Hi Friends,
I am trying to display the "sites" and "devices" under that site in a tree. THe site is the first level in the tree. But under a site there will be some 20-30 devices. I want to display the first 10 devices when clicking on the '+' in a site and a 'more' link after the 10th device. By clicking the 'more' link ,display the next 10 devices and so on. Is there any way to achieve this in Apex 4.0. Please help
Regards,
Jyothi
Edited by: Jyothi on Jan 9, 2011 3:28 AM
Hi Vee,
Sorry for the late reply. I need exactly the same
do you want to add a 'more link' in place of all 2nd level children in your tree for 1st level node having more than 10 children under it ?
If there is 25 nodes i need to display the first 10 nodes and there is a more link in the last part. when clicking on the "more" link the next 10 nodes but with an additional "back" link in the top like
a..|-*back*
|- a11
|- a12
|- a13
|- a14
|- a15
|- a16
|- a17
|- a18
|- a19
|- a20
*more*when clicking on the back link the node part must dislay the last 10 nodes like.
a..|-a1
|- a2
|- a3
|- a4
|- a5
|- a6
|- a7
|- a8
|- a9
|- a10
*more*When clicking the "more" button will display the next 10 nodes with a "back" link like.
a..|-*back*
|- a21
|- a22
|- a23
|- a24
|- a25
If thge no: of nodes is less than 10 only "back" link is needed. Am i confusing you?
Please help.
Thanks,
Jyothi
Edited by: Jyothi on Jan 9, 2011 3:27 AM
Similar Messages
-
How to create dynamic tree based on BAPI
Hi
I am able to create dynamic tree based on flat file structure example given in SDN . But how to create the tree from BAPI directly.Also when I will be clicking on any leaf node of the tree some data related to the node will be passed to another view.
Regards
AnandaWhat i'm trying to do is create an organizational structure.
Global>Region>Plant-->Corporation
The output from the RFC is a structure containing every possible combination for orgazational hierarchy. Basically a flat table with record for every possible combinaton of Region-Plant-Corporation. This data needs to be bound to a tree structure so that we can call BW queries based on that level. For example: Give me aged inventory for the SAP corporation within the plant Berlin that is located in the Europe region.
Now that you understand the business reason will the nodes that represent Region and Plant and corporation be non-singleton nodes or recursive? I was thinking a hierarchy of non-singleton nodes.
I can bind these nodes to the Region - Plant - Corporation elements returned from in the flat table structure. I will probably get duplicates as a specific Region will be listed multiple times for every possible combination of the data beneath it. I'm not so concerned about that right now as I want to make sure I understand how in Web Dynpro to bind the data to the tree.
Hopefully this makes some sense. Can you elaborate on how this may be constructed in context of the view?
Would i create a model node for region (0..n), model node for plant (0..n), and a model node for Corporation (0..n)?
Or does this sound totally incorrect?
julian
We have 3 regions over 50 plants and probably around 500 corporations. -
Create dynamic tree using swings
how can i create dynamic tree ,the tree nodes are the folders in my c drive?
thanks in advanceto be honest, your question has been asked countless times already.
use the 'search forums' box at left. some possible keywords
JTree explorer files
you should find plenty of sample code. -
How to create dynamic tree component
I am using netbeans 5.5 and visual web pack to develop my jsf application.
I want to add a tree component that will be tied to a table with following columns:
id,parent_id,name
Actually the table stores data in tree structure with parent_id storing the parent of the row.
So a row with parent_id = 0 will be the root nodes of the tree.
When ever any root node is selected i want to fetch its children from the database and populate then as children of that parent node.
The tree can go to any depth so i want to make my tree component dynamic enough to handle this requirement.
How can i accomplish this.
I just want to add listerner for the plus sign of every node so that when the plus sign of that node is clicked i just want to get the id of the corresponding node.What i'm trying to do is create an organizational structure.
Global>Region>Plant-->Corporation
The output from the RFC is a structure containing every possible combination for orgazational hierarchy. Basically a flat table with record for every possible combinaton of Region-Plant-Corporation. This data needs to be bound to a tree structure so that we can call BW queries based on that level. For example: Give me aged inventory for the SAP corporation within the plant Berlin that is located in the Europe region.
Now that you understand the business reason will the nodes that represent Region and Plant and corporation be non-singleton nodes or recursive? I was thinking a hierarchy of non-singleton nodes.
I can bind these nodes to the Region - Plant - Corporation elements returned from in the flat table structure. I will probably get duplicates as a specific Region will be listed multiple times for every possible combination of the data beneath it. I'm not so concerned about that right now as I want to make sure I understand how in Web Dynpro to bind the data to the tree.
Hopefully this makes some sense. Can you elaborate on how this may be constructed in context of the view?
Would i create a model node for region (0..n), model node for plant (0..n), and a model node for Corporation (0..n)?
Or does this sound totally incorrect?
julian
We have 3 regions over 50 plants and probably around 500 corporations. -
How to create dynamic tree from db resultset?
i have a db and sql that includes item_id, parent_id, level, description for all hierarchy.
i want to show this resultset on the page as a adf tree component. How to convert from db resultset to adf tree?
that is my sql ->SELECT LEVEL, display_title, item_id, parent_id, sac_Hierarchy.Branch(level,description) branch FROM XXXTABLE CONNECT BY job_code = 'ABCD' AND PRIOR item_id = parent_id START WITH job_code = 'ABCD' AND parent_id IS NULL;
What can i do on backing java or what can i do on jsp page?
Help Please.
thanks
Edited by: Mehmet Özkan on Aug 30, 2008 12:19 PMmehmet,
Have you seen [url http://technology.amis.nl/blog/?p=2116]this?
John -
Implementing 3 level tree in Apex
Hi Friends,
I am trying to create a tree in apex. I am having 3 tables.
1.Client
2.Location
3.Device. I am having an materialized view "device_detail_view" with columns "device_id","location_id","client_id". This
Mview is having the "location_id" and the "client_id" for all devices. The corresponding client_name and location_name
is stored in the tables "client" and "Location". I want a tree in which the "Client_name" will be the root node. When
clicking on the client names all "location_name " assosiated with that need to be displayed. When clicking on a specific
"location_name" all "device_name" assossiated with that device must be displayed.How can i achieve this. Any input will
be appreciated.
Regards,
JyothiHi Hilary,
Your example was just so wonderful.I have a question.My tree works well.I have a requirement to show my link page at the same page with my tree.How can I do that?
For example I have
'View' as tooltip,
case when link_type = 'M'
then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:RIR'
when link_type = 'C'
then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:CIR:IR_CATEGORY:'
||name
when link_type = 'P'
then 'f?p='||:APP_ID||':6:'||:APP_SESSION||'::NO::P6_PRODUCT_ID:'
||sub_id
how can I redirect these pages to my tree page?
Thank you in advance -
i have found some example about how to create dynamic trees... and also found and example wich is similiar to my case on how to Building a hierarchical tree from recursive tables(Frank Nimphius' Blogbuster)....
i have a answer.... i want for the same example to hve on the right of the tree a form in wich i can add the eleemtn in the tree.... so i need a form to add element , and three buttons to add , delet, and save elements from the forms, in the moment they are deleted from forms are also deleted from tree....
can anyone pls give me and idea how to do this :):) or there is any similiar example with this case..
thanks in advance !i have found some example about how to create dynamic trees... and also found and example wich is similiar to my case on how to Building a hierarchical tree from recursive tables(Frank Nimphius' Blogbuster)....
i have a answer.... i want for the same example to hve on the right of the tree a form in wich i can add the eleemtn in the tree.... so i need a form to add element , and three buttons to add , delet, and save elements from the forms, in the moment they are deleted from forms are also deleted from tree....
can anyone pls give me and idea how to do this :):) or there is any similiar example with this case..
thanks in advance ! -
Hi
I have created a tree using APEX 2.2 and the wizard provided. The select for my tree is:
select "NODE_PRIMARY_KEY" id,
"NODE_FOREIGN_KEY" pid,
CASE
WHEN NODE_PRIMARY_KEY = :P6_SELECTED_PK THEN
'<span style="color:white;background-color:#0000CD;">'|| NODE_LABEL||'</span>'
ELSE
NODE_LABEL
END AS NAME,
'f?p=&APP_ID.:6:&SESSION.::NO::P6_SELECTED_PK:'||"NODE_PRIMARY_KEY" link,
NULL a1,
null a2
from "ADFY"."RRD_TREE_HIERARCHY"
ORDER BY 1
The above also highlights the current selected node. With a small data set the tree worked fine. Now that I have 'proper' data the tree's performance is not acceptable. I think the problem is due to the tree refreshing itself each time a node is selected. Is there anything that I can implement to stop this or to improve the performance of the tree?
I have tried the 'Tree with AJAX' example but couldn't really get it to work.
Thanks
PaulHi PARS,
Try the below query, I tried to run your query in SQL command and got the same error. I corrected your query, now its running in SQL Command,
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1end as status,
level,
apex_item.checkbox(1,empno,'')||ename as title,
NULL as icon,
EMPNO as value,
null as tooltip,
NULL as link
from "EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"
Hope It will work...I too referred that link you shared for this. But I am not sure we can use checkbox in tree report. Because we don't have any option to change the column 'display as' like 'standard report column'. then only it will show like checkbox else it will show the code like '<input type="checkbox" name="f01" value="7839" />KING'.
Thanks
Lakshmi -
How to create dynamic panel tree view?
Hello,
I can create dynamic pallete panel without any problems (from sdk/paneltreeview) , but i can't when it's a panel tree view (from sdk/paneltreeview). I don't know how to initialize it. Can i call IID_ITREEVIEWWIDGETMGR's impl directly in ActionComponent to create panel widget? and how?
Thanks in advance.solved by self
-
How to Create a Dynamic Tree?
Hi All.,
Warm Greetings..!
I am new to java. I want to create a DYNAMIC TREE to add , delete and rename nodes in it. I need to display Icon for parent nodes.
Ex: Root Node containts Group and User. I need to display an Icon for node Group and User. and I need to add child nodes to these parent nodes. And also I want to add a new Parent node with Icon.
Hope any body will help me. Please give some example codes.
Thanks :)
-s_p_sClass DefaultMutableTreeNode
-
How to create a dynamic tree report
hi experts,
i have a requirement to create a dynamic tree report in OM module.
this report should show the number of people positions required in a org unit, and also the number of people available in a org unit.
There is something called as qualification catalog to which qualifications are attached, to these qualifications org units are attached, these org units will have some positions attached to it, and each of this position might have a person attached to it.
The user will enter the qualification catalog number in the selection screen for which he should be getting the result in a tree format which flows from qualification catalog to qualifications, from qualifications to org units, from orgunits to the total no of positions present in this orgunit and the no of positions occupied in the orgunit.
This is a challenging job as far as i am concerned.
Please suggest me a way to approach this,i promise to reward the answers.
thanks in advance,
santosh.Hi,
Check the demo tree programs for yuor requirement?
SAP List Tree: SAPSIMPLE_TREE_CONTROL_DEMO
SAP Column Tree : SAPCOLUMN_TREE_CONTROL_DEMO
SAP Easy Tree : SAPSIMPLE_TREE_CONTROL_DEMO
Thanks,
Ramakrishna -
How to create right to left tree in apex
hi all
i want to create RTL tree in oracle apex , Who can advise?hi tommy.
I have this problem too.
could you find a way to do that?
i did some changes in theme css file.i could change tree body to rtl except + and - nodes logos. i mean at end it seem like :
(page left side)____________________________________(page right side)
+........................(lots of dots)...........................................TITLE1
+...........................................................................Title2
+.................................................................Title2_2
-........................................................................... Title3
-........................................................................... Title4 -
Hey All,
I'm creating an APEX front-end for a currently existing forms application. My issue is that the document manager created for this application does not have a single root node. There are several folders that make up the original.
It does use the ID, PARENT_ID, DESCRIPTION hierarchy already.
However being a very dynamic application we don't control how many records that won't have parent ids.
Is is possible to create a tree with several Roots or rather no single root using APEX functionality?
Does anybody have any documentation on how this could be done using AJAX or other technologies within APEX if it cannot be done?Hey All,
I'm creating an APEX front-end for a currently existing forms application. My issue is that the document manager created for this application does not have a single root node. There are several folders that make up the original.
It does use the ID, PARENT_ID, DESCRIPTION hierarchy already.
However being a very dynamic application we don't control how many records that won't have parent ids.
Is is possible to create a tree with several Roots or rather no single root using APEX functionality?
Does anybody have any documentation on how this could be done using AJAX or other technologies within APEX if it cannot be done? -
Dynamic tree UI element in the view
Dear All,
Can anyone provide me with the code snippet for Dynamic Tree UI element in the view. I need to show the tree which should be generated dynamically.
Thanks alot in advance!
Points will be rewarded, Please its urgent!
Cheers,
Darshna.Hi ,
sorry for the late reply... here is the code for onActionLoadchildren .. i am sure you wont understand this.. but lets try...
DATA:
element_parent TYPE REF TO if_wd_context_element,
lv_object_key1 type string,
lv_object_type type string.
DATA:
node_root_entry TYPE REF TO if_wd_context_node,
elem_root_entry TYPE REF TO if_wd_context_element,
stru_root_entry TYPE if_structure_view_new=>element_root_entry ,
item_valid_from LIKE stru_root_entry-valid_from,
item_plant LIKE stru_root_entry-plant,
item_equi_key LIKE stru_root_entry-equi_key,
item_object_key LIKE stru_root_entry-object_key,
item_object_type TYPE string,
item_path TYPE string,
item_parent_path TYPE string,
context_node TYPE REF TO if_wd_context_node,
root_entry TYPE if_structure_view_new=>element_selected_entry.
l_ref_componentcontroller TYPE REF TO ig_componentcontroller.
DATA:
node_root_info TYPE REF TO if_wd_context_node,
elem_root_info TYPE REF TO if_wd_context_element,
stru_root_info TYPE if_structure_view_new=>element_root_info .
DATA:
element TYPE REF TO if_wd_context_element,
node_selected_entry TYPE REF TO if_wd_context_node,
elem_selected_entry TYPE REF TO if_wd_context_element.
DATA:
ls_hier_return TYPE rplm_ts_struc_elements,
lt_hier_return TYPE TABLE OF rplm_ts_struc_elements,
ls_hier_return_temp TYPE rplm_ts_struc_elements,
lt_hier_return_temp TYPE TABLE OF rplm_ts_struc_elements,
ls_hier_level TYPE rplm_ts_hier_level,
lt_hier_level TYPE TABLE OF rplm_ts_hier_level,
ls_hier_return_sort TYPE rplm_mt_ts_hier,
lt_hier_return_sort TYPE TABLE OF rplm_mt_ts_hier.
DATA:
temp_hier_level TYPE if_structure_view_new=>element_hier_level,
lt_hier_temp TYPE TABLE OF if_structure_view_new=>element_hier_level,
lt_temp TYPE TABLE OF if_structure_view_new=>element_hier_level.
DATA:
lc_path TYPE string,
lv_object_key TYPE string.
DATA:
lv_hier_lines TYPE i.
DATA:
node_entries TYPE REF TO if_wd_context_node,
node_sub_entries TYPE REF TO if_wd_context_node,
elem_sub_entries TYPE REF TO if_wd_context_element,
stru_sub_entries TYPE if_structure_view_new=>element_sub_entries .
TYPES: BEGIN OF ls_hier_type, "structure for Hierarchy table
object(31) TYPE c, "Objectkey
predecessor(31) TYPE c, "Objectkey Predecessor
data(2000) TYPE c, "Data container
level TYPE i, "level of object in tree
successors(1) TYPE c, "Object has successors: YES/NO/U
display(1) TYPE c, "Object is displayed: YES/NO
selected(1) TYPE c, "Object is selected/marked: YES/NO
index_predec LIKE sy-tabix, "Index predecessor
strno TYPE ilom_strno,"External number for func. loc.
"in BOMs used for top object
END OF ls_hier_type.
DATA:
ls_hier TYPE ls_hier_type,
lt_hier TYPE TABLE OF ls_hier_type WITH DEFAULT KEY,
lt_mat_hier TYPE TABLE OF ls_hier_type WITH DEFAULT KEY.
" For retrieving Material Data Heirarchy
DATA:
lh_stpo_tab TYPE TABLE OF rihstpx ,
lwa_stpo_tab LIKE LINE OF lh_stpo_tab,
check_menge TYPE string ,
check_meins TYPE string ,
lwa_mat_hier LIKE LINE OF lt_mat_hier ,
lt_dup_mat_hier LIKE lt_mat_hier,
lv_len TYPE i,
lv_len_temp TYPE i .
DATA:
lv_equnr TYPE equi-equnr,
lv_tplnr TYPE iflo-tplnr,
lv_matnr TYPE mast-matnr.
DATA:
lv_cnt TYPE i,
lv_index TYPE i.
DATA:
lv_path TYPE string,
lv_parent_path TYPE string,
pos TYPE string,
separator TYPE c VALUE '.',
max_level TYPE i,
temp_level TYPE i,
counter TYPE i VALUE 1.
TYPES: BEGIN OF ls_pred_type, "structure for Hierarchy table
parent(31) TYPE c, "Objectkey Predecessor
path(2000) TYPE c, "Data container
index_predec LIKE sy-tabix, "Index predecessor
END OF ls_pred_type.
DATA:
ls_pred TYPE ls_pred_type,
lt_pred TYPE TABLE OF ls_pred_type WITH DEFAULT KEY.
DATA:
lv_int_obj_key TYPE string,
obj_len TYPE i,
lv_funcloc_ext TYPE ilom_strno,
lv_funcloc TYPE itob-tplnr.
DATA:
lv_level TYPE i,
lv_temp TYPE i,
lt_path_entries TYPE string_table.
DATA:
node_general TYPE REF TO if_wd_context_node,
elem_general TYPE REF TO if_wd_context_element,
stru_general TYPE if_structure_view_new=>element_general ,
item_collapse_visibility LIKE stru_general-collapse_visibility.
DATA:
elem_context TYPE REF TO if_wd_context_element,
stru_context TYPE if_structure_view_new=>element_context ,
item_expand_all LIKE stru_context-expand_all.
lv_path = path.
Get Element whose children shall be loaded
element_parent = wd_context->path_get_element( lv_path ).
element_parent->get_attribute(
EXPORTING
name = `OBJECT_KEY`
IMPORTING
value = LV_object_key ).
element_parent->get_attribute(
EXPORTING
name = `OBJECT_TYPE`
IMPORTING
value = lv_object_type ).
node_root_entry = wd_context->get_child_node( name = wd_this->wdctx_root_entry ).
get element via lead selection
elem_root_entry = node_root_entry->get_element( ).
get single attribute
elem_root_entry->get_attribute(
EXPORTING
name = `VALID_FROM`
IMPORTING
value = item_valid_from ).
elem_root_entry->get_attribute(
EXPORTING
name = `PLANT`
IMPORTING
value = item_plant ).
item_object_type = lv_object_type.
if lv_object_type eq 'EQUI'.
item_object_key = ''.
item_equi_key = lv_object_key.
elseif lv_object_type eq 'FUNCLOC'.
item_object_key = lv_object_key.
item_equi_key = ''.
ELSE.
lv_matnr = lv_object_key.
For BOM, material and Assembly
endif.
IF item_object_type EQ 'EQUI'.
lv_equnr = lv_object_key.
ELSEif item_object_type eq 'FUNCLOC'.
lv_tplnr = lv_object_key.
ELSE.
LV_MATNR = lv_object_key.
exit.
ENDIF.
CALL FUNCTION 'PM_HIERARCHY_CALL'
EXPORTING
datum = item_valid_from
equnr = lv_equnr
tplnr = lv_tplnr
matnr = lv_matnr
levdo = '99'
levup = '00'
sanin = 'X'
select_equi = 'X'
select_iflo = 'X'
select_stpo = 'X'
selmod = 'D'
stkkz = ''
werks = item_plant
with_equi = 'X'
with_equi_hier = 'X'
with_iflo_hier = 'X'
with_btyp = 'X'
with_mara = 'X'
with_ibase_hier = ''
capid = ''
emeng = 0
IMPORTING
et_hier = lt_hier
EXCEPTIONS
no_hierarchy = 1
no_object_defined = 2
no_selection = 3
no_valid_equnr = 4
no_valid_matnr = 5
no_valid_selmod = 6
no_valid_tplnr = 7
OTHERS = 8.
LOOP AT lt_hier INTO ls_hier.
ls_hier_return-object_key = ls_hier-object.
ls_hier_level-object_key = ls_hier-object.
ls_hier_level-predecessor = ls_hier-predecessor.
lv_len = strlen( ls_hier-object ).
IF lv_len GT 1.
lv_len_temp = lv_len - 1.
ELSEIF
lv_len_temp = lv_len.
ENDIF.
ls_hier_level-level = ls_hier-level.
IF ls_hier-object(1) = 'T'.
ls_hier_return-icon = 'ICON_TECHNICAL_PLACE'.
ls_hier_return-object_type = 'FUNCLOC'.
IF ls_hier-successors = 'Y'.
ls_hier_return-is_leaf = abap_false.
ls_hier_return-is_expanded = abap_false.
ls_hier_return-children_loaded = abap_true.
ELSE.
ls_hier_return-is_leaf = abap_true.
ls_hier_return-is_expanded = abap_true.
ls_hier_return-children_loaded = abap_true.
ENDIF.
ELSEIF ls_hier-object(1) = 'E'.
ls_hier_return-icon = 'ICON_EQUIPMENT'.
ls_hier_return-object_type = 'EQUI'.
IF ls_hier-successors = 'Y'.
ls_hier_return-is_leaf = abap_false.
ls_hier_return-is_expanded = abap_false.
ls_hier_return-children_loaded = abap_true.
ELSE.
ls_hier_return-is_leaf = abap_true.
ls_hier_return-is_expanded = abap_true.
ls_hier_return-children_loaded = abap_true.
ENDIF.
ELSEIF ls_hier-object+lv_len_temp(1) = 'M'.
ls_hier_return-icon = 'ICON_MATERIAL'.
ls_hier_return-object_type = 'MATERIAL'.
IF ls_hier-successors = 'Y'.
ls_hier_return-is_leaf = abap_false.
ls_hier_return-is_expanded = abap_false.
ls_hier_return-children_loaded = abap_false.
ELSE.
ls_hier_return-is_leaf = abap_true.
ls_hier_return-is_expanded = abap_true.
ls_hier_return-children_loaded = abap_true.
ENDIF.
ELSEIF ls_hier-object+lv_len_temp(1) = 'X'.
ls_hier_return-icon = 'ICON_SUPPLY_AREA'.
ls_hier_return-object_type = 'MATBOM'.
IF ls_hier-successors = 'Y'.
ls_hier_return-is_leaf = abap_false.
ls_hier_return-is_expanded = abap_false.
ls_hier_return-children_loaded = abap_false.
ELSE.
ls_hier_return-is_leaf = abap_true.
ls_hier_return-is_expanded = abap_true.
ls_hier_return-children_loaded = abap_true.
ENDIF.
ELSEIF ls_hier-object+lv_len_temp(1) = 'A'.
ls_hier_return-icon = 'ICON_MATERIAL_REVISION'.
ls_hier_return-object_type = 'MATERIAL'.
IF ls_hier-successors = 'Y'.
ls_hier_return-is_leaf = abap_false.
ls_hier_return-is_expanded = abap_false.
ls_hier_return-children_loaded = abap_false.
ELSE.
ls_hier_return-is_leaf = abap_true.
ls_hier_return-is_expanded = abap_true.
ls_hier_return-children_loaded = abap_true.
ENDIF.
ENDIF.
*IF ls_hier-predecessor EQ item_object_key OR ls_hier-object EQ item_object_key.
APPEND ls_hier_return TO lt_hier_return.
APPEND ls_hier_level TO lt_hier_level.
*ENDIF.
CLEAR lv_len.
CLEAR lv_len_temp.
ENDLOOP.
lt_hier_return_temp = lt_hier_return.
DESCRIBE TABLE lt_hier LINES lv_hier_lines.
IF lv_hier_lines EQ 0.
elem_selected_entry = wd_context->path_get_element( '1.ENTRIES.1' ).
Get children node
elem_selected_entry->set_attribute(
value = abap_true
name = 'IS_LEAF' ).
ENDIF.
*************************************Deleting Now***********
SORT lt_hier_level BY level DESCENDING.
LOOP AT lt_hier_level INTO ls_hier_level.
max_level = ls_hier_level-level.
EXIT.
ENDLOOP.
SORT lt_hier_level BY level ASCENDING.
LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 0.
ls_hier_level-path = '1.ENTRIES.1'.
ls_hier_level-parent_path = '1.ENTRIES.1'.
MODIFY lt_hier_level FROM ls_hier_level.
ENDLOOP.
************************New design to Generate Path and Parent path
lv_cnt = 0.
temp_level = 1.
SORT lt_hier_level BY object_key ASCENDING.
LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 1.
lv_cnt = lv_cnt + 1.
lv_parent_path = '1.ENTRIES.1'.
ls_hier_level-parent_path = lv_parent_path.
pos = lv_cnt.
CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
ls_hier_level-path = lv_path.
MODIFY lt_hier_level FROM ls_hier_level.
ENDLOOP.
temp_level = 1.
lv_cnt = 0.
*********************Need to call this for each level ***************************
WHILE temp_level LT max_level.
CLEAR lt_pred.
CLEAR ls_pred.
LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ temp_level.
ls_pred-parent = ls_hier_level-object_key.
ls_pred-path = ls_hier_level-path.
APPEND ls_pred TO lt_pred.
ENDLOOP.
SORT lt_pred BY parent.
DELETE ADJACENT DUPLICATES FROM lt_pred.
LOOP AT lt_pred INTO ls_pred.
lv_cnt = 0.
LOOP AT lt_hier_level INTO ls_hier_level WHERE predecessor EQ ls_pred-parent.
lv_cnt = lv_cnt + 1.
lv_parent_path = ls_pred-path.
ls_hier_level-parent_path = lv_parent_path.
lv_path = ''.
pos = lv_cnt.
CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
ls_hier_level-path = lv_path.
MODIFY lt_hier_level FROM ls_hier_level.
ENDLOOP.
ENDLOOP.
temp_level = temp_level + 1.
ENDWHILE.
LOOP AT lt_hier_level INTO ls_hier_level.
LOOP AT lt_hier_return INTO ls_hier_return.
IF ls_hier_level-object_key = ls_hier_return-object_key.
MOVE-CORRESPONDING ls_hier_level TO ls_hier_return.
MODIFY lt_hier_return FROM ls_hier_return.
ENDIF.
ENDLOOP.
ENDLOOP.
SORT lt_hier_return BY path ASCENDING.
**************************Delete the extra first character returned by PM_HIERARCHY_CALL******
LOOP AT lt_hier_return INTO ls_hier_return.
IF ls_hier_return-object_key(1) = 'T'.
SHIFT ls_hier_return-object_key BY 1 PLACES.
lv_object_key = ls_hier_return-object_key.
lv_funcloc_ext = lv_object_key.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
input = lv_funcloc_ext
IMPORTING
output = lv_funcloc.
lv_int_obj_key = lv_funcloc.
ls_hier_return-object_key = lv_int_obj_key.
ELSEIF ls_hier_return-object_key(1) = 'E'.
SHIFT ls_hier_return-object_key BY 1 PLACES.
lv_object_key = ls_hier_return-object_key.
obj_len = strlen( lv_object_key ).
IF obj_len GE 18.
lv_object_key = lv_object_key+0(18).
ENDIF.
wd_comp_controller->conv_ext_2_int(
EXPORTING
iv_object_key_ext = lv_object_key " String
iv_object_type = 'EQUI' " String
IMPORTING
ev_object_key = lv_int_obj_key " String
SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
ls_hier_return-object_key = lv_int_obj_key.
ELSE.
SHIFT ls_hier_return-object_key BY 1 PLACES.
lv_object_key = ls_hier_return-object_key.
obj_len = strlen( lv_object_key ).
IF obj_len GE 18.
lv_object_key = lv_object_key+0(18).
ENDIF.
SHIFT lv_object_key LEFT DELETING LEADING '0'.
ls_hier_return-object_key = lv_object_key.
ENDIF.
MODIFY lt_hier_return FROM ls_hier_return TRANSPORTING object_key object_key.
ENDLOOP.
LOOP AT lt_hier_level INTO ls_hier_level.
IF ls_hier_level-object_key(1) = 'T'.
SHIFT ls_hier_level-object_key BY 1 PLACES.
lv_object_key = ls_hier_level-object_key.
lv_funcloc_ext = lv_object_key.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
input = lv_funcloc_ext
IMPORTING
output = lv_funcloc.
lv_int_obj_key = lv_funcloc.
ls_hier_level-object_key = lv_int_obj_key.
ELSEIF ls_hier_level-object_key(1) = 'E'.
SHIFT ls_hier_level-object_key BY 1 PLACES.
lv_int_obj_key = ls_hier_level-object_key.
obj_len = strlen( lv_int_obj_key ).
IF obj_len GE 18.
lv_int_obj_key = lv_int_obj_key+0(18).
ENDIF.
wd_comp_controller->conv_ext_2_int(
EXPORTING
iv_object_key_ext = lv_int_obj_key " String
iv_object_type = 'EQUI' " String
IMPORTING
ev_object_key = lv_int_obj_key " String
SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
ls_hier_level-object_key = lv_int_obj_key.
ELSE.
SHIFT ls_hier_level-object_key BY 1 PLACES.
lv_int_obj_key = ls_hier_level-object_key.
obj_len = strlen( lv_int_obj_key ).
IF obj_len GE 18.
lv_int_obj_key = lv_int_obj_key+0(18).
ENDIF.
SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
ls_hier_level-object_key = lv_int_obj_key.
ENDIF.
MODIFY lt_hier_level FROM ls_hier_level TRANSPORTING object_key object_key.
ENDLOOP.
*********************Getinfo if root node else call Get_Children_Info to generate the structure as well*******
IF lv_path EQ '1.ENTRIES.1'.
element = wd_context->path_get_element( lv_path ).
navigate from <ENTRIES> to <SUB_ENTRIES> via lead selection
node_sub_entries = element->get_child_node( name = 'SUB_ENTRIES' ).
element->get_attribute( EXPORTING name = 'OBJECT_KEY'
IMPORTING value = item_object_key ).
element->get_attribute( EXPORTING name = `OBJECT_TYPE`
IMPORTING value = item_object_type ).
****************Get Info of Technical Objects*************
wd_comp_controller->get_children_info(
EXPORTING
iv_lt_list = lt_hier_return " Rplm_Tt_Mt_Struc
iv_path = ''
iv_hier_level = lt_hier_level
IMPORTING
ev_lt_full = lt_hier_return " Rplm_Tt_Mt_Struc
Create the strcuture by binding the entries to Node which is bound to the table
element = wd_context->path_get_element( lc_path ).
Get children node
node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
CALL METHOD node_sub_entries->bind_table
EXPORTING
new_items = lt_hier_return
set_initial_elements = abap_true.
@TODO handle not set lead selection
IF ( node_entries IS INITIAL ).
ENDIF.
lv_temp = 1.
***************Sort the LT_HIER_TABLE appropriately ******
LOOP AT lt_hier_return INTO ls_hier_return .
MOVE-CORRESPONDING ls_hier_return TO ls_hier_return_sort.
ls_hier_return_sort-path_length = strlen( ls_hier_return_sort-path ).
APPEND ls_hier_return_sort TO lt_hier_return_sort.
ENDLOOP.
SORT lt_hier_return_sort BY path_length ASCENDING path ASCENDING.
CLEAR lt_hier_return.
LOOP AT lt_hier_return_sort INTO ls_hier_return_sort.
MOVE-CORRESPONDING ls_hier_return_sort TO ls_hier_return.
APPEND ls_hier_return TO lt_hier_return.
ENDLOOP.
*wd_comp_controller->gv_master_data = lt_hier_return.
LOOP AT lt_hier_return INTO ls_hier_return.
lv_path = ls_hier_return-path.
lc_path = ls_hier_return-parent_path.
IF lv_path NE '1.ENTRIES.1'.
element = wd_context->path_get_element( lc_path ).
Get children node
node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
Now, create the children elements
element->get_attribute( EXPORTING name = 'OBJECT_KEY'
IMPORTING value = ls_hier_level-predecessor ).
Create the strcuture by binding the entries to Node which is bound to the table
CALL METHOD node_sub_entries->bind_structure
EXPORTING
new_item = ls_hier_return
set_initial_elements = abap_false.
ENDIF.
ENDLOOP.
Only when a new level is reached we create one more child node
else we attach our elements to same child node
element = wd_context->path_get_element( item_path ).
Get children node
element->set_attribute(
value = abap_false
name = 'IS_EXPANDED' ).
ENDIF.
navigate from <CONTEXT> to <GENERAL> via lead selection
node_general = wd_context->get_child_node( name = wd_this->wdctx_general ).
get element via lead selection
elem_general = node_general->get_element( ).
get single attribute
elem_general->set_attribute(
name = `COLLAPSE_VISIBILITY`
value = abap_false ).
node_selected_entry = wd_context->get_child_node( name = if_structure_view_new=>wdctx_selected_entry ).
get element via lead selection
elem_selected_entry = node_selected_entry->get_element( ).
get single attribute
elem_selected_entry->set_attribute(
name = `OBJECT_KEY`
value = '' ).
elem_selected_entry->set_attribute(
name = `OBJECT_TYPE`
value = '' ).
get element via lead selection
elem_context = wd_context->get_element( ).
get single attribute
elem_context->set_attribute(
name = `EXPAND_ALL`
value = abap_false ).
wd_this->enable_buttons(
endmethod. -
How to create a tree in table?
How to create a tree in table?
Hi,
check these links,
Tree Structure:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#31
/people/paolo.romano2/blog/2007/11/09/dynamic-tree-in-abap-webdynpro
Regards,
Muneesh Gitta.
Maybe you are looking for
-
FI-MM Account Determination Question
Hello Gurus, I have the following specific requirement from our business: Is there any specific table in SAP that will give us the correct GL accounts if I mention valuation class and movement type? I know table T030 for account determination and we
-
CSV-File with eclass 4.1 oder 5.x
Dear all, is anybody out there who can offer me a eclass 4.1 oder 5.x classification load file for ccm 2.0. I want to feed the master catalog with this classification. Any hints and tips for creating this file are welcome. Kindest regards Roman Becke
-
Importing all images without duplicates - LR3, LR4, LR5
Howdy. I've been using Lightroom 3 for a couple years. Recently, a friend passed away. I went to look for photos of him and realized that many were missing. I've since found a few of them on Facebook, and suspect that some are lurking in old backups
-
PC can read but a Apple can not VIA internet
I have a G5 Tower with filemaker pro 5 on the LAN side of the network. I have mapped the IP address to the G5. In the router, a Linksys, I opened port #5003 & #591 for Filemaker and port #548 for Apple. On the LAN side of the network all my Macs and
-
Can i re restore ios8.1 in iphone4s
i m allready use ios8.1 and now running 8.1 but some issue than i want again restore 8.1 can i restore 8.1 in my iphone 4s plz reply me fast my phone is off