cancel
Showing results for 
Search instead for 
Did you mean: 

populating dropdownbyvalue with the r/3 value?

Former Member
0 Kudos

hi

I am accessing Bapi_currency_getlist;

in my component controller wdInit() my code is:

Bapi_Currency_Getlist_Input input = new Bapi_Currency_Getlist_Input();

wdContext.nodeBapi_Currency_Getlist_Input().bind(input);

in my executebapi()method i wrote:

try {

wdContext.currentBapi_Currency_Getlist_InputElement().modelObject().execute();

wdContext.nodeBapi_Currency_Getlist_Output().invalidate();

} catch (WDDynamicRFCExecuteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

In my view i created a dropdownby value UI element and also made a context value node lis_currency with attribute currency(do i ahve to make some simple type also and bind it)in my wdInit of view i have written this code:

//IPrivateListBoxAppView.IContextElement contextelement = wdContext.currentLis_currencyElement();

//IWDNodeInfo dateattributeinfo = wdContext.getNodeInfo();

//IWDAttributeInfo attributeinfo =dateattributeinfo.getAttribute();

//IModifiableSimpleValueSet dropValueset = attributeinfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

//IPrivateListBoxAppView.ICurrency_ListNode node1 = wdContext.nodeCurrency_List();

//IPrivateListBoxAppView.ILis_currencyNode node = wdContext.nodeLis_currency();

//int nodelength = node1.size();

//String a = nodelength+"";

// String empcodetxt=null;

// IWDMessageManager msmgr = null;

//msmgr.reportSuccess(a);

//for(int i=0;i<nodelength ;i++){

//empcodetxt = String.valueOf(((IPrivateListBoxAppView.ICurrency_ListElement)(wdContext.nodeCurrency_List().getElementAt(i))).getCurrency());

//msmgr.reportSuccess(empcodetxt);

//IPrivateListBoxAppView.ILis_currencyElement element = wdContext.createLis_currencyElement();

//dropValueset.put(empcodetxt,empcodetxt);

but havent got the result please guide me.Do i have to make some simple type also?am i executing bapi properly becuase there is no input parameter to this bapi?Please provide the code of custom controller also if some one has used this bapi for practise?

thank u in advace

regards

Nidhideep

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Hi Nidhideep,

For your first Question -

Do i ahve to make some simple type also and bind it - Simple type is needed, when you want to show static values. If you want show Dynamic values, your approach is correct.

Second Question- Result is not showing.

Check with the Currency_List Size. If size is zero, than data is not coming from BackEnd.

wdContext.nodeCurrency_List().size();

Print above statement just before for loop.

Regards,

Sridhar

Former Member
0 Kudos

hi

Sridhar instead of currency bapi ,i am now taking flightlist bapi and want to getting airlineid in my dropdownbykey,my code at wdinit method of view is:

(line 149)IWDNodeInfo nodeinfo=wdContext.getNodeInfo();

(line 150) IWDAttributeInfo attributeinfo = nodeinfo.getAttribute("data");

(line 151) IModifiableSimpleValueSet valueset=attributeinfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

IPrivateResultView.IDropdownNode node=wdContext.nodeDropdown();

node.invalidate();

IPrivateResultView.IFlight_ListNode node1 = wdContext.nodeFlight_List();

int nodelength=node1.size();

String empcodetxt=null;

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

IPrivateResultView.IDropdownElement ele = wdContext.createDropdownElement();

line 160 empcodetxt=String.valueOf(((IPrivateResultView.IFlight_ListElement)(wdContext.nodeFlight_List().getElementAt(i))).getAirlineid());

ele.setData(empcodetxt);

node.addElement(ele);

i am getting a null pointer exception at error at line 151 (i have marked that line above in my code).when i check the hiararchy of my class IModifiableSimpleValueSet ,i am getting statement .source attachement doesnot contain the source for IModifiableSimpleValueSet .class.When i check the source attachement it is IModifiableSimpleValueSet .jar.what does it mean ?and what should i do now?i am not getting what actaully is the purpose of line 149 and 150,i have made value node in my context of view called as dropdown with attribute data(what is the use of it)?Please explain me?in line 160 above String.valueof(what data type should it be )?

please help me

regards

Nidhideep

sridhar_k2
Active Contributor
0 Kudos

Hi,

If you are getting error at that line, probably check with context element in 150 line.

IContextElement context = wdContext.currentContextElement();

IWDAttributeInfo attributeinfo = wdContext.getNodeInfo().getAttribute(context.DATA);

In 149 and 150 you are getting the element(data) Info which is binded to the drop down.

In 160 line, you are converting the data to String, coz, ele.setData(String) - accepts String. It wont accept other Types.

Regards,

Sridhar

Regards,

Sridhar

Former Member
0 Kudos

hi

i have solved the problem ,thanks for so much support.

Regards

Nidhideep

Answers (5)

Answers (5)

saraswathi_d
Participant
0 Kudos

Hi,

Refer these links

See this link for when to use DropDownByIndex (DDI) vs DDK (DropDownByKey) and how populate data from R/3.

Regards,

Saraswathi

Former Member
0 Kudos

Hi

See this Thread

/message/2187817#2187817 [original link is broken]

Kind Regards

Mukesh

Former Member
0 Kudos

hi,

find the node size

size = wdcontext.current<node>.size();

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

IPrivate<ApplicationView>.I<nodeElement val =(IPrivate<ApplicationView>.I<nodeElement>) wdContext.node<nodeName(outputnode)>().getElementAt(idx);

declare data type currency = val.getcurrency();

val.setName1(currency );

}

And declare the dropdownbykey in ur design and text will be mapped with the Name1 of node another element with same data type.

This might helps

Thanks

Lohi.

Former Member
0 Kudos

Hi,

After executing the Bapi u r invalidating it. Remove the

wdContext.nodeBapi_Currency_Getlist_Output().invalidate(); line and paste it before

Bapi_Currency_Getlist_Input input = new Bapi_Currency_Getlist_Input();

After executind the Bapi try to print the return node size and see, so that u might check if the bapi returns u some data.

U can use a dropdown by index ui element and try the following code.

Iprivate<view>.I<ContextnodeElement> ele;

for(int i=0;i<wdContext.node<bapi>.size;i++)

{

ele = wdcontext.create<ContextnodeElement>();

//Set the values to the context att bound to the drop down box.

ele.set<attName>(wdcontext.node<Bapi>.get<Bapielement>(i).get<attName>);

wdContext.<Contextnode>.addElement(ele);

}

Hope it helps,

Regards,

Nagarajan.

Former Member
0 Kudos

Hi,

Print the output of the bapi and ensure there is output

and using any loop u can assign this to the drop down

like

First calculate the size of the BAPI's outputnode say size

IPrivate<view>.I<Dropdownnode>node node=wdContext.node<Dropdownnode>

node.invalidate();

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

{

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);

}

Regards,

Saravanan K