Tree-Control in ABAP redifinieren
Hi there,
I would like to use my tree as navigation-menue. In this case, the alphabetical order of the entries is not used. I would like to specify the direction by myself. Is there any possibility to change or redefinate the abap class cl_wd_tree and how should I implement the changes into my application.
Kind regards,
Albert
Message was edited by: Albert Neumueller
Message was edited by: Albert Neumueller
Hi Albert,
Redefining the class won't make a difference, since there won't be a renderer for your new class - including a number of other required settings/objects/interfaces.
Well, nonetheless there is a way to achieve what you want. You could use a ContextualNavigationPanel and there inside a NavigationList.
Best regards,
Thomas
Similar Messages
-
Hi,
I need a sample programe on Alv Tree controle using opps
Regards,
Madhu.This method does not need a seperate screen but a selection screen is must.
Data:
dock_container type ref to cl_gui_docking_container,
tree1 type ref to cl_gui_alv_tree_simple.
*A docking container does not explicitly need a screen for it.It can be
*placed on the selection screen itself.Here we are using the screen
*which is used for the alvgrid.
*First create a docking container with dock at left
if dock_container is initial.
create object dock_container
exporting
* PARENT =
repid = g_repid
dynnr = g_dynnr
side = dock_container->dock_at_left
extension = 300
* STYLE =
* LIFETIME = lifetime_default
* CAPTION = 'jkhbnjkhk'
* METRIC = 4
* RATIO = 80
* NO_AUTODEF_PROGID_DYNNR =
name = 'dockkkkkk'
* EXCEPTIONS
* CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* others = 6
endif.
*Secondly create the field cat for the alv to be disp in dock container
call function 'LVC_FIELDCATALOG_MERGE'
exporting
* I_BUFFER_ACTIVE =
i_structure_name = 'ZC9_STRUCT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
changing
ct_fieldcat = i_fcat[]
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
if tree1 is initial.
*Thirdly create the tree1 object for the ALV with parent as docking
*container
create object tree1
exporting
* I_LIFETIME =
i_parent = dock_container
* I_SHELLSTYLE =
* I_NODE_SELECTION_MODE =
*cl_gui_column_Tree=>NODE_SEL_MODE_SINGLE
* I_HIDE_SELECTION =
* I_ITEM_SELECTION = 'X'
* I_NO_TOOLBAR =
i_no_html_header = ''
* I_PRINT =
* 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
* others = 8
*Finally create a tree with the below method. (Sort table need to be *passed)
call method tree1->set_table_for_first_display
exporting
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* I_CONSISTENCY_CHECK =
i_structure_name = 'ZC9_STRUCT'
it_list_commentary = pt_list_commentary
i_logo = l_logo
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = gs_layout_tree
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
changing
it_outtab = itab[]
* it_fieldcatalog = i_fcat1[]
it_sort = gt_sort_grid[] -
Program to add node / delete node in the tree control via abap object
Hi all,
i am new to abap objects.
Can anyone help me out to give program about add node , delete node at
a particular point in tree hierarchy.
folder1 -- level 1
subfolder1 -- level 2
*********subfolder1 -- level 3
*********subfolder2 -- level 3
subfolder2 -- level 2
folder2 -- level 1
if i select level3 and click on ADD button .....i get a facility to add new node
at level 3 and and same thing can happen at level1 and level2 ............ if i select
and folder at level3 and click on delete button ....it should delete that folder...
if you do not have such program ........then guide me how to achieve this target via object oriented because i have to split the screen also and have to show some alve display in that.
just guide me how to add and delete node at a particular level in tree structure....
thanks in advance........Hello Ravi,
Try this demo program:
<b>BCALV_TREE_01</b>
<b>BCALV_TREE_DEMO</b>
BCALV_TREE_SIMPLE_DEMO
Also try:
BCALV_TREE_02
BCALV_TREE_03
BCALV_TREE_04
BCALV_TREE_05
BCALV_TREE_06
regards,
Beejal
**reward if this helps -
Hello
Is it possible to have a Tree Control in the OVS so that it appears against input fields(columns) in a table? any insight will be helpful
Regards
PranHi Pran,
Due to the nature of the OVS, that's unfortunately not possible. Nonetheless, there is a solution to your problem. Web Dynpro ABAP offers the possibility to define a custom value help by implementing IWD_VALUE_HELP component in a component. This will give you full control over how your value help should look like.
Best regards,
Thomas -
Control Framework tree control event not trigerring
The event handle_node_double_click is not trigerring on the tree controls . I want to display the contents of the nodes on the text editor on trigerring of this event
*& Report ZCONTROLS_TREE_TEDIT_SPITTER
REPORT zcontrols_tree_tedit_spitter.
DATA : editor TYPE REF TO cl_gui_textedit,
tree TYPE REF TO cl_gui_simple_tree.
DATA : container TYPE REF TO cl_gui_custom_container,
splitter TYPE REF TO cl_gui_easy_splitter_container,
right TYPE REF TO cl_gui_container,
left TYPE REF TO cl_gui_container.
DATA : node_itab LIKE node_str OCCURS 0.
CLASS EVENT_HANDLER DEFINITION
CLASS event_handler DEFINITION.
PUBLIC SECTION.
METHODS : handle_node_double_click
FOR EVENT NODE_DOUBLE_CLICK OF cl_gui_simple_tree
IMPORTING node_key.
ENDCLASS. "EVENT_HANDLER DEFINITION
CLASS EVENT_HANDLER IMPLEMENTATION
CLASS event_handler IMPLEMENTATION.
METHOD handle_node_double_click.
perform node_double_click using node_key.
ENDMETHOD. "HANDLE_NODE_DOUBLE_CLICK
ENDCLASS. "EVENT_HANDLER IMPLEMENTATION
data : handler1 type ref to event_handler.
START-OF-SELECTION.
CALL SCREEN 9001.
*& Module start OUTPUT
text
MODULE start OUTPUT.
SET PF-STATUS 'ZSTAT1'.
IF container IS INITIAL.
CREATE OBJECT container
EXPORTING
container_name = 'CONTAINER_NAME'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 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.
CREATE OBJECT splitter
EXPORTING
parent = container
orientation = 1
name = 'Mohit'
EXCEPTIONS
cntl_error = 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.
left = splitter->top_left_container.
right = splitter->bottom_right_container.
CREATE OBJECT editor
EXPORTING
parent = right
name = 'MohitEditor'
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 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.
CREATE OBJECT tree
EXPORTING
parent = left
node_selection_mode = tree->node_sel_mode_single
name = 'MohitTree'
EXCEPTIONS
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 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.
PERFORM fill_tree.
CALL METHOD tree->add_nodes
EXPORTING
table_structure_name = 'NODE_STR'
node_table = node_itab
EXCEPTIONS
error_in_node_table = 1
failed = 2
dp_error = 3
table_structure_name_not_found = 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.
create object handler1.
set handler handler1->handle_node_double_click for tree.
ENDIF.
ENDMODULE. " start OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE user_command_9001 INPUT.
CALL METHOD cl_gui_cfw=>dispatch.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Form fill_tree
text
--> p1 text
<-- p2 text
FORM fill_tree .
DATA : node LIKE node_str.
CLEAR node.
node-node_key = 'head_mohit'.
node-isfolder = 'X'.
node-text = 'Mohit'.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child1'.
node-relatkey = 'head_mohit'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'Mohit is the best '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child2'.
node-relatkey = 'head_mohit'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'Mohit is the bestest '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'head_JAIN'.
node-isfolder = 'X'.
node-text = 'jAIN'.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child3'.
node-relatkey = 'head_JAIN'.
node-relatship = cl_gui_simple_tree=>relat_next_sibling.
node-text = 'cnh INDIA '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child4'.
node-relatkey = 'head_JAIN'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'SAP '.
APPEND node TO node_itab.
ENDFORM. " fill_tree
*& Form node_double_click
text
-->P_NODE_KEY text
form node_double_click using p_node_key type TV_NODEKEY.
DATA : node LIKE node_str.
DATA textline(256).
DATA text_table LIKE STANDARD TABLE OF textline.
READ TABLE node_itab WITH KEY node_key = p_node_key
INTO node.
endform. " node_double_click
*& Module exit INPUT
text
module exit input.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " exit INPUTHello Mohit
Here is a sample routine (taken from BCALV_TREE_02) which you have to add and adapt for your report. It does two things:
1. Register events that should be handled (required but not sufficient for event handling)
2. Set event handler for registered events
The first step is different from ALV grid controls because here all events are already registered with the control (not the control framework).
Set the event handler (statement SET HANDLER) registers the event handling with the control framework.
FORM register_events.
*§4. Event registration: tell ALV Tree which events shall be passed
* from frontend to backend.
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event,
l_event_receiver TYPE REF TO lcl_tree_event_receiver.
*§4a. Frontend registration(i): get already registered tree events.
* The following four tree events registers ALV Tree in the constructor
* method itself.
* - cl_gui_column_tree=>eventid_expand_no_children
* (needed to load data to frontend when a user expands a node)
* - cl_gui_column_tree=>eventid_header_context_men_req
* (needed for header context menu)
* - cl_gui_column_tree=>eventid_header_click
* (allows selection of columns (only when item selection activated))
* - cl_gui_column_tree=>eventid_item_keypress
* (needed for F1-Help (only when item selection activated))
* Nevertheless you have to provide their IDs again if you register
* additional events with SET_REGISTERED_EVENTS (see below).
* To do so, call first method GET_REGISTERED_EVENTS (this way,
* all already registered events remain registered, even your own):
call method g_alv_tree->get_registered_events
importing events = lt_events.
* (If you do not these events will be deregistered!!!).
* You do not have to register events of the toolbar again.
*§4b. Frontend registration(ii): add additional event ids
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND l_event TO lt_events.
*§4c. Frontend registration(iii):provide new event table to alv tree
CALL METHOD g_alv_tree->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.
*§4d. Register events on backend (ABAP Objects event handling)
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_double_click FOR g_alv_tree.
ENDFORM. " register_events
Regards
Uwe -
Tree control with Nodes in ALV
Hi ABAP Gurus,
I am trying to create tree control with nodes in ALV. I have referred to standard BCALV_TREE* programs but new to OO programming. Not sure as to how I can display my internal table data than the SFLIGHT information in these programs. Can you please let me know how this can be done or if I can use any ALV function modules for the node display.
thanks,
ChaitanyaMaybe you could use this. Call this VI from a Value Change event of the tree.
Attachments:
Check_Tree_Items.vi 28 KB -
Single click on tree control navigation
Hello I have a tree control where I have include the navigation, I know that there is a method
HANDLE_NODE_DOUBLE_CLICK FOR G_TREE
but is there an method for only one click, I want to change my alv grid data when I click on several nodes in my tree controlHello Muhammet
I have re-written my sample report ZUS_SDN_TWO_ALV_GRIDS into ZUS_SDN_TREE_AND_GRID_CONTROL which is now display a tree control together with the ALV grid.
When you analyze this new report you will see that every step of the program logic is as I described in my previous e-mails.
*& Report ZUS_SDN_TWO_ALV_GRIDS
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
*& Thread: single click on tree control navigation
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1143770"></a>
REPORT zus_sdn_tree_and_grid_control.
TYPE-POOLS: abap, cntl.
TYPES: node_table_type LIKE STANDARD TABLE OF mtreesnode
WITH DEFAULT KEY.
* CAUTION: MTREESNODE is the name of the node structure which must
* be defined by the programmer. DO NOT USE MTREESNODE!
CONSTANTS:
BEGIN OF c_nodekey,
root TYPE tv_nodekey VALUE 'Root', "#EC NOTEXT
child1 TYPE tv_nodekey VALUE 'Child1', "#EC NOTEXT
* child2 type tv_nodekey value 'Child2', "#EC NOTEXT
new1 TYPE tv_nodekey VALUE 'New1', "#EC NOTEXT
new2 TYPE tv_nodekey VALUE 'New2', "#EC NOTEXT
* new3 type tv_nodekey value 'New3', "#EC NOTEXT
* new4 type tv_nodekey value 'New4', "#EC NOTEXT
END OF c_nodekey.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_tree TYPE REF TO cl_gui_simple_tree,
go_grid1 TYPE REF TO cl_gui_alv_grid,
** go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
** CALL METHOD go_grid1->set_current_cell_via_id
** EXPORTING
*** IS_ROW_ID =
*** IS_COLUMN_ID =
** is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
* CLASS LCL_APPLICATION DEFINITION
CLASS lcl_application DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_event TYPE string READ-ONLY,
md_node_key TYPE tv_nodekey READ-ONLY.
CLASS-METHODS:
handle_node_double_click
FOR EVENT node_double_click
OF cl_gui_simple_tree
IMPORTING node_key,
handle_expand_no_children
FOR EVENT expand_no_children
OF cl_gui_simple_tree
IMPORTING node_key.
ENDCLASS. "LCL_APPLICATION DEFINITION
* CLASS LCL_APPLICATION IMPLEMENTATION
CLASS lcl_application IMPLEMENTATION.
METHOD handle_node_double_click.
" this method handles the node double click event of the tree
" control instance
" show the key of the double clicked node in a dynpro field
md_event = 'NODE_DOUBLE_CLICK'.
md_node_key = node_key.
" Trigger PAI and set ok-code = 'DETAIL'
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DETAIL'
* IMPORTING
* rc =
MESSAGE md_node_key TYPE 'I'.
ENDMETHOD. "HANDLE_NODE_DOUBLE_CLICK
METHOD handle_expand_no_children.
" this method handles the expand no children event of the tree
" control instance
DATA: node_table TYPE node_table_type,
node TYPE mtreesnode.
" show the key of the double clicked node in a dynpro field
md_event = 'EXPAND_NO_CHILDREN'.
md_node_key = node_key.
IF node_key = 'Child1'.
* add two nodes to the tree control (the children of 'Child1')
* Node with key 'New1'
CLEAR node.
node-node_key = c_nodekey-new1.
node-relatkey = c_nodekey-child1.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-isfolder = ' '.
node-text = 'New1'(ne1).
APPEND node TO node_table.
* Node with key 'New2'
CLEAR node.
node-node_key = c_nodekey-new2.
node-relatkey = c_nodekey-child1.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-n_image = '@10@'.
node-expander = ' '.
node-text = 'New2'(ne2).
APPEND node TO node_table.
CALL METHOD go_tree->add_nodes
EXPORTING
table_structure_name = 'MTREESNODE'
node_table = node_table
EXCEPTIONS
failed = 1
error_in_node_table = 2
dp_error = 3
table_structure_name_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
** MESSAGE A000.
ENDIF.
ENDIF.
ENDMETHOD. "HANDLE_EXPAND_NO_CHILDREN
ENDCLASS. "LCL_APPLICATION IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1 UP TO 100 ROWS
WHERE bukrs = '1000'.
PERFORM init_controls.
* Display data
gs_layout-grid_title = 'Customers: Sales Areas'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv
EXCEPTIONS
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.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid1->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
MESSAGE gd_okcode TYPE 'I'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
IF ( gt_knvv IS INITIAL ).
SELECT * FROM knvv INTO TABLE gt_knvv
FOR ALL ENTRIES IN gt_knb1
WHERE kunnr = gt_knb1-kunnr.
ELSE.
REFRESH: gt_knvv.
ENDIF.
ENDFORM. " ENTRY_SHOW_DETAILS
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
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.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 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.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
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.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
PERFORM create_and_init_tree.
ENDFORM. " INIT_CONTROLS
*& Form CREATE_AND_INIT_TREE
* text
* --> p1 text
* <-- p2 text
FORM create_and_init_tree .
DATA: lt_node_table TYPE node_table_type,
lt_events TYPE cntl_simple_events,
ls_event TYPE cntl_simple_event.
* create a tree control
CREATE OBJECT go_tree
EXPORTING
parent = go_cell_left
node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single " single node selection is used
EXCEPTIONS
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 5.
IF sy-subrc <> 0.
** MESSAGE a000.
ENDIF.
* define the events which will be passed to the backend
" node double click
ls_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
** ls_event-appl_event = 'X'. " process PAI if event occurs
" NOTE: Do NOT register as application event !!!!!
APPEND ls_event TO lt_events.
CALL METHOD go_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
** MESSAGE a000.
ENDIF.
SET HANDLER:
lcl_application=>handle_node_double_click FOR go_tree,
lcl_application=>handle_expand_no_children FOR go_tree.
* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.
PERFORM build_node_table USING lt_node_table.
* node_table_structure_name = 'MTREESNODE'
* A programmer using the tree control must create a structure in the
* dictionary. This structure must include the structure TREEV_NODE
* and must contain a character field with the name 'TEXT'.
CALL METHOD go_tree->add_nodes
EXPORTING
table_structure_name = 'MTREESNODE'
node_table = lt_node_table
EXCEPTIONS
failed = 1
error_in_node_table = 2
dp_error = 3
table_structure_name_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
** MESSAGE a000.
ENDIF.
ENDFORM. " CREATE_AND_INIT_TREE
*& Form build_node_table
* text
* --> p1 text
* <-- p2 text
FORM build_node_table
USING
node_table TYPE node_table_type.
DATA: node LIKE mtreesnode.
* Build the node table.
* Caution: The nodes are inserted into the tree according to the order
* in which they occur in the table. In consequence, a node must not
* occur in the node table before its parent node.
* Node with key 'Root'
node-node_key = c_nodekey-root.
" Key of the node
CLEAR node-relatkey. " Special case: A root node has no parent
CLEAR node-relatship. " node.
node-hidden = ' '. " The node is visible,
node-disabled = ' '. " selectable,
node-isfolder = 'X'. " a folder.
CLEAR node-n_image. " Folder-/ Leaf-Symbol in state "closed":
" use default.
CLEAR node-exp_image. " Folder-/ Leaf-Symbol in state "open":
" use default
CLEAR node-expander. " see below.
node-text = 'Root'(roo).
APPEND node TO node_table.
* Node with key 'Child1'
node-node_key = c_nodekey-child1.
" Key of the node
" Node is inserted as child of the node with key 'Root'.
node-relatkey = c_nodekey-root.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-hidden = ' '.
node-disabled = ' '.
node-isfolder = 'X'.
CLEAR node-n_image.
CLEAR node-exp_image.
node-expander = 'X'. " The node is marked with a '+', although
" it has no children. When the user clicks on the
" + to open the node, the event
" expand_no_children is fired. The programmer can
" add the children of the
" node within the event handler of the
" expand_no_children event
" (see method handle_expand_no_children
" of class lcl_application)
node-text = 'Child1'(ch1).
node-style = cl_gui_simple_tree=>style_emphasized_positive.
APPEND node TO node_table.
ENDFORM. " build_node_table
Regards
Uwe -
Tree Control - Performace - ITS 620
Hi,
Am using a tree control in our web application created using
class - CL_GUI_LIST_TREE with checkbox items.
When a user checks the item , it went to hourglass for 2 to 3 mins.
Can you please let me know, is there any fine tuning is required
at code level or is there any parameter setting at ITS Level.
We are in ITS 620 and R3 4.7.
Thanks in advance,
Srini SHi Srini,
I saw that you have asked this question in the ABAP forum too and got an answer there. Is your problem already solved?
Regards,
Henning -
SAP GUI hangs up - tree control
Hi,
I have written an ABAP program to display a report in tree format. This tree(designed using SAPGUI tree control) has close to 75K nodes. When I exit from this application(report), the SAPGUI hangs up. It takes about 25-30 minutes to exit this report program.
Further analysis tells me that it is only the front end process and NOT the runtime of the program. I am using Windows.
I am not sure how much this forum is relevant to this problem. But, any inputs on the reason for a slow performing GUI is appreciated.
Thanks,
HemaThere are some known performance issues with older patchlevels, since you neither mention, what GUI version you use and which patchlevel I would just recommend updating to 7.20 and the latest patchlevel and try again.
If that doesn't help the only thing left is to decrease the amount of data being sent to the frontend.
Markus -
Splitter Control & tree Control
Hello,
1- Have some body a simple Program for splitter control so that i can split my windows to 2 screens?
2- On the left screen I need a Tree Control. The Name of the Nodes should be allready given. I mean the Node's Name will be changed.
Thank youHi,
Please go through SDN thoroughly.
You will easily get a lot of answers of your problems.
Please visit these links:
http://wiki.sdn.sap.com/wiki/display/Snippets/SplittercontrolandGraphsin+ABAP
OO Splitter Control program with ALV Grid and ALV Tree on same screen
May it helps you.
Regards.
DS. -
How can I display and change built-in symbols of a tree control programmatically?
I want to set the built-in symbols of a tree control during runtime.
I only found an example to assign custom pictures but not how to select one of the 40 built-in symbol.
Many Thanks
Solved!
Go to Solution.The ActiveItem.SymbolIndex will allow you to select the symbol for the active item. You can use the ListBox Symbol Ring Constant (Dialog and User Interface palette) to select a symbol (or you can just enter the number directly if you know what it is).
Message Edited by smercurio_fc on 07-10-2008 09:36 AM
Attachments:
Example_VI_BD6.png 2 KB -
Not able to get the database data into the Tree Control
Hi Everybody,
I have to populate the tree control with nodes and items, which is to be populated from the database, and the tree control is <b>dynamic</b>. I mean, there is a <b>toolbar</b>, whenever a <b>pushbutton is clicked</b>, depending on that the tree contents has to be changed.
If anybody had worked with <b>CL_GUI_COLUMN_TREE</b> control to get the data from database, depending upon the <b>pushbutton selected in Toolbar</b>, please paste the seudocode for it.
Regards,
Abdul,
Intelligroup.
P.S: Helpful answers will be rewarded.have you seen this demo program
SAPCOLUMN_TREE_CONTROL_DEMO
Regards
Raja -
How to get all items under a parent item in a tree control
Hello,
I have 2 questions regarding a tree control:
1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
Any ideas?
Attachments:
Tree example.vi 6 KBMentos wrote:
1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
Did you try a search? There's no direct way of doing this. You have to navigate the tree and build up an array. You can find an example here: http://forums.ni.com/t5/LabVIEW/get-all-children-of-a-parent-in-tree/td-p/729548
2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
No. (It's called ActiveCell, not ActiveCells) Presumably you are trying to perform an operation on multiple items. Unfortunately, you need to use a loop. You should defer panel updates if you're doing this a lot. -
How to binding incoming xml node list to the tree control as dataProvider
Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
Please see the presudo-code here:
1. Model layer(CsModel.as)
public class CsModel
[Bindable]
public var treeXML:XML=<nodes><car label="virtualOne" id="1">
</car></nodes>;
(Here, I want to build binding relationship on the <car/> node,
one 'virtual/stub' node is set here with lable="virtualOne".
But this node will be deleted after IdTree
control is created completely.)
[Bindable]
public var treeData:XMLList =new XMLListCollection(treeXML.car);
2. view layer(treePage.mxml)
private var _model:CsModel = new CsModel();
private function addNode():void
var newNode:XML=<car/>;
newNode.@label="newOne";
newNode.@id=1;
_model.treeXML.appendChild(newNode);
private function cleanData():void
delete _model.treeXML.car;
<mx:VBox height="100%" width="100%">
<mx:Button label="AddNode" click="addNode()" />
<mx:Tree id="IdTree" labelField="@label"
creationComplete="cleanData()"
dataProvider="{_model}"/>
</mx:VBox>
3. Top view layer (App.Mxml)
<mx:application>
<treePage />
</mx:application>
For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?If u want to display the name : value then u can do like this
<xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" /> -
How can I save the all the values of a tree control ?
I have a problem, in run time, I adds new items on a tree control, but i don´t know how I can save the values of the child text of each item in a file.
Thanks.I'm no expert on the tree control, but I made a small example to save all items to a textfile, including item tag, item string, and indent level. One drawback of this method is that it fully expands the tree regardless how the user left it. To go the other direction, you'd have to write a routine to go through the text file and programmatically build the tree.
To master the tree control, I think you have to resort to creating a control reference for it and using the Invoke Node to do some operations. For another approach to traversing and operating on a tree, check out the "Traversing Tree Controls and Setting Custom Symbols" (search the NI Developer Zone site).
Best of luck,
John
Attachments:
Save Tree Structure to Textfile.vi 32 KB
Maybe you are looking for
-
Implicit and Explicit Enhancement
Hi Gurus , Can anyone please let me know about what is implicit enhancement and explicit enhancement.Steps involved in the same . Thanks ... ashok...
-
Bind XML data to PDF417 barcode - LiveCycle Designer ES
Trying to create a shipping form for a supplier that contains a PDF417 barcode. The source data will come from an XML data file. The form in not interactive, the data file will simply populate the pdf form, read-only via a Coldfusion program that q
-
In FINDER, all applications have .app after it now, why?
HI! Just got a new iMac. Used a firewire to migrate the date from my old eMac. Anyway, now in FINDER, all of my applications have .app after them (iPhoto.app, Dictionary.app, iChat.app, etc). When I click on something in Finder...I have to double cli
-
Iphone keeps asking me for my AppleID password
My iPhone keeps asking me for my AppleID password. This usually happens after I wake the phone and/or start any app. The problem is intermittent (and too consistant that it has become very annoying!) This started happening about 1.5 weeks ago. I ca
-
JAVA-Virtual Memory Machine appears low
Since my update to 10.5.7 neither my Safari or Firefox is able to load large charts into the Java applet. My preferences for java cache is set to max 1000mb, compression set to none. If I reduce the data and size of the chart it will load. I never ha