cancel
Showing results for 
Search instead for 
Did you mean: 

Populating drop down list in a table cell-urgent

Former Member
0 Kudos

Hi all

I have a problem. I want to populate a dropdown list in a table cell. can anybody tell me the step by step procedure for that.

I am doing it generally. not using R/3

I am creating sub node like u have mentioned. I haven't done it using wizard.

Is there any difference in the way we populate this list?

My root node is expense. Inside that some value attributes are there. For the drop down list i've created a sub node 'extype'.

I am getting error.

it is:

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(EREmpHomeView.expense.extype): cannot bind or add elements because the node has no valid parent

Following is the code i've written.

IPrivateEREmpHomeView.IExtypeElement el;

IPrivateEREmpHomeView.IExtypeNode nd=wdContext.nodeExpense().nodeExtype();

el=wdContext.nodeExpense().nodeExtype().createExtypeElement();

el.setEtype("Travel");

nd.addElement(el);

Sill i'm getting the same error

Hi Nidhideep

Error has gone with the code that Mr Anil has given. But there is no value in the List. Dropdown list is coming as a blank list.

Thanks and Regards

Aparnna

Message was edited by:

aparnna prasad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

IPrivateEREmpHomeView.IExpenseElement TopEle=wdContext.createExpenseElement();

wdContext.nodeExpense().addElement(TopEle);

IPrivateEREmpHomeView.IExTypeElement exTypeEle=wdContext.createExTypeElement();

wdContext.nodeExpense().nodeExType().addElement(exTypeEle);

Regards, Anilkumar

Former Member
0 Kudos

Hi,

You need to set the attributes

Ex

exTypeEle.set<<Atrtib1>>(<<Value>>);

Then you can see the values in the dropdown.

Regards, Anilkumar

P.S : Please reply to the messages instead of editing the same post.

Answers (13)

Answers (13)

Former Member
0 Kudos

Hi all

Thanks a lot for your help. I got it working using the way Anil has suggested, but with some change. Pardon me for the late reply.

Thanks & Regards

monalisa_biswal
Contributor
0 Kudos

Set singleton property of subnode extype to false.

Before adding elements to ur subnode u must add elements to parentnode.

After that u have to set lead selection of ur parent node to the last element.

wdContext.nodeExpense().moveLast();

After that u add elements to ur subnode.

IPrivateEREmpHomeView.IExtypeElement el;

IPrivateEREmpHomeView.IExtypeNode nd=wdContext.nodeExpense().nodeExtype();

el=wdContext.nodeExpense().nodeExtype().createExtypeElement();

el.setEtype("Travel");

nd.addElement(el);

Former Member
0 Kudos

hi

Take this code also.

I created a value node Vntable with attribute Drop and binded to the table UI

This was my code in wdInit() method of the view

IWDAttributeInfo info=wdContext.nodeVntable().getNodeInfo().getAttribute("Drop");

ISimpleTypeModifiable st=info.getModifiableSimpleType();

IModifiableSimpleValueSet sv=st.getSVServices().getModifiableSimpleValueSet();

sv.put("1","J");

sv.put("2","F");

for(int i=0;i<5;i++){

wdContext.nodeVntable().addElement(wdContext.nodeVntable().createVntableElement());

}

Regards

Nidhideep

Former Member
0 Kudos

hi

Pz look at this thread

Regards

Nidhideep

Former Member
0 Kudos

hi

Aparna try this code:

1. Context description at design time:

Value-Node "myNode", collection type=list, cardinality=0..n, selection=0..n

and the attribute:

Value attributes “myValue”, type="String".

2. The corresponding Java source code example that you create in the wdDoInit method of the controller implementation:

// The ISimpleTypeModifiable interface enables access to

//a data type instance that can be modified at runtime:

ISimpleTypeModifiable myType =

wdThis.wdGetAPI().getContext.getModifiableTypeOf(“.myNode.myValue”);

//Sets the label text for this data type.

myType.setFieldLabel(“New label”)

//Sets the valid values of this data type. The individual elements are inserted

//when the put method is called and

//and the value set is filled with the appropriate

//key value pair.

IModifiableSimpleValueSet values =

getSVService().myType.getModifiableValueSet();

values.put(“key_1”,”Mister”);

values.put(“key_2”,”Mistress”);

