Cl_column_tree_model
I have a problem with expanding nodes on demand.
I created a big tree. Some of the downmost leaves shall be expanded on demand. The problem is, that the event "Expand no children" is triggered for all leaves bearing the 'itemsincom'-Flag regardless how deep they are in the structure below the expanded node. I expected the event to be triggered when the corresponding leaf itself is expanded.
Is there any way to change this behavior?
Regards
Matthias Mevenkamp
Hello Frank,
thank you for your reply. I have no solution for my Problem and i posted a error message to SAP (no. 0000187587 2006)
Regards
Matthias
Similar Messages
-
Hi,
I have building a program that will have one split screen and one of them has cl_column_tree_mode at top, and the other has cl_gui_alv_grid at bottom.
I can Drag And Drop Lines From ALV GRID to TREE and i can use ONDRAG event of ALVGRID, DROP event of TREE Control and ONDROPCOMPLETE event of ALVGRID.
But when i try to reverse it as like that Drag From TREE to ALVGRID, just DRAG event of TREE is triggering.
I have implemented end registered ONDROP event for ALVGRID but it is no triggering.
Have i something which missed ? Some of code at the above.
*****************CODE****************************************
*I created Application Ocject, Custom Container and Spliiter in here
** Definition of drag drop behaviour
create object behaviour_top.
call method behaviour_top->add
exporting
flavor = 'LINEFROM' "I dont know where i can use this
dragsrc = 'X'
droptarget = 'X'
effect = cl_dragdrop=>move.
call method behaviour_top->add
exporting
flavor = 'LINETO' "I dont know where i can use this
dragsrc = 'X'
droptarget = 'X'
effect = cl_dragdrop=>move.
call method behaviour_top->get_handle
importing handle = handle_top. "I am not sure that i can use this handle for both TREE Nodes and ALV Rows, But i am using it for both.
****************************** TREE ********************************
* CREATE TREE
ls_treemhhdr-heading = 'Nakliye ve Makaralar'.
ls_treemhhdr-width = 35.
create object gref_column_tree
exporting
node_selection_mode = cl_column_tree_model=>node_sel_mode_single
item_selection = space
hierarchy_column_name = 'NUMBER'
hierarchy_header = ls_treemhhdr.
call method gref_column_tree->create_tree_control
exporting
parent = container_1 .
* Events for tree control
set handler g_application->handle_tree_drag for gref_column_tree.
set handler g_application->handle_tree_drop for gref_column_tree.
* Build TREE
perform build_tree using gref_column_tree. "I use HANDLE_TOP in this when creating nodes.
****************************** TREE ********************************
**************************** ALV GRID ********************************
* create ALV Grid
create object alv_grid
exporting i_parent = container_2.
* Events alv control
set handler g_application->handle_alv_drag for alv_grid.
set handler g_application->handle_alv_drop for alv_grid.
set handler g_application->handle_alv_drop_complete for alv_grid.
gs_layout-grid_title = 'İs Listesi'.
gs_layout-s_dragdrop-row_ddid = handle_top. "I think this is a important thing
call method alv_grid->set_table_for_first_display
exporting is_layout = gs_layout
changing it_fieldcatalog = gt_fieldcat
it_outtab = i_tabout[].
**************************** ALV GRID ********************************
*I have implemented all methods for this class, it hink its not important to see *which code its has, important is why its not triggering.
class lcl_application definition.
public section.
data: next_node_key type i.
methods:
* ALV EVENTS
handle_alv_drag for event ondrag of cl_gui_alv_grid
importing e_row e_column e_dragdropobj,
handle_alv_drop for event ondrop of cl_gui_alv_grid
importing e_row e_column es_row_no e_dragdropobj,
handle_alv_drop_complete for event ondropcomplete of cl_gui_alv_grid
importing e_row e_column e_dragdropobj,
* TREE EVENTS
handle_tree_drag for event drag of cl_column_tree_model
importing node_key item_name drag_drop_object,
handle_tree_drop for event drop of cl_column_tree_model
importing node_key drag_drop_object,
handle_tree_drop_complete for event drop_complete of cl_column_tree_model
importing node_key ITEM_NAME drag_drop_object.
endclass.Thanks kaipha,
in examples in SE83 i have noticed that i have to create an inctance for drag drop object when drag starts.
method handle_tree_drag.
data: "local_node_table type node_table_type,
new_node type mtreesnode,
dataobj type ref to lcl_dragdropobj_from_tree,
l_keytxt(30) type c.
catch system-exceptions move_cast_error = 1.
* create and fill dataobject for events ONDROP and ONDROPCOMPLETE
create object dataobj. "When i create dataobj in here
move node_key to dataobj->node_key.
drag_drop_object->object = dataobj. "And when i call this method, ALV Drop event has begin triggered
endcatch.
if sy-subrc <> 0.
call method drag_drop_object->abort.
endif.
endmethod. -
Cl_column_tree_model editable textitem possible?
The item_set_editable method of cl_column_tree_model seems to allow setting 'X' to editable property of items only to checkboxes, but I want to edit text inline in the table or even the node text itself.
Is can I achive this behavior somehow in ABAP without switching completely to an other tree class and changing a lot of my code? maybe by overwriting the editing methods or so?
My only idea is to show a popup to the user allowning him to alter text and set the text back to the tree item after popup is closed, but thats an ugly workaround. Is there any ellegant solution for this?No solution, no one?
-
How to make field editable in ALV tree in OOPs?
Hi Gems,
Again I need help from you all.
I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
I am doing it using layout but the program is giving error during
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
This method is returning sy-subrc = 2 and I am unable to get the output.
I am using below code to make the field editable:
DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'. "ACPCKTWRT is the field name in the Internal table
LS_LAYOUT_ITEM-EDITABLE = 'X'.
APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = FP_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = LS_TMP_FINFCNO "structure of the internal table
IS_NODE_LAYOUT =
IT_ITEM_LAYOUT = LT_LAYOUT_ITEM "Added layout to make the field editable
I_NODE_TEXT = LV_NODE_TEXT "Node text
IMPORTING
E_NEW_NODE_KEY = FP_NODE_KEY
EXCEPTIONS
RELAT_NODE_NOT_FOUND = 1
NODE_NOT_FOUND = 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.
Please help me and let me know how to get the solution.Hello
The ALV tree control is not intended for making values editable (e.g. see
[How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
Regards
Uwe -
Hi,
I have building a program that will have one split screen and one of them has cl_column_tree_mode at top, and the other has cl_gui_alv_grid at bottom.
I can Drag And Drop Lines From ALV GRID to TREE and i can use ONDRAG event of ALVGRID, DROP event of TREE Control and ONDROPCOMPLETE event of ALVGRID.
But when i try to reverse it as like that Drag From TREE to ALVGRID, just DRAG event of TREE is triggering.
I have implemented end registered ONDROP event for ALVGRID but it is no triggering.
Have i something which missed ? Some of code at the above.
*****************CODE****************************************
*I created Application Ocject, Custom Container and Spliiter in here
** Definition of drag drop behaviour
create object behaviour_top.
call method behaviour_top->add
exporting
flavor = 'LINEFROM' "I dont know where i can use this
dragsrc = 'X'
droptarget = 'X'
effect = cl_dragdrop=>move.
call method behaviour_top->add
exporting
flavor = 'LINETO' "I dont know where i can use this
dragsrc = 'X'
droptarget = 'X'
effect = cl_dragdrop=>move.
call method behaviour_top->get_handle
importing handle = handle_top. "I am not sure that i can use this handle for both TREE Nodes and ALV Rows, But i am using it for both.
****************************** TREE ********************************
* CREATE TREE
ls_treemhhdr-heading = 'Nakliye ve Makaralar'.
ls_treemhhdr-width = 35.
create object gref_column_tree
exporting
node_selection_mode = cl_column_tree_model=>node_sel_mode_single
item_selection = space
hierarchy_column_name = 'NUMBER'
hierarchy_header = ls_treemhhdr.
call method gref_column_tree->create_tree_control
exporting
parent = container_1 .
* Events for tree control
set handler g_application->handle_tree_drag for gref_column_tree.
set handler g_application->handle_tree_drop for gref_column_tree.
* Build TREE
perform build_tree using gref_column_tree. "I use HANDLE_TOP in this when creating nodes.
****************************** TREE ********************************
**************************** ALV GRID ********************************
* create ALV Grid
create object alv_grid
exporting i_parent = container_2.
* Events alv control
set handler g_application->handle_alv_drag for alv_grid.
set handler g_application->handle_alv_drop for alv_grid.
set handler g_application->handle_alv_drop_complete for alv_grid.
gs_layout-grid_title = 'İs Listesi'.
gs_layout-s_dragdrop-row_ddid = handle_top. "I think this is a important thing
call method alv_grid->set_table_for_first_display
exporting is_layout = gs_layout
changing it_fieldcatalog = gt_fieldcat
it_outtab = i_tabout[].
**************************** ALV GRID ********************************
*I have implemented all methods for this class, it hink its not important to see *which code its has, important is why its not triggering.
class lcl_application definition.
public section.
data: next_node_key type i.
methods:
* ALV EVENTS
handle_alv_drag for event ondrag of cl_gui_alv_grid
importing e_row e_column e_dragdropobj,
handle_alv_drop for event ondrop of cl_gui_alv_grid
importing e_row e_column es_row_no e_dragdropobj,
handle_alv_drop_complete for event ondropcomplete of cl_gui_alv_grid
importing e_row e_column e_dragdropobj,
* TREE EVENTS
handle_tree_drag for event drag of cl_column_tree_model
importing node_key item_name drag_drop_object,
handle_tree_drop for event drop of cl_column_tree_model
importing node_key drag_drop_object,
handle_tree_drop_complete for event drop_complete of cl_column_tree_model
importing node_key ITEM_NAME drag_drop_object.
endclass.Thanks kaipha,
in examples in SE83 i have noticed that i have to create an inctance for drag drop object when drag starts.
method handle_tree_drag.
data: "local_node_table type node_table_type,
new_node type mtreesnode,
dataobj type ref to lcl_dragdropobj_from_tree,
l_keytxt(30) type c.
catch system-exceptions move_cast_error = 1.
* create and fill dataobject for events ONDROP and ONDROPCOMPLETE
create object dataobj. "When i create dataobj in here
move node_key to dataobj->node_key.
drag_drop_object->object = dataobj. "And when i call this method, ALV Drop event has begin triggered
endcatch.
if sy-subrc <> 0.
call method drag_drop_object->abort.
endif.
endmethod. -
Display column_tree in Popup
Hi there,
I just came across a strange problem. I was displaying a column tree on a dynpro. I used the classes cl_column_tree_model for the tree and cl_gui_custom_container as the container class.
I prepare everything I need to display. I call the screen with CALL SCREEN 100. Everything works fine up to now.
I wanted to display the tree on a smaller window so I decided to call the screen with starting and ending coordinates. I started testing with CALL SCREEN 100 STARTING AT 5 5. The dynpro is displayed but the tree control is missing. There is absolutely nothing which is displayed. I don't know wether it's the tree or the container which is missing.
Anybody got a suggestion what might be the problem ?
Thanks in advance,
HannesI just found a solution by myself. No more help needed.
The mistake I made, was NOT to CREATE the OBJECT of the container in the PBO of the dynpro. I think that resulted in seizing problems. Now everything works fine.
Regards,
Hannes -
Editable Column in ALV Column tree model
Hi Experts, I have created ALV tree using the class
CL_COLUMN_TREE_MODEL
,i have created some columns, and now i have to make these columns editable, Please can anyone help me resolving this.samthajain wrote:
Hi Experts, I have created ALV tree using the class
CL_COLUMN_TREE_MODEL
,i have created some columns, and now i have to make these columns editable, Please can anyone help me resolving this.
I doubt this is possible at all. Once I tried different ways of achieving editable tree, but with no luck. You can only have text fields, buttons, checkboxes (editable too) as columns but not editable input fields.
Regards
Marcin -
I get a strange error while opening a reporting agent setting.
When i navigate upto the Multiprovider to go to a particular query in reporting agent setting I recv an error
Which says
Error in a Table parameter in the Tree model.
Class - CL_COLUMN_TREE_MODEL
Methid - ADD_NODES
Table name - NODE_KEY_TABLE
Errors - Node key alreadey exists
Node Key - Q_I_2_2_2__....
Then I get a ABAP Runtime Error:
Runtime Errors MESSAGE_TYPE_UNKNOWN
Date and Time 16.12.2009 19:28:40
Short text
Message type " " is unknown.
What happened?
Error in the ABAP Application Program
The current ABAP program "CL_RSRA_GUI_COMPONENT_TREE====CP" had to be
terminated because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
Only message types A, E, I, W, S, and X are allowed.
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_UNKNOWN" " "
"CL_RSRA_GUI_COMPONENT_TREE====CP" or "CL_RSRA_GUI_COMPONENT_TREE====CM001"
"ADD_OBJECTS"
Please help.hello,
Tell me how are you scheduling the package..? is that on EVENT??
have you craeted an event in SM62 first??
--Nandita -
I'm reading now BC412 cours and I try to understand main difference beetween registering events for SAP enjoy controls using
a) set handler
b) set_registered_events
Do ABAP service this events in other ways (I mean is ABAP service events registered via set hander in different way than registered via set_registered_events)?
When I use ALV grid I use set handler to register events for which (after this event happened) should be performed any action. It is possible to define this events using internal events table?
I reward points for every helpful clues.
Cheers, Tomek
Bonus question: Why for registering events using events table, are using ID's instead events names (like double_click) ?
Message was edited by: Tomasz Suchanek
Message was edited by: Tomasz SuchanekHello Tomasz
The ALV grid control has already most events registered meaning that the corresponding event will be fired if the user executes the appropriate action (e.g. user click on a grid cell with a hotspot -> event HOTSPOT_CLICK is fired).
In order to react on this event your application must have set an event handler for the event (e.g. you have defined a method HANDLE_HOTSPOT_CLICK and registered this event handler at your ALV grid instance:
SET HANDLER lcl_event_handler=>handle_hotspot_click FOR mo_grid. " mo_grid is you ALV grid instance
Other controls (like tree controls) have very few (if at all) events registered. The control will not fire unregistered events, and thus, you are not able to handle these events (even if you have defined an event handler method (and used SET HANDLER... for it)).
In conclusion, registering event is a two-step-process:
(1) register events (that should be fired) at the control
(2) register event handler at the control in order to react on fired events
As said before, step (1) is already done for ALV grid controls.
How to register events at the control depends on the available method. For example, CL_COLUMN_TREE_MODEL provides method SET_REGISTERED_EVENTS having an itab (type CNTL_SIMPLE_EVENTS) for importing the events. The event IDs are defined as constants in the class (or a superclass) like EVENTID_NODE_DOUBLE_CLICK.
Regards
Uwe -
ABAP Objects: Problems with controls in splitter container
Hi community,
I have problems with the second control in a splitter container.
In the left container I build up a <u>list tree</u>.
On double click on a node a <u>column tree</u> in the right container is created.
This is working fine.
But if I double click on another node in the left container the right tree remains unchanged.
What do I have to do to update/refresh the tree in the right splitter container.
Thanks in advance.
Regards
FerdiThanks for your reply Thomas and Serdar,
I now destroy the right container and the right tree control if it exists after the event 'double_click' on a node in the left tree.
The result is now that the container is created (I can see it on screen) but no tree is shown.
If I just destroy the tree control but not the container the tree from the first double click on the left tree is shown.
In the debugger I see that the list tree instance is linked to the caontainer (after first and second creation of tree control)
Maybe you can see in the coding below what's wrong or missing.
Coding after EVENT DOUBLE_CLICK in left Tree: <pre>
destroy old tree instance and container
if not g_container_2 is initial.
call method g_container_2->free.
clear: g_container_2, g_tree_2.
endif.
create right container
call method g_splitter->get_container
exporting row = 1
column = 2
receiving container = g_container_2.
setup the hierarchy header
hierarchy_header-heading = 'Hierarchy Header'.
hierarchy_header-width = 37.
create a column tree model instance
create object g_tree_2
exporting
node_selection_mode = cl_column_tree_model=>node_sel_mode_single
item_selection = 'X'
hierarchy_column_name = 'C1'
hierarchy_header = hierarchy_header.
create tree control
call method g_tree_2->create_tree_control
exporting
parent = g_container_2.
perform add_columns.
perform define_events.
set registered events
call method g_tree_2->set_registered_events
exporting
events = events.
perform get_data.
perform add_nodes_2.
expand the root node
call method g_tree_2->expand_node
exporting
node_key = 'Root'
level_count = 3.
</pre>
Regards
Ferdi
Message was edited by: Ferdi Meyer -
Dear Colleagues !
I have a tree :
class lcl_tree definition inheriting from CL_COLUMN_TREE_MODEL.
data: G_TREE TYPE REF TO lcl_TREE.
CREATE OBJECT G_TREE
EXPORTING
NODE_SELECTION_MODE = CL_COLUMN_TREE_MODEL=>NODE_SEL_MODE_MULTIPLE
It works fine. I want to react to double click of a node:
event-eventid = CL_GUI_COLUMN_TREE=>EVENTID_NODE_DOUBLE_CLICK.
event-appl_event = 'X'.
APPEND event to events.
CALL METHOD G_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
unknown_event = 1
ILLEGAL_EVENT_COMBINATION = 2.
But it doesn't happen anything.
I enhanced it:
CLASS gcl_events_hndl DEFINITION.
PUBLIC SECTION .
METHODS handle_node_double_click
FOR EVENT node_double_click
OF lcl_tree
IMPORTING node_key sender.
ENDCLASS.
DATA: l_event_receiver TYPE REF TO gcl_events_hndl.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_double_click FOR g_tree.
And I have the same, nothing ...
Can You propose me anything ?
Thanks a lot and kind regards
PeterHello Peter
Depending on "object" on which you double-click you either trigger event NODE_DOUBLE_CLICK or ITEM_DOUBLE_CLICK. The NODE_DOUBLE_CLICK event is only triggered if you click on the leftmost part of the node.
Have a look at my sample report ZUS_SDN_ALV_TREE_DEMO_1 in thread
drop down list in alv tree
Depending on where you double-click the raised event is displayed as I-message.
Regards
Uwe -
Class CL_TREE_MODEL
Dear Colleagues !
I'd like to develop a tree in the class CL_TREE_MODEL because it has an own method PRINT_TREE to print the content in a tree form. But how can I fill the tree with nodes and items, which method is responsible for it ?
Thank You for Your helps !
Regards PeterHello Peter
You cannot use class CL_TREE_MODEL for building your tree control because this is just the basic class for a class hierarchy (e.g. it does not have a method ADD_NODE).
Instead, you need to use one of its subclasses, e.g. CL_ITEM_TREE_MODEL -> CL_COLUMN_TREE_MODEL or CL_SIMPLE_TREE_MODEL.
All these subclasses inherit the PRINT_TREE method of CL_TREE_MODEL.
For sample reports of these classes have a look through the programs in package SEU_TREE_MODEL.
Regards
Uwe -
Hi Expert!!
I need you help i am creating column tree with using my local class with reference to cl_gui_column_tree the method add_node is not in this class .As this method is present in cl_column_tree_model class.Please advice which method i can use as similarly add_node in cl_gui_column_tree.
Thanks in advance.
Ankur GargHello Ankur
Sample report SAPCOLUMN_TREE_CONTROL_DEMO shows how to build a tree using class cl_gui_column_tree.
Below you see part of the coding where the tree nodes are created:
* 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_AND_ITEM_TABLE USING NODE_TABLE ITEM_TABLE.
CALL METHOD G_TREE->ADD_NODES_AND_ITEMS
EXPORTING
NODE_TABLE = NODE_TABLE
ITEM_TABLE = ITEM_TABLE
ITEM_TABLE_STRUCTURE_NAME = 'MTREEITM'
EXCEPTIONS
FAILED = 1
CNTL_SYSTEM_ERROR = 3
ERROR_IN_TABLES = 4
DP_ERROR = 5
TABLE_STRUCTURE_NAME_NOT_FOUND = 6.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
* expand the node with key 'Root'
CALL METHOD G_TREE->EXPAND_NODE
EXPORTING
node_key = c_nodekey-Root
EXCEPTIONS
FAILED = 1
ILLEGAL_LEVEL_COUNT = 2
CNTL_SYSTEM_ERROR = 3
NODE_NOT_FOUND = 4
CANNOT_EXPAND_LEAF = 5.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
ENDFORM. " CREATE_AND_INIT_TREE
It seems that this class does not have a method for adding a single node. Thus, use method ADD_NODES_AND_ITEMS with a single entry in the node and item itabs.
Regards
Uwe
Maybe you are looking for
-
Programming a select option in abap webdynpro
Dear Gurus, I have used a select option in a specific webdynpro, but this select option does not enable the same functionalities as select option in SAP GUI. As an example, the possibility to upload a file or the clipboard in the multiple selection f
-
Verizon DSL download speed not as advertised?
Well, I've been a customer of Verizon for over 5+ years now and I've had Verizon DSL for quite some time. I'm not too sure if I have either the 256kbps package or the 768kbps download speed. My DSL modem box model is the Westell 327W. My problem is,
-
Integrating microsoft exchange server into portal
Hi All, can any one suggest me detailed procedure for integrating micorsoft exchange server(MS Outlook) into portal. I searched in the SDN , i got some idea, but it is not giving detailed procedure. please explain in detail so that my Outlook will
-
While we wait... Can anyone help with a flash animation?
So while we wait for our iBrick to start working, can we make a littl animation similar to the MAC/PC commercials. We can have a Nokia Guy and iPhone Guy in the cast. Any script writers out there?? Can you pitch in the script Btw: This is similar to
-
How to avoid printer name prompt while calling Smartform
Hi All, I am calling smartform FM from my program. I am passing following settings in Output-Options and Control-Parameters: wa_outputoptions-tddest = 'LP01'. "Printer name wa_outputoptions-tdnewid = 'X'. "New request wa_controlpara-device = 'PR