Skip to Content
0
Jan 12, 2012 at 08:46 AM

Problems with Toolbar in CL_GUI_ALV_TREE_SIMPLE

135 Views

Hi Experts!!

I am working for a requirement, in which I will have a tree structure (using CL_GUI_ALV_TREE_SIMPLE) at the left and ALV (using CL_SALV_TABLE) at the right. For this, I have created two cust containers. I am done with most of the things, like displaying the tree and when double clicked on any item of the tree, displaying the ALV. However, I still have a few more requirements which I am unable to do. Please fidn them below:

1. New push button in tree:

I have written the below code for this:


    CALL METHOD go_tree->get_toolbar_object
      IMPORTING
        er_toolbar = gr_toolbar.

    CHECK NOT gr_toolbar IS INITIAL. "could happen if you do not use the
    "standard toolbar

* Modify toolbar with methods of CL_GUI_TOOLBAR:
* add seperator to toolbar
    CALL METHOD gr_toolbar->add_button
      EXPORTING
        fcode            = ''
        icon             = ''
        butn_type        = cntb_btype_sep.

* add Button to toolbar (for Display Log)
    CALL METHOD gr_toolbar->add_button
      EXPORTING
        fcode            = 'DISP_LOG'
        icon             = '@DH@'
        butn_type        = cntb_btype_button
        text             = ''
        quickinfo        = 'Display Log'.

    CREATE OBJECT go_toolbar_event_receiver.
    SET HANDLER go_toolbar_event_receiver->handle_function_selected FOR gr_toolbar.

I am getting the button in the toolbar, but it's being shown at the beginning. But I need it at the end. And also, the toolbar is being shown on the horizontal separator which separates toolbar and tree structure. It's a kind of merging (but not actually) with the tree structure.

2. When the cursor is placed on any item and clicked on DISP_LOG, it has to do soem functionality based on the line item on which cursor is placed (single click). I am using event FUNCTION_SELECTED of CL_GUI_TOOLBAR which imports fcode only. Then how can I get the item which is single clicked? I checked the demo program SALV_DEMO_TREE_SETTINGS in which they have provided a checkbox beside each item and then doing some processing. But I do not want to put this checkbox.

Can somebody please help me out with these?

Your help is highly appreciable. Thanks a lot!!