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: 

folder symbol when handling node_double_click

Former Member
0 Kudos

Hi,

I am using the class cl_gui_alv_tree to display tree structure.

I am getting folder symbols in the tree structure ,I have to remove these.

how to do???.

Another thing is I have to handle the event node_double_click.

it is triggered if I double click on folder symbol only.

if I remove the folder symbol how to handle this...

please very very very urjent

Srilakshmi.

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello

I doubt that you can leave out the node icons. Check the ADD_NODE(S) method or the structure for defining the node layout for fields NODE_IMAGE and NODE_EXPANDED_IMAGE.

If you want to react on double-clicking on items register event ITEM_DOUBLE_CLICK.

Regards,

Uwe

0 Kudos

Thank u very much,

can u also explain me how to capture the whole row.

i.e if I double click on image it is going now but I want to do this when i click any where on the row

Thanks & Regards,

Srilakshmi.

0 Kudos

Hello Srilakshmi

When you double-click in an ALV tree you always get the node key as input for the event handler methods. Therefore, I use a simple trick to retrieve the entire row from the node key:


" Assumption: ALV tree is used to display customers stored in table KNB1.

" Note: define additional fields to your outtab itab for the node key (and parent node key)
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1   AS customer.
TYPES: node_key       TYPE tm_nodekey.  " not sure if this is the correct type -> replace if necessary
TYPES: parent_key     TYPE tm_nodekey.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab   TYPE STANDARD TABLE OF ty_s_outtab 
                                 WITH DEFAULT KEY.

DATA:
  gt_outtab    TYPE ty_t_outtab.   " itab for ALV tree data


...
" Fill the ALV tree
DATA:
  ld_node_Key TYPE tm_nodekey,
  ld_parent_key TYPE tm_Nodekey,
*
  lt_knb1      TYPE STANDARD TABLE OF knb1,
  ls_knb1     TYPE knb1,
  ls_outtab   TYPE ty_s_outtab.

  LOOP AT lt_knb1 INTO ls_knb1.
    CLEAR: ls_outtab.
  
    ls_outtab-customer = ls_knb1.

    CALL METHOD go_tree->add_node
      EXPORTING
        ...
        relatkey = ld_parent_key
      IMPORTING
        node_key = ld_node_key.

    ls_outtab-node_key = ld_node_key.  " returned from ADD_NODE method
    ls_outtab-parent_key = ld_parent_key.
    
    MODIFY gt_outtab FROM ls_outtab
      TRANSPORTING node_key   parent_key
    WHERE ( bukrs = ls_knb1-bukrs  
    AND         kunnr = ls_Knb1-kunnr ).
  ENDLOOP.


" Retrieve entire row in event handler method by node key
  METHOD handle_node_double_click.
  " define local data
    DATA:
      ls_knb1     TYPE knb1,
      ls_outtab   TYPE ty_s_outtab.

      READ TABLE gt_outtab INTO ls_outtab
                WITH KEY node_key = node_key.
      IF ( syst-subrc = 0 ).
        ls_Knb1 = ls_outtab-customer.
      ENDIF.
...
  ENDMETHOD.

Regards,

Uwe