cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic modification of WD elements

matteo_montalto
Contributor
0 Kudos

Hi all,

I was wondering if there's a way to dynamically switch a WD Element's type at runtime.

This is my requirement: in SRM, I have a custom field (read-only) which is, by default, rendered as a TextView element. It can be filled by a value that, under certain assumptions, I'd like to render as a LinkToAction WD element.

This could be done "statically" using CellVariants, I know; but the custom field is in this case rendered dynamically, so I can't work on the "layout" screen because the field is not available there.

My solution by now is to create dynamically a LinkToAction element and substitute that element to original TextView... but the ideal solution would be to "transform" that TextView element into a LinkToAction one (obviously, setting also the target in a proper way).

As far as I've tried, this is not possible .... am I missing something?

Thanks everybody,

regards!

M.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184741
Active Contributor
0 Kudos

hi,

I don't think it is possible. Proceed with your solution.

thanks,

sankar.

Answers (4)

Answers (4)

matteo_montalto
Contributor
0 Kudos

Thanks a lot guys,

as far as I understood from your argumentation, a dynamic "casting" of this type is not possible... that's what I wanted to understand.
As a workaround, I proceeded creating dynamically a LinkToAction element, adding it to the desidered container after my inputField and then playing around with visibility property in order to show the first or the latter according to my assumptions.

Thanks again

M.

Gowtham
Contributor
0 Kudos

Hi Matteo,

I would like to suggest you to use the hide/show process , this will make your work easier.

Create two UI elements Link to action and text view and based upon you condition make the fields enable and disable.

If this not suits your business requirement you can go ahead for Dynamic UI element creation

Creating UI Elements Dynamically in Abap Webdynpro Application - Web Dynpro ABAP - SCN Wiki

- Gowtham

vinita_kasliwal
Active Contributor
0 Kudos

Hi Matteo

From what I understand ..I may be wrong though we can do it the other way .

Create 2 elements : Text View and LinktoAction now based on your code decide which one you would like to show . You can do that at run time isnt it and you can align it in a way so that there is no empty space .. instead of complicating it to transform into another element ..

Refer these links below as well to be able to work on it .

http://wiki.scn.sap.com/wiki/display/WDABAP/Creating+UI+Elements+Dynamically+in+Abap+Webdynpro+Appli...

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0b8dd16-5d78-2c10-6f82-c88fe4a7c...

Dynamic Generation of a User Interface Element - Web Dynpro for Java - SAP Library

http://scn.sap.com/docs/DOC-50818

Let me know what you think .

Regards

Vinita

Former Member
0 Kudos

Hi Matteo,

As far as I understand you have requirement where you want to change the type of UI element dynamically depending upon some condition.

 

For this you can create that UI element dynamically using classes cl_wd_*. depending upon your condition you create text view UI or Link to action UI with same text and assign properties of UI element from class methods.

Please have a look at this .

Thanks

Pradeep