cancel
Showing results for 
Search instead for 
Did you mean: 

input table on BAPI

Former Member
0 Kudos

Hi all,

I have a problem when I call a BAPI parsing a input table.

Normaly, I can define a input using: on the Custom Controller.

Z_Bapi_Mov_Estoc_Input input2 = new Z_Bapi_Mov_Estoc_Input();

wdContext.nodeZ_Bapi_Mov_Estoc_Input().bind(input2);

input2.setParam1("test");

but this bapi have a input table.

How can I add this values?

I've try with this code, but no work's:

IPublicMagatzemListCust.IItemsElement newMaterialNodeElement;

newMaterialNodeElement = wdContext.createItemsElement(new Zdetalle());

wdContext.nodeItems().bind(newMaterialNodeElement);

newMaterialNodeElement.setMatnr("3233");

newMaterialNodeElement.setQuant(1);

the table is mapped using Items node.

Can anyone help me?

thanks in advance,

david

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I've another issue.

I implemented this code to build my table and parse to Bapi input:

Zdetalle tab = new Zdetalle();

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

tab.setMatnr(Items[1]<i>);

tab.setQuant(Integer.parseInt(Items[0]<i>));

}

input2.addItems(tab);

but, this tab only contain one row. How can I add the values incrementing the row number?

thanks in advance,

david

Former Member
0 Kudos

Hi David

Loop the above code n number times. ex:

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

{

Zdetalle tab = new Zdetalle();

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

tab.setMatnr(Items[1]);

tab.setQuant(Integer.parseInt(Items[0]));

}

input2.addItems(tab);

}

Kishore

Former Member
0 Kudos

Hi David

Thnks for the points. It would be really encouraging to other users if you can allocate points to the others who have contributed to you problem.

Regards

NagaKishore

Former Member
0 Kudos

Hi David,

The points must be given to Ravi.

Regards,

Santhosh.C

Answers (5)

Answers (5)

Former Member
0 Kudos

ok

thank's for all.

david

Former Member
0 Kudos

Great!

it work

Zdetalle tab = new Zdetalle();

tab.setMatnr("3233");

tab.setQuant(1);

input2.addItems(tab);

thanks in advance,

david

Former Member
0 Kudos

Hi David,

If it works, do allocate points to Ravi.

Regards,

Santhosh.C

Former Member
0 Kudos

Hi,

the "tab" object is not a AbstractList.

thanks in advance,

david

Former Member
0 Kudos

Hi,

My table name is "Items".

Is a subfolder of wdContext.nodeZ_Bapi_Mov_Estoc_Input.

On the Model definition, I see that exist a dictionary structure type called Zdetalle.

I can create a table using this structure:

zdetalle tab = new zdetalle();

but I cannot add this "tab" to my input Z_Bapi_Mov_Estoc_Input object.

If I try to add the "Items" on the Input object:

input.setItems( AbstractList )

and the Zdetalle is not an AbstractList.

thanks in advance,

david

Former Member
0 Kudos

Hi david

Just pass the tab name to it and it will accept it.

Just say

input2.setITEMS(tab);

it will work.

regards

ravi

Former Member
0 Kudos

Hi David

Well lets say the table name is "MYTAB"

Then what you need to do is in the model if you see you will get a Table class called "MYTAB"

//After your lines

Z_Bapi_Mov_Estoc_Input input2 = new Z_Bapi_Mov_Estoc_Input();

wdContext.nodeZ_Bapi_Mov_Estoc_Input().bind(input2);

input2.setParam1("test");

//code to add values to table

MYTAB tab = new MYTAB();

//Set table attributes

tab.set<attribute>();

tab.set<attribute1>();

now add the tab to the inp created

input2.setMYTAB(tab);

Hope that helps you. This will add the values to the table.

regards

ravi