Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create input text of the node in AVL tree

Former Member
0 Kudos

Hi experts,

I create a simple AVL tree to display the sales order items, just two classes for one relationship. Like the left part on the screen in this program "DEMO_ABAP_OBJECTS_CONTROLS".

I want to let the node of the second class be maintained serial no., somthing like input field behind the node or double click the node, then show up the input field on another space on the same screen.

And there is a button on screen, I can do some check for the text of input field when pressing the button. If the input data is wrong , then show up the error message.

I have searched BCALV* in SE38, but i don't see anything helpful.

Plz give me some advice, thanks a lot!!

Regards,

Claire

11 REPLIES 11

christine_evans
Active Contributor
0 Kudos

Have you looked at all the programs with names starting with BCALV_TREE?

Former Member
0 Kudos

To Christine,

I just looked the program starting with 'BCALV_TREE' again, but I don't find anything related to input field that I want to create.

Could you plz tell me in which one there is something useful to me?

The following programs:

BCALV_TREE_01

BCALV_TREE_02

BCALV_TREE_03

BCALV_TREE_04

BCALV_TREE_05

BCALV_TREE_06

BCALV_TREE_DEMO

BCALV_TREE_DND

BCALV_TREE_ENABLE_AUTH_CHECK

BCALV_TREE_EVENT_RECEIVER

BCALV_TREE_EVENT_RECEIVER01

BCALV_TREE_SIMPLE_DEMO

BCALV_TREE_VERIFY

Regards,

Claire

0 Kudos

Hi Claire,

Please check....

call method g_alv_tree->add_node
     exporting
           i_relat_node_key = p_relat_key
           i_relationship   = cl_gui_column_tree=>relat_last_child
           i_node_text      = p_node_text
           is_node_layout    = l_layout_node
        importing
           e_new_node_key = p_new_key.

Here if u see the I_NODE_TEXT.... pass any text that you want to display as the text for that particular node....

Regards,

Kunjal

uwe_schieferstein
Active Contributor
0 Kudos

Hello Claire

You may have a look at thread

Perhaps you find it useful for your purposes.

Regards

Uwe

Former Member
0 Kudos

To Kunjal and Uwe,

My AVL tree is declared like this:

Data: tree TYPE REF TO cl_gui_simple_tree.

The class is not "cl_gui_alv_tree" , so I can not use the code.

The code I create the node is the follwing:

CALL METHOD tree->add_nodes
         EXPORTING table_structure_name = 'ABDEMONODE'
                   node_table = node_table.

And I looked the program that Uwe wrote, the tree is declared in class cl_gui_alv_tree, too.

I want to double click the node and appear a field that can be inputed text.

Is there any other way to do this with the class cl_gui_simple_tree?

Thanks for the advence help.

Claire

0 Kudos

Hi Claire,

From what you have written, I was able to understand that you want to edit the Node_Text....

1. If that is the case then, I am afraid as we cannot make the ALV_TREE editable...

2. Class you are using cl_gui_simple_tree, that class is having a purpose of creating the tree structure by using simple methods.... In short, they are user friendly as we have to use a few method to create the TREE.... If you go in the constructor, you will be able to see that this class has the same base class of of CL_GUI_ALV_TREE.... Also, if the check the code inside the method that you have used to create the TREE, that method will be using the same methods that is provided by me or in Uwe's example..

Hence, I would suggest you to use the CL_GUI_ALV_TREE for creating the tree. This will simplify all your task that is related to ALV Tree and help you during future enhancement, if require.

Uwe, let us know if you have a different opinion....

Regards,

Kunjal

Former Member
0 Kudos

Hi Kunjal,

Thank you for the explanation, I can catch on what you mean.

I am trying to rewrite the code, but I find there is something I am not sure.

The text of the input field that I want to create on the screen is inputted by user's action on the screen, not assigned in the program.

There are two levels in my tree, I want to create the editable fields for the node in the second level.

When double-clicking the node, then disappears a editable field, not the node_text(each node has its text ).

And I can input any string in the field on screen, every node in the second level has its own input field that I can input different string.

Or there is just one edit text in another container on the same screen, when double-clicking the node A, the edit text will be input something by user,

and double-click another node B, the edit text is blank, and go back to double-clicking the node A, the text is still there.

For every node, the edit text is particular and can be always changed.

Sorry about my bad description...

So, can I use the tree declared in class "cl_gui_alv_tree" ?

Thanks anyway! Your help is very useful to me.

Regard,

Claire

0 Kudos

Hey Claire,

I can get wht you mean. Now here's the answer of your question.

1. ALV Tree does not support editing of data directly.

2. To achieve this you can probably handle the node_click or double_click event..

In the implementation of the method, you can explicitly call a FM that asks the user to enter the node text...(FM Search POPUP_* in SE37).

Get the text entered by the user and edit the required row in the table. When you control is going back to the display.. simple re-create the Tree...

I think this will solve your problem.

Regards,

Kunjal

Former Member
0 Kudos

Hi Kunjal,

I understand the solution you suggest, but if there are lots of nodes in my tree,

and the user has to key in the text in the pop-up dialog,

then press the button to return to the tree one by one for each node.

It's not friendly to users, the action repeats a lot of time.

In "VL02N", when packing the delivery items, there is a tree that each node has its input field.

The tree doesn't like GUI AVL TREE, it seems like list output or using ABAP OO.

Do you know that how it works?

I have looked the List of Object Services and Generic Object Services in SAP help, and I can't figure out.

Regards,

Claire

Former Member
0 Kudos

Hi Kunjal,

I just found the answer in the thread:

In the report Ztree_TEST_PGM, it shows that how to create the list tree, and it is just like the packing in VL02N.

Now I am trying to find the solution to create input field in the list tree.

Thanks a lot for your help anyway!

Regards,

Claire

Former Member
0 Kudos

Thanks a lot!

It's useful to me for the understanding about AVL tree.