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

Add & Remove some button in standard alv grid using OOPS

Former Member
0 Likes
3,092

Hi friends,

I wants to add and remove some buttons from ALV Grid using oops concept, can any one please give me an exact way to do it.

Thank you.

Regards,

Virat

Hi friends,

I wants to add and remove some buttons from ALV Grid using oops concept, can any one please give me an exact way to do it.

Thank you.

Regards,

Virat

4 REPLIES 4
Read only

Former Member
0 Likes
1,686

For adding a button on the toolbar, you will need to handle the TOOLBAR event of the class CL_GUI_ALV_GRID. This event has a parameter E_OBJECT which is an object reference to the class CL_ALV_EVENT_TOOLBAR_SET. Using this object you can access an internal table MT_BUTTON in the class CL_ALV_EVENT_TOOLBAR_SET. Append the Function Code, Icon and Text to this internal table.

For deleting a button from the toolbar, just append the function code of the button you want to exclude to an internal table of type UI_FUNCTIONS and pass it to the method SET_TABLE_FOR_FIRST_DISPLAY through the parameter IT_TOOLBAR_EXCLUDING.

Read only

Former Member
0 Likes
1,686

Verify BCALV_GRID_VERIFY

methods handle_toolbar_set

for event toolbar of cl_gui_alv_grid

importing e_object e_interactive.

method handle_toolbar_set.

  • handle toolbar

  • create own Menubuttons and ToolbarButtons

if e_interactive is initial.

clear gs_toolbar.

move 'DELE' to gs_toolbar-function.

move icon_delete to gs_toolbar-icon.

move 'Mein Löschen'(111) to gs_toolbar-quickinfo.

move ' ' to gs_toolbar-disabled.

append gs_toolbar to e_object->mt_toolbar.

clear gs_toolbar.

move 'REFR' to gs_toolbar-function.

move icon_refresh to gs_toolbar-icon.

move 'Mein Refresh'(112) to gs_toolbar-quickinfo.

move ' ' to gs_toolbar-disabled.

insert gs_toolbar into e_object->mt_toolbar index 1.

endmethod.

set handler event_receiver->handle_toolbar_set for grid1.

Message was edited by:

Sumi Vasu

Read only

0 Likes
1,686

Hi,

Could you please tell me what is this gs_toolbar?

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,686

Hi,

FIll the table parameter of the function SET_TABLE_FOR_FIRST_DISPLAY.

Add MC_FC_XXXX attributes of the class to this table.

IT_TOOLBAR_EXCLUDING.

DATa: itab type UI_FUNCTIONS.

APPEND cl_gui_alv_grid=>MC_FC_AVERAGE to itab.

Then pass itab as follows

IT_TOOLBAR_EXCLUDING = itab.

Regards,

Sesh