cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic event for a button

former_member196517
Contributor
0 Kudos

Hi All,

how can i create a action and a handler dynamically for a dynamically created button,

please mention some steps....

Regards

Anuj Goyal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

you need to create your action in development phase,

if you don't, you won't have an event handler method to trigger

to add the actions dynamically, you can add them on creation of the button

example:

lo_button = cl_wd_button=>new_button( id = lv_id

on_action = lv_action

text = lv_decision ).

cl_wd_grid_data=>new_grid_data( element = lo_button

h_align = 00 ).

lo_tray->add_child( lo_button ).

this is in case you set the button into a tray with gridlayout

grtz,

Koen

Message was edited by:

Koen Labie

former_member196517
Contributor
0 Kudos

Hi Koen,Nithya

i want to add this button and event and event handler in BADI implementation that means in development phase i cant do anything.. everything need to be dynamic..

Regards

Anuj

Answers (1)

Answers (1)

Former Member
0 Kudos

When you create your button dynamically, there will be a method map_on_action in the button class. Use that to map at runtime the name of the action that is bound to the button. But it would be better if this action itself is created at design time using the Actions tab in your view. The binding can be done dynamically.

Hope this helps.

Regards

Nithya