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: 

Hiding parts of the tool bar

Former Member
0 Kudos

In the ALV grid using OOPS , I want to hide some tools of the tool bar. I knwo I must pass a table to the fist display . But from where do I get to know the names of the tools , I mean which table.

Right now i want to hide all components except the sort and the print.

Thank you

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Krish

Have a look at my sample report <b>ZUS_SDN_ALV_EVT_TOOLBAR</b> in thread

Since the ALV toolbar is an <i>intrinsic </i>part of the ALV grid the names for the toolbar function can be found as constants (starting with <b>MC_FC_...</b>) in class <b>CL_GUI_ALV_GRID</b>.

Regards

Uwe

9 REPLIES 9

Former Member
0 Kudos

Hi,

In an internal table populate all the ALV Tool bar ICON names which you want to Hide and pass it to IT_EXCLUDE_TOOLBAR in the ALV call Method.

***************************

data : it_toolbar type ui_functions, "Used for Toolbar addition

wa_toolbar like line of it_toolbar."Used in form Exclude_Toolbar

wa_toolbar = cl_grid->MC_FC_LOC_APPEND_ROW.

append wa_toolbar to it_toolbar.

wa_toolbar = cl_grid-mc_fc_loc_paste. "Toolbar Button PASTE OVER ROW

append wa_toolbar to it_toolbar.

wa_toolbar = cl_grid-mc_fc_loc_paste_new_row. "Toolbar Button PASTE NEW ROW

append wa_toolbar to it_toolbar.

wa_toolbar = cl_grid->mc_fc_find. "Toolbar Button FIND

append wa_toolbar to it_toolbar.

CALL METHOD cl_grid->set_table_for_first_display

EXPORTING

IT_TOOLBAR_EXCLUDING = it_toolbar

CHANGING

it_outtab = it_sflight[]

IT_FIELDCATALOG = g_fieldcat.

******************************************

ONEMORE SAMPLE CODE.....

PEFORM EXCLUDE_TOOLBAR.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'ZFLP_STCUALCONDPRI'

is_layout = gs_layout

i_save = 'A'

IT_TOOLBAR_EXCLUDING = it_toolbar1

CHANGING

it_outtab = gt_zflp_ttcualcond

it_fieldcatalog = gt_fieldcat.

*************************************************

My code for buttons..

FORM EXCLUDE_TOOLBAR.

data : it_toolbar1 type standard table of ui_functions,

wa_toolbar like line of it_toolbar.

  • You need to specify the Methods of the ALV ICONS which are not required.

  • THis code will Grade out PASE and Find buttons.

  • Similarly you can pass the name of icons which are not required to this internal table

  • and append it.

wa_toolbar = cl_grid-mc_fc_loc_paste. "Button PASTE append wa_toolbar to it_toolbar1.

wa_toolbar = cl_grid->mc_fc_find. "Button FIND

append wa_toolbar to it_toolbar1.

ENDFORM.

CLASS lcl_event_receiver IMPLEMENTATION.

***

*handle tool bar methods..

METHOD handle_toolbar.

*variables for the toolbar

DATA lt_toolbar TYPE ttb_button.

DATA ls_mttoolbar TYPE LINE OF ttb_button.

  • User command toolbar buttons..

ls_mttoolbar-function = 'add_row'.

ls_mttoolbar-icon = '@17@'.

ls_mttoolbar-quickinfo = 'Add a new row'.

ls_mttoolbar-text = 'Add node'.

ls_mttoolbar-butn_type = '0'.

APPEND ls_mttoolbar TO lt_toolbar.

e_object->mt_toolbar = lt_toolbar.

ls_mttoolbar-function = 'del_row'.

ls_mttoolbar-icon = '@18@'.

ls_mttoolbar-quickinfo = 'Delete a row'.

ls_mttoolbar-text = 'Delete node'.

ls_mttoolbar-butn_type = '5'.

APPEND ls_mttoolbar TO lt_toolbar.

e_object->mt_toolbar = lt_toolbar.

ls_mttoolbar-function = 'save_data'.

ls_mttoolbar-icon = '@2L@'.

ls_mttoolbar-quickinfo = 'Save the current data'.

ls_mttoolbar-text = 'save data'.

ls_mttoolbar-butn_type = '5'.

APPEND ls_mttoolbar TO lt_toolbar.

e_object->mt_toolbar = lt_toolbar.

ENDMETHOD. "handle_toolbar

******************************************

REGARDS

VASU

0 Kudos

I would like to know , where to find the names of cut , copy etc ,,, I mean which talbe. Right now I am using the following code which I got on sdn.

t_toolbar = '&MB_VIEW'.

append t_toolbar.

t_toolbar = '&MB_EXPORT'.

append t_toolbar.

t_toolbar = '&GRAPH'.

append t_toolbar.

t_toolbar = '&COLO'.

I do not know how to get the names of other toolbar items.

0 Kudos

Check RSMPTEXTS

Regards

vasu

0 Kudos

I could not find the names of the tool bar item in the table. Can someone please help me with this. I need to hide most of the tool bar , except a few like print , sort etc in ALV (OOPS) . I am using the following code , but it only covers some tools and not all :

t_toolbar = '&GRAPH'.

append t_toolbar.

t_toolbar = '&COLO'.

append t_toolbar.

0 Kudos

Hello Krish,

Why don't you go Menu painter ,remove them what ever you don't need.

I guess you copied PF status to Custom PF Staus.

Goto Se80 -> drag GUI Status -> double click on gui.

Here you can remove them.

Thanks

Seshu

0 Kudos

I have trouble with the Tool bar in the ALV container , I tried debugging and finding the pf status , but I couldnt make anything useful of it .

If there is a table which holds all these names of the tool bar items , then it will be easy for me to simply include these names in my table that I pass in the set--- for _first _display.

Thankyou

0 Kudos

Check the table : RSMPTEXTS

Field name is OBJ_CODE .

enter program name and see what are the function codes available in OBJ_CODE.

Thanks

Seshu

uwe_schieferstein
Active Contributor
0 Kudos

Hello Krish

Have a look at my sample report <b>ZUS_SDN_ALV_EVT_TOOLBAR</b> in thread

Since the ALV toolbar is an <i>intrinsic </i>part of the ALV grid the names for the toolbar function can be found as constants (starting with <b>MC_FC_...</b>) in class <b>CL_GUI_ALV_GRID</b>.

Regards

Uwe

Former Member
0 Kudos

Hi

you were right Uwe , I could locate the tools in cl_gui_alv_grid and by passing their names in it_toolbar , I could hide what ever I wanted. This is a very useful piece of information . In the transparent table suggested by Vasu and Seshu , I couldnt find all the ALV toolbar , but some were present. , I wonder why . Anyway.. Thanks a lot friends. I appreciate it.