cancel
Showing results for 
Search instead for 
Did you mean: 

How to add screen elements at run time on button click in Web Dynpro abap?

former_member201541
Participant
0 Kudos

Hello All,

I have a requirement wherein the user wants to add the textbox dynamically at runtime on button click action. My questions is, Is it feasible to dynamically add screen elements at runtime? If yes, how?

Please help.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Don't go for Dynamic programming if possible.

As Amy told, its better create  separate attributes of type WDUI_VISIBILITY with initial values as NONE  and bind it to your ui elements at design time.

Based on your requirement/condition you can change the visibility options.

Regards,

Paul Sudhakar.

amy_king
Active Contributor
0 Kudos

Hi Ajinkya,

This is absolutely possible! Adding view elements at runtime is called "dynamic programming". There are a lot of good resources and tutorials on SCN if you do a search. To start you off, here is an excellent series by :

Another option that avoids dynamic programming is to create the view element at design time but bind its visible property to a context attribute of type WDUI_VISIBILITY. You could initially set its visibility to "none" until the user clicks the button, then you could change its visibility to "visible".

Cheers,
Amy

former_member201541
Participant
0 Kudos

Thanks Amy King for your reply will try out this.

nishantbansal91
Active Contributor
0 Kudos

Hi,

For this you have to do coding in MODIFY VIEW method of your view.

for Each elements SAP has provided one dynamic class.

For text view you can use this class CL_WD_TEXT_VIEW.

First create the Text view by using static method of class NEW_TEXT_VIEW and give the ID and bind the context attribute to by using this method after creating instance BIND_TEXT.

and add the view element to your layout type and set the position.

Regards,

Nishant