cancel
Showing results for 
Search instead for 
Did you mean: 

How to select value from DropDownByKey?

Former Member
0 Kudos

Hi all,

In my application, I am using 2 Bapis. The first one just for displaying data with all material numbers. The second Bapi is for inserting the Sales data to database. Both of them have Material number. Now from the first Bapi, I displayed all the materials in a dropdown list. Now when i select one value from Dropdown list, and I fill some values for Sales data, then the data has to be stored in database along with the material number.I displayed the material number of first Bapi in my View and the remaining feilds of second (Sales)Bapi. How to do this?

Help is highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try this

IPrivate<ViewName>.I<Name>Node nodeCheck=wdContext.node<Name>();

int size=nodeCheck.size();

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

IPrivate<ViewName>.I<Name>Element elementCheck=nodeCheck.get<Name>ElementAt(i);

if(nodeCheck.isSelected(i)){

String role=elementCheck.getBestemdvoorId();

}

}

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

My requirement is like, I want to select the material number of first Bapi and pass (set)that to secong Bapi, which has also material number and I set some other feilds that belong to send Bapi and finally I will execute the Second Bapi, which will insert into database, with material number that i hav set and with other feilds that i have filled. Can you plz help me step-by-step.

Thanks a lot

Former Member
0 Kudos

Hi,

Step1:

//Input Tothe First BAPI

<Bapi>Input input1=new <Bapi>Input();

wdContext.node<BAPIInput>().bind(input);

input.set<Param>(wdContext.current<ContextName>Element.get<Param>());

Step2:

//Execute the First BAPI

Step3:

//Output Of the FirstBapi

int len=wdContext.node<BAPIList>().size();

Step4:

<Bapi2>Input input2=new <Bapi2>Input();

wdContext.node<BAPI2Input>().bind(input2);

//SecondBapi Input from First Bapi

for(int l=0;l<len;l++) {

String returndata=String.valueOf(((IPrivate<viewname>.I<BAPIList>Element)(wdContext.node<BAPIList>().getElementAt(l))).get<Parameter>());

input2.set<Param>(returndata);

}

//Do Other Input for Second Bapi

input2.set<Param>("Input");

//Execute the Second Bapi

//Output Of Second Bapi//Like Step4

//Execute the SQl

Kind Regards

Mukesh

Former Member
0 Kudos

Hi,

>>input.set<Param>(wdContext.current<ContextName>Element.<b>get<Param>());</b>

Here I shud get the getKey() but am not getting it. I am writting this code in CustController. But the Key is defined in View. If it is write in View, in which method i shud write. Plz suggest.

Thanks a lot

Former Member
0 Kudos

Hi,

1.You can create a node for the Bapi input in the Custom Controler.

2. Bind The Node to the View via the Component Controler

3. Bind the value in the view to the custom controler.

Kind Regards

Mukesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can value from attribute which is mapped to selectedKey property of drop down. Like:

wdContext.current<NodeContainigAttribyte>Element().get<AttributeMappedToSelectedKeyProperty>()

Kind Regards,

S.Saravanan.