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: 

Adding a push button in OO ALV Grid

Former Member
0 Kudos

Hello Experts,

I want to add a button to the ALV status(not main status).I am using following code inside my method

  • Local data

DATA: LS_TOOLBAR TYPE STB_BUTTON.

  • append a separator to normal toolbar

CLEAR LS_TOOLBAR.

MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.

APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.

  • append an icon to show legend

CLEAR LS_TOOLBAR.

MOVE 'LEGE' TO LS_TOOLBAR-FUNCTION.

MOVE ICON_DETAIL TO LS_TOOLBAR-ICON.

MOVE 'Show Legend' TO LS_TOOLBAR-QUICKINFO.

MOVE 'Legend' TO LS_TOOLBAR-TEXT.

MOVE ' ' TO LS_TOOLBAR-DISABLED.

APPEND ls_toolbar TO e_object->mt_toolbar.

Also I am registering the event using

SET HANDLER CUST_EVENT_RECEIVER->HANDLE_TOOLBAR FOR CUST_GRID.

And to raise event toolbar I am calling method

CALL METHOD CUST_GRID->set_toolbar_interactive.

When I do a syntax check it is saying

"The field 'MT_TOOLBAR' is unknown,but there is a field with the similar name 'M_HEIGHT_TOOLBAR'"

I even looked at the program BCALV_GRID_05 to check for errors.

Can anyone please tell me why this is happening and how to correct this error?

Thanks

Sandeep

5 REPLIES 5

Former Member
0 Kudos

Hi,

Please make sure you are using the correct event ..in the class definition..

METHODS:
        handle_toolbar      FOR EVENT toolbar      OF cl_gui_alv_grid IMPORTING e_object e_interactive,

Thanks

Naren

Former Member
0 Kudos

Hi All,

I got the issue resolved.

Thanks

SAndeep

Former Member
0 Kudos

Hi,

Did you define this method in class definition.

methods:

handle_toolbar

for event toolbar of cl_gui_alv_grid

importing e_object e_interactive,

Refer to this linik...[User defined buttons in ALV |https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/userdefinedbuttonsinALV]

I355602
Advisor
Advisor
0 Kudos

Hi,

To add BUTTONS standard alv toolbar in OOALV:-

Refer:

BCALV_GRID_05

Or this thread will solve your problem.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Hi,

Declare:-

DATA : e_object TYPE REF TO cl_alv_event_toolbar_set,

io_alv_toolbar TYPE REF TO cl_alv_event_toolbar_set.

Thanks & Regards,

Ruchi Tiwari