cancel
Showing results for 
Search instead for 
Did you mean: 

Add ONCLICK EVENT Dynamically.

Former Member
0 Kudos

Hi ,

I have created Tabstirp and ALV dynamically.

Now I want to Add ONclick event for Button and i want to show POPup message after clicking on that Button.

But I don't know how to Add Event in dynamically on each ALV cell?

Please help me on this topic.

Thanks and regards

Amita Gandhi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I got the answer with following code :

l_cmp_usage->add_event_handler(

listener = l_cmp_api

handler_name = 'ONCLICK'

controller_name = 'INTERFACECONTROLLER'

event_name = 'ON_CLICK' ).

Former Member
0 Kudos

I got the answer with following code :

l_cmp_usage->add_event_handler(

listener = l_cmp_api

handler_name = 'ONCLICK'

controller_name = 'INTERFACECONTROLLER'

event_name = 'ON_CLICK' ).

Former Member
0 Kudos

Hi,

It is not possible to define the source code of an action handler method dynamically. But it is possible to define, which existing action handler will be called when an event is caught.

1. Create an action handler MY_ACTION before hand and map that to a button as below and write the handling code on button click in that event method.

"binding actoin dynamically to a button
 LR_BUTTON    =  CL_WD_BUTTON=>NEW_BUTTON(        text = MY_TEXT 
                                             On_action = 'MY_ACTION' ).

  "OR
 LR_BUTTON->SET_ON_ACTION( value = 'MY ACTION' ).

If you have many buttons, u can assign same action to all the buttons and inside handling you get the last triggered action using importing parameter WD_EVENT->GEN_NAME

Regards,

Manne.