cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass data from modal node to value node

Former Member
0 Kudos

Dear All,

I have a modal table filled with the data from R/3 using BAPI. Now i hv created one more value table in the view which takes the data from modal table. But i'm getting exception..<b>java.lang.indexoutofbonds.exception, index1 size 1</b>

Pls suggest..

Regds,

Anup.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Anup ,

you can copy the data in the model node like this

for(int i=0; i<wdcontext.node<model node name>.size(); i++)

{

iprivate<yourviewname or yourcontrollername>.i<valuenodename>element ve = wdcontext.create<valuenode>element();

ve.set<attributename>(wdcontext.node<modelnodename>.getElementAt(i).get<Attribute name>();

// this way set all the coreesponding attributes of model node and vale node

wdcontext.node<valuenodename>.addElement(ve);

}

hope this code snippet will help you.

regards,

Rahul.

HuseyinBilgen
Active Contributor
0 Kudos

Hi,

When i apply your suggestion it work but displays only first row value as all rows value in target table.

For example if row(0) has value "TTT" target table rows filled with "TTT"

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Anup

Saves lot of headches if you base the value node with the same structure binding as of the model node you are copying from.

In which case you can use the <b>WDCopyService.copyElements</b> to copy from the source node to target node

Regards

Pran

Former Member
0 Kudos

Hi ,

Index out of bounds exception is because u are trying to access somethin which is not yet created.

Are u trying to copy data from model node to value node.

Did u check the size of the model node.Is data available in it ?

Have u created elements in the value node ?

Check these.If the error still persists..please elobarate on wat you have done.. along with code snippets if any.

Regards

Bharathwaj

Former Member
0 Kudos

Before accessing the model node check the size of the node i.e

if(wdContext.node<nodename>().size()>0){

//access the node

}