Application Development and Automation 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: 
Read only

TREE CONTROL

Former Member
0 Likes
692

How to use application tool bar in tree contorl .

Please give a example .

1 ACCEPTED SOLUTION
Read only

former_member745780
Active Participant
0 Likes
631

hello

try this


*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&       Class LCL_TOOLBAR_EVENT_RECEIVER
*&---------------------------------------------------------------------*
*        Text
*----------------------------------------------------------------------*
CLASS lcl_toolbar_event_receiver DEFINITION.
  PUBLIC SECTION .
    CLASS-METHODS: catch_function_selected FOR EVENT function_selected OF cl_gui_toolbar
                                  IMPORTING fcode.

ENDCLASS.               "LCL_TOOLBAR_EVENT_RECEIVER

*&---------------------------------------------------------------------*
*&       Class (Implementation)  LCL_TOOLBAR_EVENT_RECEIVER
*&---------------------------------------------------------------------*
*        Text
*----------------------------------------------------------------------*
CLASS lcl_toolbar_event_receiver IMPLEMENTATION.
  METHOD catch_function_selected.
    w_fcode = fcode.

    CASE w_fcode.

      WHEN 'EXPAND'.
        PERFORM expand_nodes.
      WHEN 'COLLAPSE'.
        PERFORM collapse_nodes.
      WHEN 'EXECUTE'.
        PERFORM execute_node_item.
      WHEN 'REFRESH'.
        PERFORM collapse_nodes.
      WHEN 'SCROLL'.
        PERFORM scroll_tree.
    ENDCASE.
  ENDMETHOD.                    "CATCH_FUNCTION_SELECTED

ENDCLASS.               "LCL_TOOLBAR_EVENT_RECEIVER


**also set handler"

*Set handler for events
    SET HANDLER lcl_toolbar_event_receiver=>catch_function_selected FOR toolbar .

Hope this will help you

OR check these sap standard program

ALV Tree Control: Build Up the Hierarchy Tree BCALV_TREE_01

ALV Tree Control: Event Handling BCALV_TREE_02

ALV Tree Control: Use an Own Context Menu BCALV_TREE_03

ALV Tree Control: Add a Button to the Toolbar BCALV_TREE_04

ALV Tree Control: Add a Menu to the Toolbar BCALV_TREE_05

ALV tree control: Icon column and icon for nodes/items BCALV_TREE_06

Thanks

Anirudh Saini

3 REPLIES 3
Read only

former_member745780
Active Participant
0 Likes
632

hello

try this


*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&       Class LCL_TOOLBAR_EVENT_RECEIVER
*&---------------------------------------------------------------------*
*        Text
*----------------------------------------------------------------------*
CLASS lcl_toolbar_event_receiver DEFINITION.
  PUBLIC SECTION .
    CLASS-METHODS: catch_function_selected FOR EVENT function_selected OF cl_gui_toolbar
                                  IMPORTING fcode.

ENDCLASS.               "LCL_TOOLBAR_EVENT_RECEIVER

*&---------------------------------------------------------------------*
*&       Class (Implementation)  LCL_TOOLBAR_EVENT_RECEIVER
*&---------------------------------------------------------------------*
*        Text
*----------------------------------------------------------------------*
CLASS lcl_toolbar_event_receiver IMPLEMENTATION.
  METHOD catch_function_selected.
    w_fcode = fcode.

    CASE w_fcode.

      WHEN 'EXPAND'.
        PERFORM expand_nodes.
      WHEN 'COLLAPSE'.
        PERFORM collapse_nodes.
      WHEN 'EXECUTE'.
        PERFORM execute_node_item.
      WHEN 'REFRESH'.
        PERFORM collapse_nodes.
      WHEN 'SCROLL'.
        PERFORM scroll_tree.
    ENDCASE.
  ENDMETHOD.                    "CATCH_FUNCTION_SELECTED

ENDCLASS.               "LCL_TOOLBAR_EVENT_RECEIVER


**also set handler"

*Set handler for events
    SET HANDLER lcl_toolbar_event_receiver=>catch_function_selected FOR toolbar .

Hope this will help you

OR check these sap standard program

ALV Tree Control: Build Up the Hierarchy Tree BCALV_TREE_01

ALV Tree Control: Event Handling BCALV_TREE_02

ALV Tree Control: Use an Own Context Menu BCALV_TREE_03

ALV Tree Control: Add a Button to the Toolbar BCALV_TREE_04

ALV Tree Control: Add a Menu to the Toolbar BCALV_TREE_05

ALV tree control: Icon column and icon for nodes/items BCALV_TREE_06

Thanks

Anirudh Saini

Read only

Former Member
0 Likes
631

HI,

check below demo programs..

BCALV_GRID_05

BCALV_GRID_06

BCALV_GRID_07

BCALV_GRID_08

Hope it will help...

Read only

daixiong_jiang3
Active Participant
0 Likes
631

please refer to the demo program provided by SAP:

BCALV_TREE_DEMO