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 remove standard buttons from alv tree?

former_member672218
Participant
0 Kudos

hi friends,

I am working on an ALV tree object. I am supposed to remove the standard buttons that are just on top of the alv tree. The buttons are - Expand Subtree , Collapse subtree,Find,Recalcuate colums,Print view and select layout.

I was able to remove the find button by passing the attribute cl_gui_alv_grid=>MC_FC_FIND to IT_TOOLBAR_EXCLUDING to the method set_table_for_first_display. But i am unable to remove the other buttons. Can someone help me on this?

Thanks,

Venkat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Venkat,

U can remove the standard toolbar of ALV tree by checking the no toolbar field while creating object of alv tree.

U can do like this:


CREATE OBJECT g_alv_tree
    EXPORTING
        parent                       = g_custom_container
        node_selection_mode = cl_gui_column_tree=>
node_sel_mode_single
        item_selection            = 'X'
        no_html_header          = 'X'
        no_toolbar                  = ' X'
    EXCEPTIONS
        cntl_error                         = 1
        cntl_system_error            = 2
        create_error                     = 3
        lifetime_error                    = 4
        illegal_node_selection_mode  = 5
        failed                                 = 6
        illegal_column_name          = 7.

g_alv_tree is object of class cl_gui_alv_tree

Hope this will solve your problem.

Regards,

Brajvir

7 REPLIES 7

former_member598013
Active Contributor
0 Kudos

Hi Venkat,

To remove the standard button from the ALV, you need to create an alv tool bar and call that tool bar while calling the FM to dispaly the alv in the output.

This will resolve your problem.

Former Member
0 Kudos

Hi Venkat

Refer the program in the below thread,

http://saptechnical.com/Tutorials/ALV/Toolbar/menu.htm

Regards,

Syf

Former Member
0 Kudos

hii

refer link for excluding buttons on ALV

[ALV Buttons|]

regards

twinkal

former_member188685
Active Contributor
0 Kudos

You can remove them append all the possible function excluding table. and pass it to SET_TABLE method.

CL_GUI_ALV_TREE->MC_FC_CALCULATE

CL_GUI_ALV_TREE->MC_FC_CALCULATE_AVG

CL_GUI_ALV_TREE->MC_FC_CALCULATE_MAX

CL_GUI_ALV_TREE->MC_FC_CALCULATE_MIN

CL_GUI_ALV_TREE->MC_FC_CALCULATE_SUM

CL_GUI_ALV_TREE->MC_FC_COLLAPSE

CL_GUI_ALV_TREE->MC_FC_COL_INVISIBLE

CL_GUI_ALV_TREE->MC_FC_COL_OPTIMIZE

CL_GUI_ALV_TREE->MC_FC_CURRENT_VARIANT

CL_GUI_ALV_TREE->MC_FC_DETAIL

CL_GUI_ALV_TREE->MC_FC_EXPAND

CL_GUI_ALV_TREE->MC_FC_FIND

CL_GUI_ALV_TREE->MC_FC_GRAPHICS

CL_GUI_ALV_TREE->MC_FC_HELP

CL_GUI_ALV_TREE->MC_FC_LOAD_VARIANT

CL_GUI_ALV_TREE->MC_FC_MAINTAIN_VARIANT

CL_GUI_ALV_TREE->MC_FC_GRAPHICS

CL_GUI_ALV_TREE->MC_FC_HELP

CL_GUI_ALV_TREE->MC_FC_LOAD_VARIANT

CL_GUI_ALV_TREE->MC_FC_MAINTAIN_VARIANT

CL_GUI_ALV_TREE->MC_FC_PRINT_BACK

CL_GUI_ALV_TREE->MC_FC_PRINT_BACK_ALL

CL_GUI_ALV_TREE->MC_FC_PRINT_PREV

CL_GUI_ALV_TREE->MC_FC_PRINT_PREV_ALL

CL_GUI_ALV_TREE->MC_FC_SAVE_VARIANT

CL_GUI_ALV_TREE->MC_FC_SETTOP

Former Member
0 Kudos

hi,

pz check the below code :

In Top :

DATA: g_t_toolbar_excl TYPE ui_functions,
      g_wa_toolbar_excl LIKE LINE OF g_t_toolbar_excl.

In Main program :

*&---------------------------------------------------------------------*
*&      Form  f0501_exclude_fcode
*&---------------------------------------------------------------------*
* code for hiding the toolbar that is not needed.

FORM f0501_exclude_fcode .
  CLEAR g_wa_toolbar_excl.
  REFRESH g_t_toolbar_excl.

  g_wa_toolbar_excl = cl_gui_alv_grid=>mc_fc_check.
  APPEND g_wa_toolbar_excl TO g_t_toolbar_excl.

  g_wa_toolbar_excl = cl_gui_alv_grid=>mc_fc_refresh.
  APPEND g_wa_toolbar_excl TO g_t_toolbar_excl.
  g_wa_toolbar_excl = cl_gui_alv_grid=>mc_fc_loc_cut.
  APPEND g_wa_toolbar_excl TO g_t_toolbar_excl.
  g_wa_toolbar_excl = cl_gui_alv_grid=>mc_fc_loc_copy.
  APPEND g_wa_toolbar_excl TO g_t_toolbar_excl.

  g_wa_toolbar_excl = cl_gui_alv_grid=>mc_fc_loc_copy_row.
  APPEND g_wa_toolbar_excl TO g_t_toolbar_excl.

.......

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  display_table_9003
*&---------------------------------------------------------------------*
* ALV display for user status.
FORM f0302_display_table_9001 .
  IF g_screen_active_9001 IS INITIAL.
    PERFORM f0201_set_drop_down.
    CALL METHOD g_alv_grid_9001->set_table_for_first_display
      EXPORTING
        i_bypassing_buffer            = 'X'
        is_layout                     = g_wa_layout
        it_toolbar_excluding          = g_t_toolbar_excl
      CHANGING
        it_outtab                     = g_t_outtab[]
        it_fieldcatalog               = g_t_fcat_9001
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.
....
ENDFORM.

thanx.

Former Member
0 Kudos

Hi Venkat,

U can remove the standard toolbar of ALV tree by checking the no toolbar field while creating object of alv tree.

U can do like this:


CREATE OBJECT g_alv_tree
    EXPORTING
        parent                       = g_custom_container
        node_selection_mode = cl_gui_column_tree=>
node_sel_mode_single
        item_selection            = 'X'
        no_html_header          = 'X'
        no_toolbar                  = ' X'
    EXCEPTIONS
        cntl_error                         = 1
        cntl_system_error            = 2
        create_error                     = 3
        lifetime_error                    = 4
        illegal_node_selection_mode  = 5
        failed                                 = 6
        illegal_column_name          = 7.

g_alv_tree is object of class cl_gui_alv_tree

Hope this will solve your problem.

Regards,

Brajvir

former_member672218
Participant
0 Kudos

Thanks Brajvir. Your reply was very helpful and it solved the issue. Thanks to everyone else for spending time and replying back. Points awarded.

Regards,

Venkat