layout:treeview Closed tree structure?
HI,
I'm able to generate the tree view structure
but the problem is, when close & open the window , it is showing open tree structure
i want it to be close tree view
<layout:treeview expandedLevelsAtFirst="-1" >
<logic:present name="agrovoc" >
<logic:iterate id="agrovoc" name="agrovoc" scope="session">
<c:set var="term" value="${agrovoc.AGTerm}" />
<c:set var="bterm" value="${agrovoc.AGBTerm}" />
<c:set var="nterm" value="${agrovoc.AGNTerm}" />
<c:set var="rterm" value="${agrovoc.AGRTerm}" />
<layout:menuItem key="${agrovoc.AGURI}" link="#" >
<logic:notEmpty name="bterm">
<layout:menuItem key="BroaderTerms">
<layout:menuItem key="${agrovoc.AGBURI}" link="#"/>
</layout:menuItem>
</logic:notEmpty>
<logic:notEmpty name="nterm">
<layout:menuItem key="NarrowerTerms">
<layout:menuItem key="${agrovoc.AGNURI}" link="#" />
</layout:menuItem>
</logic:notEmpty>
<logic:notEmpty name="rterm">
<layout:menuItem key="RelatedTerms">
<layout:menuItem key="${agrovoc.AGRURI}" link="#" />
</layout:menuItem>
</logic:notEmpty>
</layout:menuItem>
</logic:iterate>
</logic:present>
</layout:treeview>I'm using the above code, the tree structure in turn call the java script for tits operations
i even cleared the session object also, but no use..
how to solve this..?
Thanks a lot for the help so far, I've created a method to check the basePanel for any components it holds and try to create a JTree display from it. The code I currently have is :
public void updateObjectSelector()
// Setup the tree viewer
DefaultMutableTreeNode root = new DefaultMutableTreeNode(basePanel.getClass());
addChildren(root, basePanel);
tree = new JTree(root);
public void addChildren(DefaultMutableTreeNode root, JPanel parent)
Component [] children = parent.getComponents();
for(int i = 0; i < children.length; i++)
DefaultMutableTreeNode child = new DefaultMutableTreeNode(children.getClass());
try
addChildren(child, (JPanel) children[i]);
catch(ClassCastException e)
root.add(child);
basePanel and tree are both global variables. basePanel is the root Panel to which everything is added to.
I am calling "updateObjectSelector()" every time a component is added to the basePanel but at the moment all I can get displayed by the JTree is the getClass() of the basePanel, none of its children are being displayed. Can anyone see what I have done wrong here?
Many thanks again for all your help so far.
Similar Messages
-
Struts layout:treeview taglibs...
Hi Friends,
I'm developing small search engine with struts framework
from the database I'm getting the words(terms.search results), now i want display those terms in Tree structure like
+ Rain (root word)
+Broader terms
Precipitation
+Narrower Terms
Artificial precipitation
+Related Terms
Runoff water
Lodging
right now I'm using <logic:iterate> tags for display
how to implement these with <layout:treeview> tags, i added jar file & tld file to the project folder
can anyone tell me how to build sample treeview ( dynamic from database depending on search) so that i can implement that on my application.....
Thank u... :)hi,
Can you please send me the example on how to use tree view from struts-layout
Thanks
crr -
How to create a PortalSite map in a tree structure
Hi,
We are trying to reuse SAP Portal EP 7.3 standard functionalities related to create a Portal Site Map.
I've seen the procedure to create a Workset map iview (http://help.sap.com/saphelp_nw73/helpdata/en/49/32a7a9e8c45aaae10000000a42189d/frameset.htm), but we are interested in generate this map contained in a tree structure, because currently the SAP EP 7.1 brings the menu and option format.
I would like to know if this is possible using the standard functionalities or it is required to develop any application?
Please if you could help me it would be really useful.
Thanks in advance,Thanks for your help Srinivas,
I was trying to know if it was possible to assign a style or layout to the site map iview created using the standard map iview delivered by SAP EP 7.3. I was looking for documentation but it is not enough at all and in my project we are still working with SAP EP 7.0
Please, if anyone could know about the map site iview standard and the available styles or maybe it is not changeable.
In that case, the only way it would be a development to get the tree structure.
Thanks!!!! -
I'm having trouble '''Finding''' the forum where I can look for the information I need. I keep ending up in '''endless menus of non-helpful information. '''
I got a popup message, I needed to upgrade to 3.6.17. After allowing it and rebooting, I couldn't start FF anymore, just got a crash report. I tried going to the restore point I had set with no luck and I tried creating a new profile. I lost all my bookmarks (only the Cache remained). And I sat in live chat for an hour waiting for help. German live chat had one helper and English live chat was closed.
So I gave up on help, uninstalled FF 3.6.17 and downloaded FF 3.6.15 and installed it. It loads but all bookmarks are gone. More importantly, now when I load the bookmarks, I can't '''retrieve''' them except by storing a new one. '''Only''' when I create a new bookmark can I see the folders I've created. I can't get to the organizer so I can't use the bookmarks to retrieve websites.
I'm disturbed that I can't get to the tree-structure forum where I can get the help I need. This "lead me around" labyrinth from one question to another, without being able to look through the forum for the information I need, is not helpful.
Thank you.
FoxhuntI believe you just are able to delete them from iTunes.
Hope it will be helpful -
Bookmark tree structure using Microsoft word 2007 not creating properly
I have a word document file in MS office 2007. When i am converting the word document to a PDF file using the HEADING option , the bookmarks tree structure in the PDF file is not created properly. Means that the between content of a topic is also read
as a bookmark heading while conversion. Only the heading of a topic should be read as a bookmark and the sub heading as a sub-bookmark but the content should not come in the tree structure of bookmarks in a PDF file..
For Example:- if MICROSOFT is the heading of any xyz.doc then it should be the parent bookmark. . but in my case , MICROSOFT is coming as a bookmark but the content inside this is also created as a bookmark..
So my question is that what is the internal structure of the of the MS word 2007 to convert a doc to a PDF file???
Because it is not creating the bookmarks tree structure properly...and taking the content randomly from the middle of a topic and adding it in the bookmark tree structure...(which should not happen). The font throughout the doc is the same and aligned properly..so
why it is randomly taking the between text as a bookmark...???
what is the root cause of this bug..?? how can this problem be solved..?? is there any sort of change have to be done in my word doc.?
i need an urgent help regarding this...
NOTE:- I am using MS office 2007.I tried this but didnt work for mr. Can you help? How did you PDFed??
It works for me in Word 2010 (or later) using Save As PDF. It did not work in Word 2007 using the Adobe Acrobat PDF printer nor using Word 2007's save as pdf utility. (The hyperlink showed up but was not active.) It did work using the Acrobat tab in Word
2007 (this requires Adobe Acrobat).
I did this by:
first creating the text box with the hyperlink in the body of the document and moving it into the footer area (but still not in the footer itself).
Then I used the Format tab of Text Box Tools and the Postion button (More Layout Options).
I gave it an absolute vertical position relative to the page.
Then I cut the text box, went into the footer, and pasted it there.
It might have worked to just create the text box in the footer itself.
I personally prefer it that the header and footer are not part of the active page when I am typing. This hyperlink is not clickable in Word without going into the header/footer view and I'm fine with that. The QAT workaround is just fine.
Charles Kenyon Madison, WI -
Hi Friends,
How to Create a tree structure for org. unit in web dynpro ABAP
and call the tree in F4 Help of a input box.Good advice there guys.
I myself just finished such an implementation at one of my customers. It took 2 days to complete. I can't give you the solution as the customer retains the immaterial rights for the solution but I thought I would tell you the steps involved to get you on the right track.
1. Context. Build a context node that on the top level has the orgunit, it's attributes (such as otype, objid, stext, etc) and the recursive node that points to the orgunit node. Inside the orgunit create a node for the position. Inside the node place the attributes for the position (like before) and a recursive node that points to the position node. Finally inside the position node place a node for the person and it's attributes (like before), but no recursion node this time.
2. Layout: Place a tree element in your view. Inside the tree element insert two node types and one item type. First node is for orgunit, second one is for position. The only item is for the person. You might want to add respective icons, to get nicer UI. Add the load children action for orgunit and position. Depending on what you want to select from the tree, add a select action for either orgunit, position or person.
3. Code #1: as Chris points out, use RH_STRUC_GET to get the organization tree. I myself used O_S_P. You might want to create a FM that returns all 3 itabs returned by RH_STRUC_GET to the WDA. Create a freely programmed value help as suggested in many threads, it's pretty straight forward. In the WDA utilizing the VH, mark one or more items in the context as freely programmed VH and connect to your implementation.
4. Code #2: At start up, for example in the WDDOINIT method, create only the root node and call it for example "All organization units". Then create one action that is called when children nodes have to be loaded, one method for figuring out what do when a child is being requested (and what kind of child: orgunit, position or person) and finally a method for actually creating the node.
5. Code #3: The magic comes from RH_STRUC_GET. Use the STRUC itab at runtime to find the objects at certain levels and to determine their parent(s) and children. The most important values in the STRUC itab in this case are LEVEL, OTYPE, OBJID and PUP.
Pretty straight forward and the solution is quite nice indeed. I'm sorry if I forgot something, I wrote this without access to the system. -
How to create tree structure in abap
hi,
I am mohan. Please send the how to create the tree structure. how to insert the child nodes in root node. actually our requirement is we have list transaction codes. We are planning to put all transaction codes in tree level.
please tell me how to do the program in tree structure.Hi Mohan,
Check the following program on ALV tree.
REPORT zalvtree.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: go_grid TYPE REF TO cl_gui_alv_grid.
DATA: ro_grid TYPE REF TO cl_gui_alv_grid.
DATA tree1 TYPE REF TO cl_gui_alv_tree.
DATA mr_toolbar TYPE REF TO cl_gui_toolbar.
DATA : gt_checked TYPE lvc_t_chit,
gs_checked LIKE LINE OF gt_checked,
l_part_key TYPE lvc_nkey,
gt_node TYPE lvc_s_chit-nodekey.
INCLUDE <icon>.
INCLUDE zamit_alv_tree_toolbar_event.
INCLUDE zbcalv_tree_event_receiver.
*DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
DATA: gt_sflight TYPE sflight OCCURS 0, "Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, "Fieldcatalog
ok_code LIKE sy-ucomm. "OK-Code
START-OF-SELECTION.
END-OF-SELECTION.
CALL SCREEN 100.
*& Module PBO OUTPUT
process before output
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF tree1 IS INITIAL.
PERFORM init_tree.
else.
CALL METHOD me->refresh_table_display
EXCEPTIONS
PROGRAM_ERROR = 1
others = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
process after input
MODULE pai INPUT.
CASE ok_code.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM exit_program.
*mrk
WHEN 'MOVE'.
PERFORM check_selection.
WHEN 'MBAK'.
PERFORM another_selection.
WHEN 'ALL'.
PERFORM select_all.
WHEN 'CLEAR'.
PERFORM clear_all.
WHEN 'DELETE'.
PERFORM delete_all.
WHEN 'EXPAND'.
PERFORM expand_all.
WHEN 'COLLAPSE'.
PERFORM collapse_all.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
CLEAR ok_code.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PAI INPUT
*& Form build_fieldcatalog
build fieldcatalog for structure sflight
FORM build_fieldcatalog.
get fieldcatalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = gt_fieldcatalog.
change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
ls_fieldcatalog-do_sum = 'X'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
ENDFORM. " build_fieldcatalog
*& Form build_hierarchy_header
build hierarchy-header-information
-->P_L_HIERARCHY_HEADER strucxture for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form exit_program
free object and leave program
FORM exit_program.
CALL METHOD tree1->free.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form check_selection
text
--> p1 text
<-- p2 text
FORM check_selection .
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container2 TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE2'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container2
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
CREATE OBJECT go_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = l_custom_container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM load_data_into_grid.
*data: lt_nodes type LVC_T_NKEY,
ls_nodes like line of lt_nodes,
ls_checked like line of gt_checked.
*loop at gt_checked into ls_checked.
ls_nodes = ls_checked-nodekey.
append ls_nodes to lt_nodes.
*endloop.
*CALL METHOD tree1->unselect_nodes
EXPORTING
it_node_key = lt_nodes
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
DP_ERROR = 2
MULTIPLE_NODE_SELECTION_ONLY = 3
ERROR_IN_NODE_KEY_TABLE = 4
FAILED = 5
others = 6
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
ENDFORM. " check_selection
*& Form another_selection
text
--> p1 text
<-- p2 text
FORM another_selection .
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container2 TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE2'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container2
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
CREATE OBJECT ro_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = l_custom_container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM load_data_into_grid1.
DATA: lt_unsel TYPE lvc_t_nkey,
ls_unsel LIKE LINE OF lt_unsel.
LOOP AT gt_checked INTO gs_checked.
ls_unsel = gs_checked-nodekey.
APPEND ls_unsel TO lt_unsel.
ENDLOOP.
CALL METHOD tree1->unselect_nodes
EXPORTING
it_node_key = lt_unsel
EXCEPTIONS
cntl_system_error = 1
dp_error = 2
multiple_node_selection_only = 3
error_in_node_key_table = 4
failed = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*CALL METHOD tree1->unselect_all
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
FAILED = 2
others = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
DATA: text TYPE lvc_value,
item TYPE lvc_t_layi,
node TYPE lvc_s_layn,
inode TYPE lvc_nkey.
FIELD-SYMBOLS: <wa> TYPE ANY.
DATA: l_dref_wa LIKE LINE OF gt_sflight.
ASSIGN l_dref_wa TO <wa>.
READ TABLE gt_checked INTO gs_checked WITH KEY nodekey = 3.
inode = gs_checked-nodekey.
CALL METHOD tree1->get_outtab_line
EXPORTING
i_node_key = inode
IMPORTING
e_outtab_line = <wa>
e_node_text = text
et_item_layout = item
es_node_layout = node
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: lt_layout TYPE lvc_t_laci,
layout LIKE LINE OF lt_layout.
layout-chosen = 'X'.
layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-chosen = 'X'. "To give default checkbox value checked
layout-class = cl_gui_column_tree=>item_class_checkbox.
layout-editable = 'X'.
LAYOUT-U_CHOSEN = 'X'.
APPEND layout TO lt_layout.
CALL METHOD tree1->change_node
EXPORTING
i_node_key = inode
i_outtab_line = <wa>
IS_NODE_LAYOUT =
it_item_layout = lt_layout
I_NODE_TEXT =
I_U_NODE_TEXT =
EXCEPTIONS
node_not_found = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*CALL METHOD tree1->change_item
EXPORTING
i_node_key = inode
i_fieldname = gs_checked-FIELDNAME
i_data = <wa>
I_U_DATA = ''
IS_ITEM_LAYOUT = layout
EXCEPTIONS
NODE_NOT_FOUND = 1
others = 2
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*loop at lt_unsel into ls_unsel.
*CALL METHOD tree1->update_checked_items
EXPORTING
i_node_key = ls_unsel
i_fieldname = ''
i_checked = ''
EXCEPTIONS
PROGRAM_ERROR = 1
others = 2
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*endif.
ENDFORM. " another_selection
*& Form select_all
text
--> p1 text
<-- p2 text
FORM select_all .
CONSTANTS: c_x(1) TYPE c VALUE 'X'.
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear l_part_key.
create hierarchy
PERFORM create_hierarchy USING c_x.
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
add own functioncodes to the toolbar
perform change_toolbar.
register events
perform register_events.
adjust column_width
call method tree1->COLUMN_OPTIMIZE.
ENDFORM. " select_all
*& Form clear_all
text
--> p1 text
<-- p2 text
FORM clear_all .
CONSTANTS: c_x(1) TYPE c VALUE space.
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
create hierarchy
PERFORM create_hierarchy USING c_x.
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " clear_all
*& Form delete_all
text
--> p1 text
<-- p2 text
FORM delete_all .
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " delete_all
*& Form expand_all
text
--> p1 text
<-- p2 text
FORM expand_all .
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " expand_all
*& Form collapse_all
text
--> p1 text
<-- p2 text
FORM collapse_all .
CALL METHOD tree1->collapse_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " collapse_all
*& Form load_data_into_grid
text
--> p1 text
<-- p2 text
FORM load_data_into_grid .
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant,
gs_layout TYPE lvc_s_layo.
DATA gi_sflight TYPE TABLE OF zsflight.
Load data into the grid and display them
l_layout-report = sy-repid.
gs_layout-grid_title = 'Amits Test Program'.
gs_layout-sel_mode = 'A'.
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
is_variant = l_layout
i_save = 'A'
CHANGING
it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
*& Form load_data_into_grid
text
--> p1 text
<-- p2 text
FORM load_data_into_grid1.
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant,
gs_layout TYPE lvc_s_layo.
DATA gi_sflight TYPE TABLE OF zapempl.
Load data into the grid and display them
l_layout-report = sy-repid.
gs_layout-grid_title = 'Rams Test Program'.
gs_layout-sel_mode = 'A'.
SELECT *
FROM zapempl
INTO TABLE gi_sflight.
CALL METHOD ro_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZAPEMPL'
is_layout = gs_layout
is_variant = l_layout
i_save = 'A'
CHANGING
it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid1
*& Form build_header
build table for html_header
--> p1 text
<-- p2 text
FORM build_comment USING
pt_list_commentary TYPE slis_t_listheader
p_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader.
LIST HEADING LINE: TYPE H
CLEAR ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree-demo: flight-overview'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
STATUS LINE: TYPE S
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
ACTION LINE: TYPE A
CLEAR ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "build_comment
*& Form create_hierarchy
text
--> p1 text
<-- p2 text
FORM create_hierarchy USING p_x.
DATA: ls_sflight TYPE sflight,
lt_sflight TYPE sflight OCCURS 0.
get data
SELECT * FROM sflight INTO TABLE lt_sflight
UP TO 200 ROWS .
SORT lt_sflight BY carrid connid fldate.
add data to tree
DATA: l_carrid_key TYPE lvc_nkey,
l_connid_key TYPE lvc_nkey,
l_last_key TYPE lvc_nkey.
l_part_key TYPE lvc_nkey
PERFORM add_carrid_line USING ls_sflight
CHANGING l_part_key.
gt_node = l_part_key.
LOOP AT lt_sflight INTO ls_sflight.
ON CHANGE OF ls_sflight-carrid.
PERFORM add_carrid_line USING ls_sflight
l_part_key
CHANGING l_carrid_key.
PERFORM add_connid_line USING ls_sflight
l_carrid_key
CHANGING l_connid_key.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
CONTINUE.
ENDON.
ON CHANGE OF ls_sflight-connid.
PERFORM add_connid_line USING ls_sflight
l_carrid_key
CHANGING l_connid_key.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
CONTINUE.
ENDON.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
ENDLOOP.
calculate totals
CALL METHOD tree1->update_calculations.
this method must be called to send the data to the frontend
CALL METHOD tree1->frontend_update.
ENDFORM. " create_hierarchy
*& Form add_carrid_line
add hierarchy-level 1 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_carrid_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_sflight TYPE sflight.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_item_layout TO lt_item_layout.
add node
l_node_text = ps_sflight-carrid.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_carrid_line
*& Form add_connid_line
add hierarchy-level 2 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_connid_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_sflight TYPE sflight.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
APPEND ls_item_layout TO lt_item_layout.
add node
l_node_text = ps_sflight-connid.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_connid_line
*& Form add_cmplete_line
add hierarchy-level 3 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_complete_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
p_x
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-chosen = p_x. "To give default checkbox value checked
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
l_node_text = ps_sflight-fldate.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ps_sflight
i_node_text = l_node_text
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_complete_line
*& Form register_events
text
--> p1 text
<-- p2 text
FORM register_events.
define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
APPEND l_event TO lt_events.
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
set Handler
DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_ctmenu_request
FOR tree1.
SET HANDLER l_event_receiver->handle_node_ctmenu_selected
FOR tree1.
SET HANDLER l_event_receiver->handle_item_ctmenu_request
FOR tree1.
SET HANDLER l_event_receiver->handle_item_ctmenu_selected
FOR tree1.
SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
ENDFORM. " register_events
*& Form change_toolbar
text
--> p1 text
<-- p2 text
FORM change_toolbar.
DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
get toolbar control
CALL METHOD tree1->get_toolbar_object
IMPORTING
er_toolbar = mr_toolbar.
CHECK NOT mr_toolbar IS INITIAL.
add seperator to toolbar
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = ''
icon = ''
butn_type = cntb_btype_sep
text = ''
quickinfo = 'This is a Seperator'. "#EC NOTEXT
add Standard Button to toolbar (for Delete Subtree)
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = 'DELETE'
icon = '@18@'
butn_type = cntb_btype_button
text = ''
quickinfo = 'Delete subtree'. "#EC NOTEXT
add Dropdown Button to toolbar (for Insert Line)
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = 'INSERT_LC'
icon = '@17@'
butn_type = cntb_btype_dropdown
text = ''
quickinfo = 'Insert Line'. "#EC NOTEXT
set event-handler for toolbar-control
CREATE OBJECT toolbar_event_receiver.
SET HANDLER toolbar_event_receiver->on_function_selected
FOR mr_toolbar.
SET HANDLER toolbar_event_receiver->on_toolbar_dropdown
FOR mr_toolbar.
ENDFORM. " change_toolbar
*& Form init_tree
text
--> p1 text
<-- p2 text
FORM init_tree.
create fieldcatalog for structure sflight
PERFORM build_fieldcatalog.
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
create tree control
CREATE OBJECT tree1
EXPORTING
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple "node_sel_mode_single
item_selection = 'X'
no_html_header = ''
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
create Hierarchy-header
DATA l_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
create info-table for html-header
DATA: lt_list_commentary TYPE slis_t_listheader,
l_logo TYPE sdydo_value.
PERFORM build_comment USING
lt_list_commentary
l_logo.
repid for saving variants
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
create emty tree-control
CALL METHOD tree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_outtab = gt_sflight "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
CONSTANTS: c_s(1) TYPE c VALUE space.
create hierarchy
PERFORM create_hierarchy USING c_s.
add own functioncodes to the toolbar
PERFORM change_toolbar.
register events
PERFORM register_events.
adjust column_width
call method tree1->COLUMN_OPTIMIZE.
ENDFORM. " init_tree
Award points if found useful.
Regards
Indrajit -
Multiple tree structured rows in output header
Hi All,
I have a requirement to create an output layout in which there are 3 dynamic rows in header and each row is having its own sub devision (like a tree structure). The number of columns will depend upon the data.
I am able to create N number of dynamic columns according to data fetched at run time but dont know how to create multiple tree structures rows in header.
Can any one please suggest how can I achieve this in SAP?
Regards,
NilanjanaHi All,
I have a requirement to create an output layout in which there are 3 dynamic rows in header and each row is having its own sub devision (like a tree structure). The number of columns will depend upon the data.
I am able to create N number of dynamic columns according to data fetched at run time but dont know how to create multiple tree structures rows in header.
Can any one please suggest how can I achieve this in SAP?
Regards,
Nilanjana -
Hi guys
Not used Java in a while (or done much programming in a while to be honest) and i've been set the task of reading an XML document into a tree structure but without using any existing XML libraries. I'm a little bit stumped which line to go down and wondered if anyone had could help me out with a few suggestions as to how to tackle it.
Many thanksredbulladdict wrote:
yeah i have read the article and i get that i need to read in the first tag as the root and then add the next tag as a node and then its data as a node,Once you write the code to read a node, you just apply it recursively to these other nodes.
then once that tag has closed, back track and the next tag as a node and so on.To back track you should just have to return from your recursive method. Returning from the method implicitly pops a stack thus returning you to the enclosing tag.
But having real trouble making a start on the source code, can't find any good examples to get me started. My coding skills are really rusty.Can you write a simple "Hello world" program? Can you open a file, and read in one line at a time, and count the lines?
Thanks for giving me all this help. -
Tree structure format in report.
Hi all,
I have got a report to develop where in i have to display the ouptut of the report
in a tree structure.Can anybody tell me how to proceed with this ?? This is
basically an interactive report where clicking on one of the node will take us to
another page.
Thanks and Regards.
syed.HI
Refer this code.
REPORT YMS_ALVTREEDEMO .
*Data Declaration
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_ekpo TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_emptytab TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko,
wa_ekpo TYPE t_ekko.
DATA: ok_code like sy-ucomm, "OK-Code
save_ok like sy-ucomm.
*ALV data declarations
DATA: fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE.
DATA: gd_fieldcat TYPE lvc_t_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv.
*ALVtree data declarations
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: gd_tree TYPE REF TO cl_gui_alv_tree,
gd_hierarchy_header TYPE treev_hhdr,
gd_report_title TYPE slis_t_listheader,
gd_logo TYPE sdydo_value,
gd_variant TYPE disvariant.
*Create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
*Includes
*INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
*INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
*INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
*Start-of-selection.
START-OF-SELECTION.
ALVtree setup data
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.
PERFORM build_report_title USING gd_report_title gd_logo.
PERFORM build_variant.
Display ALVtree report
call screen 100.
*& Form DATA_RETRIEVAL
Retrieve data into Internal tables
FORM data_retrieval.
SELECT ebeln
UP TO 10 ROWS
FROM ekko
INTO corresponding fields of TABLE it_ekko.
loop at it_ekko into wa_ekko.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
FROM ekpo
appending TABLE it_ekpo
where ebeln eq wa_ekko-ebeln.
endloop.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
Please not there are a number of differences between the structure of
ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
For example the field seltext_m is replace by scrtext_m in ALVtree.
fieldcatalog-fieldname = 'EBELN'. "Field name in itab
fieldcatalog-scrtext_m = 'Purchase Order'. "Column text
fieldcatalog-col_pos = 0. "Column position
fieldcatalog-outputlen = 15. "Column width
fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)
fieldcatalog-key = 'X'. "Key Field? (X or SPACE)
fieldcatalog-do_sum = 'X'. "Sum Column?
fieldcatalog-no_zero = 'X'. "Don't display if zero
APPEND fieldcatalog TO gd_fieldcat.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-scrtext_m = 'PO Iten'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-scrtext_m = 'Status'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-scrtext_m = 'Item change date'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-scrtext_m = 'Material Number'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-scrtext_m = 'PO quantity'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-scrtext_m = 'Order Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-scrtext_m = 'Net Price'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 7.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-scrtext_m = 'Price Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form build_hierarchy_header
build hierarchy-header-information
-->P_L_HIERARCHY_HEADER structure for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'(013).
p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form BUILD_REPORT_TITLE
Build table for ALVtree header
<-> p1 Header details
<-> p2 Logo value
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-key "Not Used For This Type(H)
ls_line-info = 'PO ALVTree Display'.
APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
APPEND ls_line TO pt_report_title.
ENDFORM.
*& Form BUILD_VARIANT
Build variant
form build_variant.
Set repid for storing variants
gd_variant-report = sy-repid.
endform. " BUILD_VARIANT
Check these programs.
e.g
BCALV_TREE_01 ALV tree control: build up the hierarchy tree
BCALV_TREE_02 ALV tree control: event handling
BCALV_TREE_03 ALV tree control: use an own context menu
BCALV_TREE_04 ALV tree control: add a button to the toolbar
BCALV_TREE_05 ALV tree control: add a menu to the toolbar
BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree
RSDEMO_DRAG_DROP_TREE_MULTI
BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree
Reward all helpfull answers.
Regards.
Jay -
Hi
I am having Data in one internal table
BEGIN OF ty_box,
vbeln LIKE vbak-vbeln, "Sales Order Document Number
exidv LIKE vekp-exidv, "External Handling Unit Identification
vegr4 LIKE vekp-vegr4, "Integration required if the value is INTR
matnr LIKE lips-matnr, "Delivery Item-Material Number
arktx LIKE lips-arktx, "Delivery Item-Short text for Material
END OF ty_box.
I want to Display output like tree structure
integration required?
() Sales order
() HU -
checkbox
Mat A Description of A
Mat B Description of B
Please give sample program for this type. '-' indicate sapce
Message was edited by:
sudhakara reddy
Message was edited by:
sudhakara reddyhi,
use ALV TREE
check these links.
http://www.erpgenie.com/sap/abap/SalesOrderFlow.htm
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm
Check these programs.
BCALV_TREE_01 ALV tree control: build up the hierarchy tree
BCALV_TREE_02 ALV tree control: event handling
BCALV_TREE_03 ALV tree control: use an own context menu
BCALV_TREE_04 ALV tree control: add a button to the toolbar
BCALV_TREE_05 ALV tree control: add a menu to the toolbar
BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree
RSDEMO_DRAG_DROP_TREE_MULTI
BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree
Also please check the transaction DWDM This will give info also on trees.
Check the links -
drag drop required for alv column!
drag and drop in a tree
Drag&Drop within the Tree
Drag&Drop within a tree
Drag and drop in ALV tree -
Tree structured Report programming
Hi,
I have a requirement of a Report which has to have a Tree structure similar to SE09 Transaction. When we give the User id in the SE09 and hit on Display button the next screen lists all the Transport requests under the user in a Tree structure which can be exploded or collapsed.
I want to know how complicated is this to code, is there any Function module that can help acheive this. Also let me if there is a sample program.
Appreciate your help on this.
Thanks and Regards,
Saleem.Hi Saleem,
Check this sample code,
REPORT Z_AZAZ_TEST_TREE_1 .
TYPE-POOLS : FIBS,STREE.
DATA : T_NODE TYPE SNODETEXT.
DATA : NODE_TAB LIKE T_NODE OCCURS 0 WITH HEADER LINE.
CLEAR : NODE_TAB, NODE_TAB[].
NODE_TAB-TYPE = 'T'.
NODE_TAB-NAME = 'Earth'.
NODE_TAB-TLEVEL = '01'.
NODE_TAB-NLENGTH = '5'.
NODE_TAB-COLOR = '4'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 3.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'Europe'.
NODE_TAB-TLEVEL = '02'.
NODE_TAB-NLENGTH = '6'.
NODE_TAB-COLOR = '1'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 4.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'Germany'.
NODE_TAB-TLEVEL = '03'.
NODE_TAB-NLENGTH = '7'.
NODE_TAB-COLOR = '4'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 4.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'Berlin'.
NODE_TAB-TLEVEL = '04'.
NODE_TAB-NLENGTH = '6'.
NODE_TAB-COLOR = '4'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 3.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'Asia'.
NODE_TAB-TLEVEL = '02'.
NODE_TAB-NLENGTH = '4'.
NODE_TAB-COLOR = '1'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 3.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'India'.
NODE_TAB-TLEVEL = '03-'.
NODE_TAB-NLENGTH = '5'.
NODE_TAB-COLOR = '1'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 3.
APPEND NODE_TAB.
CLEAR NODE_TAB.
NODE_TAB-TYPE = 'P'.
NODE_TAB-NAME = 'Bombay'.
NODE_TAB-TLEVEL = '04-'.
NODE_TAB-NLENGTH = '6'.
NODE_TAB-COLOR = '1'.
NODE_TAB-TEXT = 'Hello'.
NODE_TAB-TLENGTH ='5'.
NODE_TAB-TCOLOR = 3.
APPEND NODE_TAB.
CLEAR NODE_TAB.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
EXPORTING
INSERT_ID = '000000'
RELATIONSHIP = ' '
LOG =
TABLES
NODETAB = NODE_TAB
EXCEPTIONS
TREE_FAILURE = 1
ID_NOT_FOUND = 2
WRONG_RELATIONSHIP = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: TYPE_MAPPING TYPE STREE_CTL_TYPE_MAPPING_TAB.
DATA: WA_TYPE TYPE STREE_CTL_TYPE_MAPPING.
CLEAR: TYPE_MAPPING[].
WA_TYPE-TYPE = 'A'.
WA_TYPE-ICON = '@BL@'.
APPEND WA_TYPE TO TYPE_MAPPING.
*CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'
EXPORTING
CONTROL_PATTERN = STREE_CTL_GENERIC
CONTROL_PATTERN = 'PH'
HIERARCHY_HEADER =
INITIAL_HEADER_WIDTH =
LIST_ITEM_HEADER =
MULTIPLE_SELECTION = 'X'
ITEM_SELECTION = STREE_FALSE
SUPPRESS_NODE_ICON = STREE_FALSE
SUPPRESS_FOLDER_ICON = STREE_FALSE
CALLBACK_PROGRAM =
CALLBACK_ITEM_DISPLAY =
COLOR_MAPPING =
TYPE_MAPPING = type_mapping
IMPORTING
SUBSCREEN_PROGRAM =
SUBSCREEN_DYNNR =
EXCEPTIONS
NOT_AVAILABLE = 1
OTHERS = 2
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*CALL FUNCTION 'RS_TREE_SET_CURRENT_LAYOUT'
EXPORTING
CURSOR_COLUMN = 3
CURSOR_LINE = 2
FIRST_NODE = 1
FIRST_NODE_TYPE = ' '
LIST_COLUMN = 1
LIST_LINE = 1
LAYOUT_MODE = STREE_LAYOUT_NORMAL
IMPORTING
INCONSISTENT_LAYOUT =
TABLES
LAYOUT =
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
CALLBACK_PROGRAM =
CALLBACK_USER_COMMAND =
CALLBACK_TEXT_DISPLAY =
CALLBACK_MOREINFO_DISPLAY =
CALLBACK_COLOR_DISPLAY =
CALLBACK_TOP_OF_PAGE =
CALLBACK_GUI_STATUS =
CALLBACK_CONTEXT_MENU =
STATUS = 'IMPLICIT'
CHECK_DUPLICATE_NAME = '1'
COLOR_OF_NODE = '4'
COLOR_OF_MARK = '3'
COLOR_OF_LINK = '1'
COLOR_OF_MATCH = '5'
LOWER_CASE_SENSITIVE = ' '
MODIFICATION_LOG = ' '
NODE_LENGTH = 30
TEXT_LENGTH = 75
TEXT_LENGTH1 = 0
TEXT_LENGTH2 = 0
RETURN_MARKED_SUBTREE = ' '
SCREEN_START_COLUMN = 0
SCREEN_START_LINE = 0
SCREEN_END_COLUMN = 0
SCREEN_END_LINE = 0
SUPPRESS_NODE_OUTPUT = ' '
LAYOUT_MODE = ' '
USE_CONTROL = STREE_USE_LIST
USE_CONTROL = 'L'.
IMPORTING
F15 =
Regards,
Azaz Ali. -
Forum ?Unusual tree Structure
hi admins,
today i noticed something unusual in forum tree structure,
https://forums.oracle.com/forums/main.jspa?categoryID=84
Especially Business Intelligence,Private,Enterprise Management,Server & Storage Systems,Java,Fusion Middleware tree.
if expanded or collapsed nothing different . is this like so?
thank&®ards
adf7.ADF7 wrote:
did anyone noticed?Of course many of us have noticed.
The site administrators are constantly rearranging things so that the forums reflect the reality of Oracle's product line.
This is not a new event, but is an on-going process.
As products appear and as products retire, the forum layout will change. -
How to create a tree structure using forms.
Hi,
How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
thanks in advance
Regards
KarthikThe FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
" in the online help this point to all the functions and triggers -
How to show alv report in tree structure
hi all,
how to show data or create a alv report in tree structure.
thanks in advance.
HarshaHi Harsha,
Its done using FM 'RS_TREE_CONSTRUCT'
and FM for displaying the tree: 'RS_TREE_LIST_DISPLAY'
Thanks
Shrila
Maybe you are looking for
-
I just bought a new MSI kt3 ultra-aru from newegg and a new athlon xp 1900+(1.6ghz) and i unlocked it but the board wont boot with the new multiplier, so i thought the proc was not unlock so i try my old tbird which has already been unlocked and it d
-
I am creating a game where the challange is to collect all the coins while avoiding obsticules and before the times runs out. What I am trying to do is when the game runs out of time or the player has died, The player simply presses the R key on thei
-
C: drive small, using E: instead..
Hi, recently purchased a HP envy 810 desktop I'm a novice within this aspect, apologies for the stupid question! Via past laptops, desktops etc i've always been used to having all programmes located and installed automatically within C:\Program Files
-
Can IPod Video be used to store data?
as topic
-
I can't open Bridge and Mini Bridge from Photoshop CS6 (64bit)
I can't open Bridge CS6 64(Bit) and Mini Bridge from Photoshop CS6 (64bit), I get an error message (APPCRASH ). I can open only Bridge (32bit) as a stand alone program. Operating system Windows 7 (64bit).