Heirarchial Tree
Hi,
I am very new to forms, Can some body help me
how to use the tree control. I need to populate the tree with the values from the database.
Thank You,
null
Hellow
You may go to the demos Dir.
it's i think in aplace like:
C:\Orant\Tools\DEVDEM\Demo\Forms\navwiz.fmb
even this is a little bit intermediate (in terms of complexity).. but it is a very good to understand & Consider ...
hope this helps
regards
Tariq
Similar Messages
-
Heirarchy Tree in a Master Detail Relationship
I am trying to use the heirarchy tree in a multiple tab
interface form in Forms 6i. I have the tree populating properly
on the initial master record query. However, I can't get the
tree to clear on subsequent queries, like a master-detail clears
on an ON-CLEAR-DETAIL trigger. The heirarchy tree doesn't
clear, since no relationship is built between the master and the
tree block. I'm using a procedure to do the populating. It gets
called from several different triggers.
Anyone done something like this before? How did you do it?
Any assistance would be appreciated!
Keith Geving
[email protected]hmmm,
If you're creating your tree from a record group you could Clear
that group and build the tree again, this will create an empty
tree:
tree_recs := Get_Group_Row_Count(Group_id);
for i in 1..tree_recs loop
delete_group_row(Group_id, tree_recs - i + 1);
end loop;
ftree.set_tree_property('Your_Tree', ftree.record_group,
Group_id); -
Additional Items in Heirarchial Tree
I Have a Unit filed in my Tree structure. Unit is only for the Last level of the tree ie at 6th level
When i select 6th level in a tree, I should get Unit filed value in :control.unit.
How do we get it. Here is my structure.
INITIAL_LEVEL
NODE_DEPTH
NODE_LABEL
NODE_ICON
NODE_DATA
NODE_PARENT
UNIT
Any similar command like below :
:ACT.PARENT_DEPTH := Ftree.Get_Tree_Node_Property(htree,:SYSTEM.TRIGGER_NODE,Ftree.NODE_DEPTH);AFAIK, unless you use that "UNIT" explicitly somewhere in Label / Data, you cannot get it directly. Having said that, once you get few required values (like, Node Depth, Node Value, Parent etc, you should be able to query it from the table.
ex.
select unit into :global.myUnit from <my_tree_table> where NODE_DEPTH = :global.node_depth and NODE_LABEL = :global.node_label and NODE_PARENT = :global.node_parent;:global variables is just an example, you can store them in some variable (by using FTree.Get_Tree_Node_Property on the trigger node) and use them here.
-Arun -
I have three questions
1. I want to collapse all nodes in the tree on display. By default all nodes are expanded. Any body is having the code.
2. How to dynamically refresh the tree with data from the database. When I give query again it is giving error.
3. Sometimes the database may not contain more than one record for the 'start with' option I have given in the query. In this case the forms is giving error. How to overcome this errorr. I want to display even one record though it may not form a tree.
Mohan1. try to have 0 instead of 1 in the expend item of the tree structure
select 0,level,ename,null,ename
2. use the populate_tree built-in -
Report Generation Toolkit and Applicatio​n Builder
I am going insane trying to work this out.
I am trying to build an EXE program using Application Builder. The program uses the Office Report Generation Toolkit.
I have tried including the dynamic VIs into the project, both from the Development machine and from the CD. I still have the same problem : the application does not start Excel. It is like the commands go into a black hole. There isn't even an error message.
I have attached my report VI for you to peruse. Any help is appreciated.
Brian Rose
Solved!
Go to Solution.
Attachments:
TestReport.vi 122 KBYes, Labview 8.2
Office Toolkit = 1.1.1
I have tried many combinations of what files are included, from just the top level VI, to every VI in the heirarchy tree (a major pain). I am now trying to rebuild the project from scratch and see if that does anything.
Brian Rose -
Is there a way to get rid of the space left when I delete a field?
I have a document that I am editing and I have deleted some fields but that leaves big white spaces in the document. Is there some way that I can get rid of those spaces without having to manually move up all the subsequent fields one by one?
Not really. There are things you can do to make the process easier, but you can't just highlight the white space and hit 'delete' to bump everything up.
You can select all of the items below what you removed on the heirarchy tree (that are on the same page) and move them all up at once.
You could make the document flowed and enclose the whole area in a subform, but that presents its own set of challenges if the fields and such do not already take up entire lines (or close to it). It does make the process easier in the future if you have to add/remove more items again. -
Need opinions/links/etc... regarding Oracle security for a custom app
Okay it's an open ended question but I need some help figuring out what we should be doing.
We have an old legacy Sybase system written in Powerbuilder which they want to move to a web app. Great! That means we get new toys. Problem, it's a standalone system now being merged into a web system. We're looking at Oracle 10.2 and App Server to run everything. We're not sure about reporting yet.
Here's my question. What/how is everyone using for user account security? I'll have say 5000 users at different locations in the world. Let's say you have sites A, B and C. I'll ultimately need to be able to allow Mr. Smith at Site A to create info which nobody at site B or C is allowed to see. But then Mr. Smith's manager should be allowed to see all the work done by his people so he technically has visibility to everything at site A regardless if he created it or not. The company VP & Presidents need to see everything from sites A, B and C. (Also possibly allow someone to 'grant' access to another person's info. ie - someone at site A allowing someone at site B to view their info by some interface setting)
Now there's a second level of sensitivity. Say unclassified, classified and top secret. Each employee, regardless of where they sit in the heirarchy tree above, can only see documents up to their sensitivity level. So someone with classified access can see unclassified and classified items, but not top secret.
Now I've looked at Oracle row level security and it looks like exactly what I'll need but that means that every user, needs to be a database user? I've never worked with something like that. The only other way I'm aware of doing this, would be have the application developers code all the checks into the system based on user info. That leaves lots of maintenance headaches and we will need a reporting tool so then we have to recreate all that info on the report side as well. (which is actually the way the current standalone system works. One main user to do the connections, then we have a "user table" to check rights, password & so forth).
Is it unheard of to create a custom app (that's the key, there is no COTS for this), then have all the user accounts be stored as actual Oracle users? For a web app, I'm used to a single user being the "pass through" for any connections to the database then pass that back to the user. Are there any considerations or tricks to integrate Oracle user creation into the system or it's as simple as have the app run the correct sql from an account with the correct permissions?
How else can this be done or how else is everyone doing it? Any links to info would be great and most appreciated. Stories and how you did it type of info is also real good!
Thanks.Pierre,
That helped a lot. I ended up ordering one of Tom's recommended books on security. I also was able to find a few examples (once I figured what I needed to be looking for) that got me up and running with a test instance to play with.
Thank you very much! -
I've noticed this problem for some time now & thought I had found the fix, but the problem has returned.
From the desktop with no other applications in focus, the menu bar has a few options; one of which is "GO"
Usually, I click on "GO" to shortcut into my Utilities, iDisk, Home, or Applications folder. Sometimes, I even use the keyboard shortcuts: (AppleShiftA) for instance, to navigate to my Applications folder.
Well, one of the options under the "GO" menu is "NETWORK" (AppleShiftK). When I first boot up the computer, without turning on Airport, I can use the keyboard shortcut, and navigate to it directly from the "GO" menu. However, when I've turned on Airport, at any time during this boot session and try the same thing, the first time I try to access it, it pulls up a finder window for a half a second, displaying the network drives & such, then automatically closes. Now, I can access the other shortcuts under the "GO" menu whenever, without this problem. It only happens when I access the "GO" menu to navigate to Network after turning on Airport. The really strange thing is that I can navigate to any other Finder window from the "GO" menu, then click network in the heirarchy tree with no problem.
After I've tried to open it for the first time, and it closes, it does nothing during that same boot session if I try the keyboard shortcut again, or navigate through the go menu. It just doesn't respond. (yet everything else does)
I called Apple support on this issue, and they had me delete the com.apple.finder preference file in the library. Then it returned to normal and allowed me to use it again with no problem. However, this problem has returned.
Now I've only done one thing since deleting my com.apple.finder preference, but I find it unrelated.
I've keyed into terminal: "sudo pmset -a lidwake 0" Because I prefer to wake my computer by pressing a key after sleeping, rather than have it awake automatically b/c I have a loose sleep magnet which tends to wake my computer while traveling. And this was the only way to solve that problem without taking the computer in.
Has anyone else experienced this issue? Does anyone have any suggestions on how to fix this?
Any help will be GREATLY appreciated.
Thank you so much in advance!Yup. Did that but it had no effect.
I had this problem once before and just figured it was a quicktime bug since it only occurs on m2v files. Also, the problem went away for a while after the least quicktime update but came back a few weeks ago.
In list mode, those files appear not to have the proper Quicktime icons. Could it be a corrupted resource? -
NullPointerException on polymorphic model registration
I'm attempting to persist this heavily polymorphic heirarchial tree of mine:
@Persistent interface Node
@Persistent interface Child
@Persistent interface Branched
@Persistent abstract class AbstractNode {
@PrimaryKey(sequence = "Node.id")
private Long id;
@Entity class Root extends AbstractNode implements Branched {
@SecondaryKey(relate = Relationship.ONE_TO_MANY, relatedEntity = Child.class)
private Long[] children = new Long[2];
@Entity class Branch extends AbstractNode implementes Branched, Child {
@SecondaryKey(relate = Relationship.ONE_TO_MANY, relatedEntity = Child.class)
private Long[] children = new Long[2];
@SecondaryKey(relate = Relationship.MANY_TO_ONE, relatedEntity = Branched.class)
private Long parent;
@Entity class Leaf extends AbstractNode implements Child {
@SecondaryKey(relate = Relationship.MANY_TO_ONE, relatedEntity = Branched.class)
private Long parent;
}This is the problem I hit:
java.lang.NullPointerException
at com.sleepycat.persist.model.AnnotationModel.updateEntityInfo(AnnotationModel.java:329)
at com.sleepycat.persist.model.AnnotationModel.getClassMetadata(AnnotationModel.java:134)
at com.sleepycat.persist.model.EntityModel.registerClass(EntityModel.java:99)
at org.apache.lucene.clusterer.tree.Tree.<init>(Tree.java:82)
Where Tree.java is:
81: EntityModel model = new AnnotationModel();
82: model.registerClass(Node.class);
83: model.registerClass(Child.class);I set it up manually because I hit the 'same' exception from my inital getPrimaryIndex(.. when I don't:
java.lang.NullPointerException
at com.sleepycat.persist.model.AnnotationModel.updateEntityInfo(AnnotationModel.java:329)
at com.sleepycat.persist.model.AnnotationModel.getClassMetadata(AnnotationModel.java:134)
at com.sleepycat.persist.model.AnnotationModel.getEntityMetadata(AnnotationModel.java:71)
at com.sleepycat.persist.impl.Store.checkEntityClass(Store.java:1076)
at com.sleepycat.persist.impl.Store.getRelatedIndex(Store.java:478)
at com.sleepycat.persist.impl.Store.openSecondaryIndex(Store.java:653)
at com.sleepycat.persist.impl.Store.openSecondaryIndexes(Store.java:616)
at com.sleepycat.persist.impl.Store.getPrimaryIndex(Store.java:368)
at com.sleepycat.persist.EntityStore.getPrimaryIndex(EntityStore.java:245)
at org.apache.lucene.clusterer.tree.Tree.<init>(Tree.java:96)
90:// model.registerClass(Cluster.class);
91:// storeConfig.setModel(model);
92:
93: store = new EntityStore(env, "tree", storeConfig);
94:
95:
96: rootsById = store.getPrimaryIndex(Long.class, Root.class);Please advice. Code is available.
/Tony
Not too off topic, I saw in an earlier post (Re: Polymorphism and DPL that someone had problems persisting their polymorphic subclasses via a single method. I solved that using a visitor pattern:
public interface Node {
public abstract void accept(Visitor visitor);
public class Tree {
private final Visitor putVisitor = new Visitor() {
public void visit(Leaf leaf) {
leafsById.put(leaf);
public void visit(Branch branch) {
branchesById.put(branch);
public void visit(Root root) {
rootsById.put(root);
public void doTheThing(Node node) {
node.accept(putVisitor);
}Message was edited by:
Tony Clifton
Formatted textHi Tony,
The problem turned out to be
SecondaryKey(relatedEntity = My@PersistentInterface)Right. A relatedEntity must be an entity class. Interfaces may not be @Persistent or @Entity.
Sorry about the NPE, you should get a more meaningful exception when trying to make an interface @Persistent. I'll fix that and also clarify it in the javadoc.
It would be really nice with @PrimaryKey at
method-level.Methods are not used to define persistence in the DPL for a couple reasons:
1) Simplicity. Only fields are persistent, which is a simple rule. However, it is limiting. For example, you can't have a computed secondary key or a secondary key field nested in a sub-object, except by adding a redundant field in the @Entity class. For now, I suggest using the redundant field approach.
2) Performance. A key design goal for DPL is to avoid un-marshaling entities in the middle of JE read and write operations, in order to extract secondary keys from entity data. DPL stores secondary key values at the front of the record data, so extracting the value is very fast and does not require a full un-marshal. However, perhaps key values returned by annotated methods could be stored redundantly at the front of the record. Or if that isn't feasible, we simply say that you pay a performance penalty for using methods rather than fields to define persistence. More design work is needed, but it is probably feasible.
For now I'm going to put this aside and list it as something to consider in the future as a DPL enhancement. Please don't expect this to be added soon, but we will be thinking about it.
--mark -
How can an ADF Tree be configured to work with varying levels of heirarchy?
We have a need for a Locations tree that represents the Locations heirarchy for any one of our clients. Depending on the client the number of levels in a location heirarchy could range from 1 to 9.
I have created 9 different tree bindings and I can change the tree binding in the jsp page - the example below is for a client with 4 location levels.
<af:tree value="#{bindings.ScdLocs4View1.treeModel}" var="node"
binding="#{backing_locations.tree2}" id="tree2">
For a client with 5 location levels, I'd like to programatically change the value to
#{bindings.ScdLocs5View1.treeModel. How can I do this?
I was thinking I could use the setValue method on the tree control in my page's backing bean. But I have been unable to get a reference to the tree binding.
I don't see an appropriate method for finding a Tree Binding. There are methods for finding an Iterator Binding, an Executable Binding, or a Region Binding (whatever that is). But how do I "find" a reference to a Tree Binding?
I have also given consideration to using a single Tree Binding with 9 levels (or rules in the Tree Binding Editor) and finding a way to programatically "start" the rendering at a particular level (or rule) - in effect telling the ADF Tree control to ignore some number of rules and begin with the specified rule. But I haven't been able to figure out how to do this either.
Help would be greatly appreciated.Bill,
A tree binding is a particular kind of control binding, so you can find it as a control binding and then cast it to the more specific interface to work with it. -
Develop MDM Heirarchy table using Webdynpro Tree
Hi
Can anyone let me know how i can build a MDM Heirarchy table using webdynpro tree.
ThanksCan you be more specific? Is your problem with MDM or Web Dynpro? And what do you mean by "build an MDM Hierarchy Table"?
Walter -
Multi heirarchy DOM tree using XSU ???
I'm not able to retrieve a A-->b-->C-->D-->E heirarchy representation of XML data(String or DOM)
My Data base is in terms of simple tables so when I try to use simple OracleXMLQquey I'm not able to secure my objective...
I wud appreciate if anybody can send me an example code to derive multi level DOM tree using XSU API'sUse the CURSOR() operator, or object views to accomplish your goal.
See the release notes for the XSQL Servlet for some hints in this area.
My soon-to-be released book, "Building Oracle XML Applications" from O'Reilly has many additional examples of using these techniques.
-- Steve Muench
-- Building Oracle XML Applications -
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. -
Create a tree from a resultset
Hi,
I need to create a tree structure from a resultset and show them into my JSP. Here is my table sql (grup).
CREATE TABLE GRUP (
ID_GRUP int(11) NOT NULL default '0',
ID_GRUP_PARENT int(11) NOT NULL default '0',
ORDER_BY int(11) NOT NULL default '1',
DESCRP varchar(100) default NULL,
PRIMARY KEY ('ID_GRUP'),
)What I really need is a recursive method to search for all the children of each row and build a tree heirarchy. e.g. the data may look like
ID_GRUP ID_GRUP_PARENT ORDER_BY DESCRP
1 0 1 It itself is the parent
2 1 1 It's Parent is ID_GRUP=1
3 0 2 It itself is the parent
4 2 1 It's parent is ID_GRUP=2
5 1 2 It's Parent is ID_GRUP=1
6 4 1 It's Parent is ID_GRUP=4
7 2 2 It's parent is ID_GRUP=2
8 2 3 It's parent is ID_GRUP=2So looking at the top data my final tree structure should look like
1
2
4
6
7
8
5
3and so on. ORDER_BY show the order in which each element should display in the heirarchy. I am really struggling to find a way on how to have the heirarchy built and really need some help.
Thanks
Here is the SQL i have to het the data
SELECT ID_GRUP, ID_GRUP_PARENT, DESCRP FROM GRUP ORDER BY ORDER_BY.First of all, you can't make a (single) tree out of that, because apparently you have two roots.
Anyway, one you fix the requirements, you can do this by defining a tree node type (of course), a reference to the root node, and then a temporary data structure to let you go directly to identified nodes without having to traverse the tree from the root (and thus having to know all the paths to the descendant elements). For example, in Java, a good temp data structure might be a java.util.Map<Integer, YourTreeNode>, where you'll use ID_GRUP values for the keys. -
JAXB: Creating Java content tree from scratch - examples?
I'm trying to create XML output by building the content tree from scratch (using a the DDI schema which is fairly complex). I don't have any existing XML instances. Sample application 3 in Sun's JAXB tutorial doesn't give enough info about how to relate the nodes to create the heirarchy. I can create the root node and set it's attributes OK, but then the practical info runs out.
Can anyone point me at some good practical examples? (i.e. not those of the "How to play the quitar: Put your fingers on the frets and move your other hand around" genre).
Thanks in advance.I don't have examples, but the main thing to remember is that you should use the ObjectFactory to create all of the objects in your tree. That's important.
You must use the element object class for the root node, but you can use type object classes for all the data contained (you can use element object classes for all the nodes, if that's easier).
Use the accessor methods to load the data into the objects you create.
One tip that almost everyone runs into - JAXB only provides a getter for lists - use the getter to get the list, then use .add() methods to add the objects to that list.
Maybe you are looking for
-
ITunes sync issues with Windows 7 64k Bit
I am beyond frustrated! I have attempted for the past 3 days straight to figure out why iTunes keeps having syncing issues with all my devices- Nano 8GB, Touch 8GB, iPhone 3G 8GB. When I first connected the devices for the first time iTunes froze up
-
hi All, We have sent some 2000 Idocs from ECC, my scenario is FILE to FILE. I am collecting all the idocs into a file using IDOC XML port.. File havnt reached XI.. even not created in application server ... all idoc are stuck in ECC side.. when i g
-
Hello Expert, I want to know the functionality of Cashflow used in SAP B1. I am aware of this concept. Regards, Sandy
-
How to handle SYSTEM_NO_MEMORY exception
Hello, is there a way to handle the SYSTM_NO_MEMORY exception in a Z-Program? I want to show the user an error message with hints how to prevent this short dump instead of having the system showing the short dump. I tried to use TRY-statement but unt
-
Soa_server1 is RUNNING and immediate its going to FORCE_SHUTTING_DOWN
Hi i have servers in my system when i started weblogic is starting and it is in RUNNING mode and when i try to start SOA server it is starting and RUNNING and with in seconds its going to shutting down automatically.My system name is changed at first