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: 

ALV

Former Member
0 Kudos

Hi,

In ALV Grid control, in menu bar I want only certain buttons like Total and Subtotal button and I

dont want the rest of the buttons. Is it possible?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi JD,

check this....

data: lt_exclude type ui_functions,
       lt_f4 type lvc_t_f4 with header line.
 
  perform exclude_tb_functions changing lt_exclude.
 
 call method g_grid->set_table_for_first_display
    EXPORTING
      it_toolbar_excluding = lt_exclude
      it_hyperlink         = gt_hypetab
      is_layout            = gs_layout
    CHANGING
      it_fieldcatalog      = pt_fieldcat
      it_outtab            = pt_outtab.
 
 
form exclude_tb_functions changing pt_exclude type ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
 
  data ls_exclude type ui_func.
 
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
  append ls_exclude to pt_exclude.
*  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
*  append ls_exclude to pt_exclude.
*  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
*  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>MC_FC_CHECK.
  append ls_exclude to pt_exclude.
 
 
endform.          " EXCLUDE_TB_FUNCTIONS

check these links for further help....

http://help.sap.com/saphelp_erp2005/helpdata/en/e5/1cecdc32fc11d4b5c4006094192fe3/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm

reward points for helpfull answers and close the thread if your question is solved.

regards,

venu.

4 REPLIES 4

Former Member
0 Kudos

Hi JD,

check this....

data: lt_exclude type ui_functions,
       lt_f4 type lvc_t_f4 with header line.
 
  perform exclude_tb_functions changing lt_exclude.
 
 call method g_grid->set_table_for_first_display
    EXPORTING
      it_toolbar_excluding = lt_exclude
      it_hyperlink         = gt_hypetab
      is_layout            = gs_layout
    CHANGING
      it_fieldcatalog      = pt_fieldcat
      it_outtab            = pt_outtab.
 
 
form exclude_tb_functions changing pt_exclude type ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
 
  data ls_exclude type ui_func.
 
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
  append ls_exclude to pt_exclude.
*  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
*  append ls_exclude to pt_exclude.
*  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
*  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=>MC_FC_CHECK.
  append ls_exclude to pt_exclude.
 
 
endform.          " EXCLUDE_TB_FUNCTIONS

check these links for further help....

http://help.sap.com/saphelp_erp2005/helpdata/en/e5/1cecdc32fc11d4b5c4006094192fe3/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm

reward points for helpfull answers and close the thread if your question is solved.

regards,

venu.

Former Member
0 Kudos

JD NA,

It is possible!!!

  • Internal Table for holding the Buttons to be reomved

Data: iUnWantedTools type ui_functions,

waUnWanted type ui_func.

  • This is the Code that removes CHECK Button from the Tool Bar

<b>waUnWanted = cl_gui_alv_grid=>mc_fc_check.

append waUnWanted to iUnWantedTools.</b>

....

grid->set_table_for_first_display(

exporting

is_layout = waLayOut

<b> it_toolbar_excluding = iUnWantedTools</b>

changing

it_outtab = iQdqlsel

it_fieldcatalog = iFieldCatalog[]

Thanks

Kam

former_member188685
Active Contributor
0 Kudos

PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.

&----


*& Form EXCLUDE_TB_FUNCTIONS

&----


  • Excluding the ALV functions

----


FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

DATA LS_EXCLUDE TYPE UI_FUNC.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

ENDFORM. " EXCLUDE_TB_FUNCTIONS

**Calling the Method for ALV output

CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IT_TOOLBAR_EXCLUDING = LT_EXCLUDE

IS_VARIANT = LS_VARI

IS_LAYOUT = GS_LAYOUT

I_SAVE = 'A'

CHANGING

IT_FIELDCATALOG = IT_FIELDCAT

IT_OUTTAB = IT_FINAL[].

this will help you.

regards

vijay

0 Kudos

Thanks for the code. It is helpful. I did award the points.

Thanks You very much!!!!