cancel
Showing results for 
Search instead for 
Did you mean: 

WDA: ALV: action for buttons, links and message class

Former Member
0 Kudos

Hello,

I am using ALV and need to create few buttons on a tool bar.

I can create a button:

data: create_new_button TYPE REF TO cl_salv_wd_fe_button.

CREATE OBJECT create_new_button.

create_new_button->set_text( 'Create New' ).

create_new_button->set_image_source( value = 'ICON_CREATE' ).

Now I need to attach an action to this button. The button is created in INIT method of a component controller

Action is defined in a view. How can I map this?

Also, I have a message class and instead of passing 'Create New' to set_text method how can I get a message from my message class and pass it to set_text method?

Another action that I need to assign to a link that is in one of the columns of the ALV. How can this be done?

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Georgy

Here is an article on how to create UI elements in ALV toolbar and how to catch their events.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/generating%20self-defined%20functions%20for%20alv%20in%20web%20dynpro%20for%20abap.pdf">Generating Self-Defined Functions for ALV in Web Dynpro for ABAP</a>

Hope it helps

Regards

Rakesh

Former Member
0 Kudos

Hi, I don't know if you need the information anymore, but here is one solution:

At first you have to create a function with:

DATA:

lr_function TYPE REF TO cl_salv_wd_function,

l_value TYPE REF TO cl_salv_wd_config_table.

lr_function = l_value->if_salv_wd_function_settings~create_function( id = 'NAMEOFFUNCTION' ).

Second create the Object ('create_new_button') like you did it.

Third assign the toolbar element to the function.

lr_function->set_editor( create_new_button ).

Now you have to create a event handler method in the view with event ON_FUNCTION of your ALV component. In this method you can catch the event triggered by your button and set your code.

I hope it helps.

regards

Christian