cancel
Showing results for 
Search instead for 
Did you mean: 

Need to create UIElements dynamically in webdynpro

Former Member
0 Kudos

hi,

i want to know, if there is a possibility for dynamic form creation in webdynpro....

regards

rajesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

1) U can create UI elements dynamically in the wdDoModifyView().

2)For ex:If u want to create InputField dynamically

3)First get the ref of the container

IWDTransaparentContainer container=(IWDTransaparentContainer)view.getElement("id of container");

4)IWDInputField input=(IWDInputField)view.createElement(IWDInputField.class,null);

where view is the IWDVIew,which is one of the parameters of the wddoModifyView().

input.bindValue("cvar");

5)Add the inputfiled to the container

container.addChild(input);

6)For other elements see the following link

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/74cda090-0201-0010-6b91-f85b2489f765 |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/74cda090-0201-0010-6b91-f85b2489f765 ]

Regards

Hazrath

Edited by: Hazrath on Mar 27, 2008 6:13 AM

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Dynamic UI Element creation

We can create it only in the WD Modify View.

Get the instance for the Root UI Element Container.

Create the UI element Ex: Input Field, Text View etc.

Bind the UI Element to the Attribute Value.

Now bind the UI Element to the Root UI Element Container.

{

IWDTransparentContainer root =(IWDTransparentContainer)view.getRootElement();

IWDInputField InpName = (IWDInputField)view.createElement(IWDInputField.class,"InpName");

IWDInputField InpAge = (IWDInputField)view.createElement(IWDInputField.class,"InpAge");

IWDInputField InpGender = (IWDInputField)view.createElement(IWDInputField.class,"InpGender");

IWDNode Mad =wdContext.getChildNode("Person",0);

IWDAttributeInfo NameAtt = Mad.getNodeInfo().getAttribute("Name");

IWDAttributeInfo AgeAtt = Mad.getNodeInfo().getAttribute("Age");

IWDAttributeInfo GenderAtt = Mad.getNodeInfo().getAttribute("Gender");

InpName.bindValue(NameAtt);

InpAge.bindValue(AgeAtt);

InpGender.bindValue(GenderAtt);

root.addChild(InpName);

root.addChild(InpAge);

root.addChild(InpGender);

}

Dynamic Action Creation

Create the Action in the Action tab.

Create a Button.

Get the reference for the created action (Through the Event Handler).

Bind the Action to the Button.

Bind the Button to the Root UI element Container.

IWDButton ButGo = (IWDButton)view.createElement(IWDButton.class,"ButGo");

IWDAction ActGo = wdThis.wdCreateAction(IPrivateStartView.WDActionEventHandler.GO,"Click");

ButGo.setOnAction(ActGo);

root.addChild(ButGo);

Now write the required code for the Event Handler that is associated with the Action.

//@@begin onActionGo(ServerEvent)

IWDNode Mad = wdContext.getChildNode("Person",0);

wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Name"));

wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Age"));

wdComponentAPI.getMessageManager().reportSuccess(Mad.getCurrentElement().getAttributeAsText("Gender"));

//@@end

Hope it helps,

*GS

Former Member
0 Kudos

hi,

I was not sure about question..whether you want create UIElements or only form .Nwys,

for Form creation

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f27e290-0201-0010-ff82-c21557572da1]

for dynamic creation of UIElements:

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459cb44]

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/58a7e390-0201-0010-abb1-8eec7eb7a2ec]

[http://help.sap.com/saphelp_nw04/helpdata/en/c0/ead8a21ba49f4896c64851677f8ec9/content.htm]

regards,

pinki

Former Member
0 Kudos

hi,

Hope the following link help you.

[http://help.sap.com/saphelp_nw04/helpdata/en/89/73a840bd6d3c13e10000000a155106/frameset.htm]

Thanks & regards

Kavitha

Former Member
0 Kudos

Hi ,

Dynamic Programming of Web Dynpro Applications

hope this tutorial ill help u

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94a...

Regards,

Sunitha Hari