cancel
Showing results for 
Search instead for 
Did you mean: 

fetch data to dropdown from backend

Former Member
0 Kudos

hello...

i m fetching data frm r/3 system...

but how to display this data in a drop down list.....

i refered so many links which explained by using creating a simple type n displaying data

here i dont hav any simple type. im using bapi to get data

could you please provide me code to display the data in drop dwn

thanks in advance

renu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Renu,

try the following:

ISimpleTypeModifiable attrType = wdThis.wdGetAPI().getContext().getModifiableTypeOf("Output.Flightlist.AirlineID");

IModifiableSimpleValueSet valueSet = attrType.getSVServices().getModifiableSimpleValueSet();

int size=wdContext.nodeFlight_List().size();

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

{

valueSet.put(i, wdContext.nodeFlight_List().getFlight_ListElementAt(i).getAirlineid());

}

Note that, in the first statement give the correct path of the Context Node. ("Output.Flightlist.AirlineID")

Try this and let me know.

--MLS

Former Member
0 Kudos

Hi Laxmi

I m getting below error when i follow the code which u provide

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(FlightList_View.Bapi_Flight_Getlist_Input.Output.Flight_List.Airlineid): must not modify the datatype of a mapped attribute

PradeepBondla
Active Contributor
0 Kudos

Hi renu,

to avoid such sort of problems, what I suggest is, populate all your model attribute data to value attribute (custom attribute) then display the DDBI or DDBK.

regards,

Pradeep

Former Member
0 Kudos

Hi Renu,

1. Instead of DropdownBykey UI element, Use dropdownbyIndex UI Element and bind the texts property to

"FlightList_View.Bapi_Flight_Getlist_Input.Output.Flight_List.Airlineid".

2. To get the selected dropdown value, use wdContext.currentOutputElement().getAirlineid();

Regards,

Laksh.

Former Member
0 Kudos

Hi

Here i m getting values in drop down list

when i select a value, i can able to see the value of the attribute which i select

i m having one talbe

if i select a value in the drop dwon list, corresponding values of dropdwn should display in a table.

how to display those values in a table

Former Member
0 Kudos

Hi Renu,

Is your table binded to nodeFlight_List(),then try this steps

1.String dropdownvalue = wdContext.currentFlight_ListElement().getAirlineid();

2.Create a for loop with the node size() of the table, i.e, for(int i=0;i>nodeFlight_List().size();i++)

3.Inside the for loop, check for the if condition(dropdownvalue.equals(wdContext.nodeFlight_List().getelementat(i).getAirlineid()). If the condition is false remove that elements.

Regards,

Lakshmanan.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Pls. try the Following.

1. Use adaptive RFC while creating a model...

2.the output node of flight_getlist_input to ur controller context..

3. map the same from controller to view.

4. execute the bapi and dont forget to invalidate the output node.

5. map the node u want to see to a table. chck if this is working..

6. next try it with deropdownby index UI...

Reward useful answer..

Yusuf

monalisa_biswal
Contributor
0 Kudos

There are two ways of using drop down

1)Dropdown by Key

Create an attribute under a node and bind the key property of the ui element to this attribute

IWDAttributeInfo attributeInfo =

wdContext.node<nodename>().getNodeInfo().getAttribute("<attributename>");

ISimpleTypeModifiable attrType = attributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet =

attrType.getSVServices().getModifiableSimpleValueSet();

//Iterate over your model node and populate valueset

int size=wdContext.node<ModelNode>().size();

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

valueSet.put(wdContext.node<ModelNode>().get<ModelNode>ElementAt(i).get<attr1>(),wdContext.node<ModelNode>().get<ModelNode>ElementAt(i).get<attr2>());

}

2)Dropdown by index

Bind text property of ui elemnt to one of the attributes under value node. The binded attribute's value will be shown as the text in dropdown. To access other attributes value you can use wdContext.current<modelnode>element().get<attributename>();

Former Member
0 Kudos

Hi

Here node is output

child node is flightlist

under chilnode haivng some attributes like, airlineid,airlinename etc..,

my code is like this

IWDAttributeInfo attributeInfo = wdContext.nodeFlight_List().getNodeInfo().getAttribute(Airlineid);here i m getting error airline id is not resolved

ISimpleTypeModifiable attrType = attributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet = attrType.getSVServices().getModifiableSimpleValueSet();

// Iterate over your model node and populate valueset

int size=wdContext.nodeFlight_List().size();

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

{

valueSet.put(wdContext.nodeFlight_List().getFlight_ListElementAt(i).getAirlineid(),

wdContext.nodeFlight_List().getFlight_ListElementAt(i).getAirlineid());

}

in valueSet.put()what i mentioned above is wrong.what should i mention above to get values?

regards,

Renu

Former Member
0 Kudos

Hi,

Take a dropdownbyIndex instead of DropdownByKey and bind the texts property to the airlineName or airlineNo attribute as per your requirement.

Regards,

Murtuza

Former Member
0 Kudos

Renushree,

use a dropdownbyIndex uielement and bind the attribute to the texts property of this element.

What is the structure of your bapi?

--MLS

Former Member
0 Kudos

present i m using bapi_flight_getlist

i dont knw its structure actually