values.put(“key_3”,”Miss”);

Regards

Nidhideep

roberto_tagliento
Active Contributor
0 Kudos

Hi

You wanna polulate a Dropdown into table cell, so means that you must have a singleton node.

Look here about singleton:

for populate a node use this:

wdContext.node$YOUR_NODE$().add(

wdContext.node$YOUR_NODE§().create$YOUR_ELEMENT_NODE$()

);

wdContext.node$YOUR_NODE§().movelast();

wdContext.current$YOUR_ELEMENT_NODE$().set$ATTR1$(..);

wdContext.current$YOUR_ELEMENT_NODE$().set$ATTR2$(...);

wdContext.current$YOUR_ELEMENT_NODE$().set$ATTR3$(..);

Bye.

Message was edited by:

Roberto Tagliento

Former Member
0 Kudos

Hi Aparna,

There is nothing wrong in the code suggested by Anil and Nidhideep.

Problem is with ur binding. For a table u can bind attributes of a node. U cannot add attributes of both parent and child node to a single table.

As u said, ur context is like this:

ParentNode

--> childNode -->childNodeAttr

--> parentNodeAttr

--> parent NodeAttr.

Here u can either bind the attributes of Parent Node or Child node to one single, u cannot bind all the attributes to single table. I think thats why u dropdown values are not populated.

U can try this. Dont create any child node. Create all the attributes in one single node and for the attribute to which u want dropdown follow the code suggested by nidhideep

Eg: ParentNode

--> att1 (Say for dropdown)

--> att2

IWDAttributeInfo attInfo = wdContext.getNodeInfo().getChild("ParentNode").getAttribute("att1");

ISimpleTypeModifiable st = attInfo.getSVServices().getModifiableSimpleValueSet();

for(int i = 0; i<5;i++){

st.put("Key", "Value");

}

bind this att1 attribute as dropdownByKey in ur table.

I guess this will work fine

Regards,

Aparna .Pulijala

Former Member
0 Kudos

hi

Aparna I will be explaining you with the example.

Suppose your Bapi node is z_Bapi_node and it has attribute dropdown which contains list of values.

Then

IWDAttributeInfo info = wdContext.getNodeInfo().getChild("Z_Bapi_node").getAttribute("dropdown");

ISimpleTypeModifiable st = info.getModifiableSimpleType(); IModifiableSimpleValueSet sv = st.getSVServices().getModifiableSimpleValueSet();

for(int i=0;i<Bapi_node;i++)

{

sv.put(wdContext.z_Bapi_node.currentelemenat(i).getdropdown,wdContext.z_Bapi_node.currentelemenat(i).getdropdown);

}

Hope it solve your probelm.

If not then send me your Node and attribute.

Regards

Nidhideep

Former Member
0 Kudos

Hi,

The proposed cardinality for parent node should be 1:n & for Child nodes it should be 0:1.

make it parent node and child node like this

and gothru this example do it as table cell.

http://help.sap.com/saphelp_nw04/helpdata/en/3d/1eef3d5e10af5ee10000000a114084/frameset.htm

IPrivate><view>.I<Dropdownnode>Element ele=wdContext.create<Dropdown>Element();

String val=wdContext.node<BapiOutputnode>.get<Output>ElementAt(j).get<Attribute>();

ele.set<Attribute>(val);

node.addElement(ele);

Thanks,

Lohi.

Message was edited by:

Lohitha M

Former Member
0 Kudos

Please refer to old postings

Regards, Anilkumar

Former Member
0 Kudos

Hi,

Consider following ContextStructure

Customer(ValueNode)

-


CustName(ValueAttrib)

-


Address(ValueNode)

-


Town(ValueAttrib)

Select ApplyTemplates ->Table-> In the wizard for town valueAttribute select DropdownByIndex

Regards, Anilkumar

Former Member
0 Kudos

Hi,

You can embed DropdownByIndex UIElement in one of the table columns and bind the "texts" property of the DropDownByIndex .

Regards, Anilkumar

Former Member
0 Kudos

Hi,

The table values are getting from R/3 side or u are doing generally.

If you getting the data from R/3 when insert the table template wizard binding with table node values and u may declared as Dropdown option available.

Othere wise post your issue.

Thanks,

Lohi.