cancel
Showing results for 
Search instead for 
Did you mean: 

Passing multiple values from table to BAPI

Former Member
0 Kudos

In my scenerio i have to pass some rows from table to bapi as input to create Sales order.I have to pass material number and quantity to BApi.

i am doing the following way but it is creating order but material Number and Quantity is not storing in backend.

Bapiitemin item = new Bapiitemin();

AbstractList Itemin = new Bapiitemin.Bapiitemin_List();

for(int i=0;i<wdContext.nodeVn_TablePop().size();i++)

{

item.setMaterial(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVa_MaterialName());

Itemin.add(item);

}

Bapiitemin item1 = new Bapiitemin();

AbstractList Itemin1 = new Bapiitemin.Bapiitemin_List();

for(int i=0;i<wdContext.nodeVn_TablePop().size();i++)

{

item1.setReq_Qty(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVA_ReqQuantity());

Itemin1.add(item1);

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi saifee,

Follow the below codeing. try to minimize looping

Bapiitemin item = new Bapiitemin();

for(int i=0;i<wdContext.nodeVn_TablePop().size();i++)

{

Bapiitemin_List listitem = new Bapiitemin_List();

listitem.setMaterial(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVa_MaterialName());

item1.setReq_Qty(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVA_ReqQuantity());

listitem.add(listitem);

}

wdContext.node<yourbapi node name>.bind(item);

item.execute();

wdContext.node<your bapi output node>.invalidate();

regards,

sukanta

Answers (2)

Answers (2)

Former Member
0 Kudos

the problem got resolved with the soln help.

former_member197348
Active Contributor
0 Kudos

Hi,

It is not clear in your question where the problem is unless you provide more details about context structure and properties. But I guess, if you set entire structure in one place it can help you. Try like this:

Bapiitemin item = new Bapiitemin();

for(int i=0;i<wdContext.nodeVn_TablePop().size();i++)
{
AbstractList Itemin = new Bapiitemin.Bapiitemin_List();
item.setMaterial(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVa_MaterialName());
item.setReq_Qty(wdContext.nodeVn_TablePop().getVn_TablePopElementAt(i).getVA_ReqQuantity());
Itemin.add(item);
}

Regards,

Siva`