cancel
Showing results for 
Search instead for 
Did you mean: 

Simple tree view control

Former Member
0 Kudos

Hi,

I am using simple tree view control.

I have two tree view controls on my screen.

I want to drag folder with it;s childs from left to right tree view control. how to do that?

I know that it possible to drag one folder but, i want to drag & drop folder with it's child.

If anyone have any idea or any help please inform me on vrushali_gadgil@rediffmail.com

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Surpreet Singh Bal ,

i have no idea how to open a new thread ,it would be kind enough if u could guide me.

Thanks,

Azee

Former Member
0 Kudos

Hi Patrick Baer,

I thanq for ur quick reply.

i am going through the example SAPSIMPLE_TREE_MODEL_DEMO

could u give me a insight look at this areas

1.y r we passing this method for creating an instance of gtree which is a member for cl_simple_tree_model

create a simple tree model instance

CREATE OBJECT g_tree

EXPORTING

node_selection_mode = cl_simple_tree_model=>node_sel_mode_single

2.wat does this mean

  • create the view (control) of the tree model

CALL METHOD g_tree->create_tree_control

EXPORTING

parent = g_custom_container

EXCEPTIONS

lifetime_error = 1

cntl_system_error = 2

create_error = 3

failed = 4

tree_control_already_created = 5.

IF sy-subrc <> 0.

MESSAGE a001(s).

ENDIF.

3.how are events handeled .

  • define the events which will be passed to the backend

" node double click

event-eventid = cl_simple_tree_model=>eventid_node_double_click.

event-appl_event = 'X'. " process PAI if event occurs

APPEND event TO events.

CALL METHOD g_tree->set_registered_events

EXPORTING

events = events

EXCEPTIONS

illegal_event_combination = 1

unknown_event = 2.

IF sy-subrc <> 0.

MESSAGE a001(s).

ENDIF.

4.for event DOUBLE_CLICK this it uses an attribute which is unique eventid , how can i find eventids for other events

if u have a simple that also takes care of handlig events then plz do post ,

OR

if u have any link this answer my question it ill be of great help for me.

Thanks.

azee.

Former Member
0 Kudos

azee

please open new thread , so that you can award points to people who help you

please do it

regards

Former Member
0 Kudos

I am talking abt simple tree control but not ALV grid conftrol.

Azee

Former Member
0 Kudos

Azee,

consider cl_simple_tree_model instead.

It is a kind of wrapper around the tree control but is quite easy to use.

Initialization (oi_tree is a member variable of type ref to cl_simple_tree_model):

IF oi_tree IS INITIAL.

  CREATE OBJECT oi_tree EXPORTING node_selection_mode = cl_simple_tree_model=>node_sel_mode_single.

  oi_tree->create_tree_control( parent = ol_container_bottom ).

  tl_node_tab = build_node_tab( ).

  oi_tree->add_nodes( node_table = tl_node_tab ).

* Register events and Event-handler:

  sl_tree_event-eventid = cl_simple_tree_model=>eventid_selection_changed.
  sl_tree_event-appl_event = ' '.

  APPEND sl_tree_event TO tl_tree_events.

  oi_tree->set_registered_events( tl_tree_events ).

  SET HANDLER me->on_selection_change FOR oi_tree.

ENDIF.

The method build_node_tab constructs the node table.

I can't go through all the details but the node table has the structure treemsnodt.

The important field of this structure are:

sl_node-node_key = vl_node_key.
sl_node-text = ol_dir_entry_as_dir_folder->get_name( ).
sl_node-relatkey = vp_parent_identifier.
sl_node-relatship = cl_tree_model=>relat_last_child.

node_key specifies a unique identifier for the node, text sets the displayed text, relatkey is the unique identifier of a related node (father for example) and relatship specifies the type of relationship.

In my case (and I think in any other case too) 'relat_last_child' is sufficient to specify any kind of tree, as it specifies the relationship 'this is my father node'.

I hope this helps to give you a start.

Regards,

Patrick Baer

Former Member
0 Kudos

Hi,

I am new to Tree conrols, Could any one supply a step by step procedure to create a tree control.

It would be really appriciated if i could as soon as possible.

Thanks in advance.

Regards,

azeem

athavanraja
Active Contributor
0 Kudos

always open new thread for better response.

check out transaction DWDM, it has got samples.

Regards

Raja

Former Member
0 Kudos

Hi Vrushali,

I see that this is your first post here. Welcome to SDN.

I think there are some example programs available in the SAP system which demonstrate the functionality you are seeking. Please have a look at BCALV_TREE_DND and other similar programs to get an idea of how this is handled.

By the way, is it a requirement that you're working on or are you just practising Tree controls ? Drag and Drop between two trees is an uncommon requirement. You should ideally be haing one tree and one grid for Drag and Drop.

Regards,

Anand Mandalika.

Former Member
Former Member
0 Kudos

Hi,

Refer the standard report program 'BCALV_GRID_DND_TREE', this might help.

Rgds,

Former Member
0 Kudos

I saw all the 'BCALV_GRID_*' prgrams.In that we have single drag drop but not multiple i.e. folder with it;s chld. This is not for paractice purpose. This is requirement in our program.

Former Member
0 Kudos

Vrushali,

without knowing for sure I strongly believe that the desired functionality does not exist in ABAP. Of course you can still achieve this requirement but I am certain that you have to program the functionality on your own.

Trees are a classical recursive data structure so a recursive copy algorithm makes sense and should be quite easy to do.

The root of the subtree to copy is the single folder you can drag drop. Starting from that folder recursively copy the subfolders to the target tree.

All the best,

Patrick