cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically creating a button and its action

Former Member
0 Kudos

Hi,

I have created a button dynamically and gave an action to it...

lr_button = cl_wd_button=>new_button( text = MY_TEXT

on_action = MY_ACTION ).

now i want know how the event method my_action will be created...how to call that method and how to write the logic in it...

pls help me out

thanks

swapna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

With your code ,

lr_button = cl_wd_button=>new_button( text = MY_TEXT on_action = MY_ACTION ).

you have dynammically created a button with on Action also.

other way for On action is : lr_button->set_on_action( `ACTION` ) in case you did not create on action in your code.

Now just create an action with your Action name in Action Tab and write the logic there.

The action will be called on the click of button.

Thanx.

Former Member
0 Kudos

thanks guys

Answers (3)

Answers (3)

arjun_thakur
Active Contributor
0 Kudos

Hi Swapna,

You have to create the action for the button manually. Go to the actions tab of the view in which you want to insert the button and create an action with the name MY_ACTION and the write the logic in that method.

The code which you have written will dynamically create a button and when that button is clicked then this method will be called.

I hope it helps.

Regards

Arjun

Former Member
0 Kudos

Hi Swapna,

Write the MY_ACTION in the Actions tab, and write the logic there.

As you have written on action it will be fine, it is ok,

Best regards,

Rohit

Edited by: Rohit Mahajan on Mar 12, 2009 11:20 AM

former_member402443
Contributor
0 Kudos

Hi Swapna,

For this check the below links

[Dynamic Prog Part 1|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2888] [original link is broken] [original link is broken] [original link is broken];

[Dynamic Prog Part 2|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2915] [original link is broken] [original link is broken] [original link is broken];

[Dynamic Pro. Part 3|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2953] [original link is broken] [original link is broken] [original link is broken];

Hope this will helps you.

Regard

Manoj Kumar