Skip to Content
0
Oct 26, 2013 at 10:28 AM

Dynamic creating a button and adding the event handler to it

976 Views

Hi Experts,

I am able to create a button dynamically and attached the action

Below is the code.

data:root type ref to cl_wd_uielement_container,
bt type ref to cl_wd_button.

root ?= view->get_element('ROOTUIELEMENTCONTAINER').

bt = cl_wd_button=>new_button( text = 'Submit' on_action = `SAY_HELLO` ).

cl_wd_flow_data=>new_flow_data( element = bt ).

root->add_child( bt ).

In the method 'SAY_HELLO' I have written code to show one message. But it gives dump and does not allow me to create onactionsay_hello method even.

I have created SAY_HELLO as method type 1(i.e event handler method).

My expectation is :

One button should be created dynamically and after clicking it should prompt some message . and everything should happen dynamically.

Thanks.