cancel
Showing results for 
Search instead for 
Did you mean: 

Adding custom button in standard toolbar in ALV

Former Member
0 Kudos

Hello All,

I need to add a customized button called "Copy" on ALV. The following code is giving me few standard buttons like "Append" "Delete" "Insert" etc. So, how can I add "Copy" button besides one of these standard buttons.

data: l_value type ref to cl_salv_wd_config_table.

data: lr_table_settings type ref to if_salv_wd_table_settings.

lr_table_settings ?= l_value.

lr_table_settings->set_read_only( abap_false ).

Appreciate help.

Thks & Rgds,

Hemal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hemal,

Refer to the below link which has step by step example to create new buttons and place them in alv toolbar.

[Add new custom buttons in ALV toolbar - http://divulgesap.com/blog.php?p=NzI= |http://divulgesap.com/blog.php?p=NzI=]

Hope it helps.

Cheers,

Ravikiran

Edited by: Thomas Jung on Apr 14, 2010 8:32 AM

Former Member
0 Kudos

Resolved.. useful links.. thanks much.

Answers (2)

Answers (2)

0 Kudos

Create One method

And inside that method write the below code

(Here i am creating delete button you can create any name button you want just replace the name

DATA lV_EDITBTN TYPE REF TO cl_salv_wd_fe_button.

DATA lr_buttonui TYPE REF TO cl_salv_wd_fe_button.

CREATE OBJECT lr_buttonui.

lr_buttonui->set_text( 'Details' ).

lr_buttonui->set_tooltip(

'Shows Detail Screen as per the View selected' ).

    • Generating Function Object for Button.*

DATA btn_button TYPE REF TO cl_salv_wd_function.

btn_button = lo_value->if_salv_wd_function_settings~create_function(

id = 'DETAILS' ).

btn_button->set_editor( lr_buttonui ).

DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.

----


After that create another method and make it as a event ( it means now it become event )

select event ON FUNCTION FROM THE LIST

Inside that event write

CASE LV_FCODE.

WHEN 'DETAILS'.

wd_this->fire_OP_TODEATILS_plg( ).

endcase.

----


May be it may help

Former Member
0 Kudos

Hi Hemal,

Check the following thread:

It has the code to create a toolbar button in ALV and how to handle the button action.

Regards

Manas Dua