cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Node Creation

Former Member
0 Kudos

Hai all,

I am new to the Dynpro. i have to create 'n' number of drop down at dynamically. The values of 'n' only known at runtime, that is fetch from database.

Basically each dropdown must have one node and one attribute. So i have to create 'n' number of nodes. Each drop down have different values.

I created some node at runtime using the following code.

for(int j=0;j<count;j++){

IWDNodeInfo node = wdContext.getNodeInfo

().addChild ("Roles"+j,null,true, true,false,

false,false,true,null,null,null);

node.addAttribute(roles[j].toString

(),"com.sap.dictionary.string");

}

This is done inside the wdDoInit() method.

Then i have to fetch the node one by one and load values from database and finally bind into the drop down inside the wdDoModifyView() method.

I tried the following code,but i don't know whether is it correct way or not.

if (firstTime) {

IWDTransparentContainer container =

(IWDTransparentContainer) view.getElement

("RootUIElementContainer");

container.createLayout(IWDMatrixLayout.class);

for(int rolecunt=0;rolecunt<size;rolecunt++){

IWDNode node = wdContext.currentContextElement().node().getChildNode("Roles"+rolecunt,rolecunt);

IWDNodeElement nodeElement1 = node.getCurrentElement();

}

}

thanks in advance,

Mukesh Mani.

View Entire Topic
Former Member
0 Kudos

Hi Mukesh,

Please try the following in wddoModifyView method

IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)

view.createElement (IWDDropDownByIndex.class, "inp");

for(int j=0;j<count;j++){

IWDNodeInfo node =

wdContext.getNodeInfo().addChild(

"Roles"+j,

null,

true,

true,

false,

false,

false,

true,

null,

null,

null);

node.addAttribute(roles[j].toString

(),"com.sap.dictionary.string");

inp.bindTexts(""Roles"j"."+roles[j].toString);

}

Best Regards, Anilkumar