cancel
Showing results for 
Search instead for 
Did you mean: 

How can you iterate through the values of a bapi node?

Former Member
0 Kudos

i try to process the values getting from a bapi call. but the iterator i get is always empty. Neither "it" nor "it1" has any values.

Any ideas?

Regards Jens

try {

wdContext

.currentIsa_Read_Catalog_Complete_InputElement()

.modelObject()

.execute();

Iterator it = wdThis.wdGetContext().nodeIsa_Read_Catalog_Complete_Input().nodeOutput().nodeItems().iterateChildNodes();

Iterator it1= wdThis.wdGetContext().nodeIsa_Read_Catalog_Complete_Input().nodeOutput().nodeItems().getNodeInfo().iterateChildren();

while (it.hasNext()) {

IItemsNode node = (IItemsNode) it.next();

}

wdContext.nodeOutput().invalidate();

} catch (Exception e) {

}

Accepted Solutions (1)

Accepted Solutions (1)

sid-desh
Advisor
Advisor
0 Kudos

Hi Jens,

Incase you want to loop the elements of the node to get the values in attributes you can do in the following manner.

<i>for(int i = 0; i < wdContext.node<Name of the node>().size(); i++){

wdContext.node<Name of the node>().moveTo(i);

wdContext.current<Name of the Node>Element().get<Attribute Name>();

}</i>

Hope this helps.

Regards

Sidharth

Former Member
0 Kudos

Thank you for your answer. Now it works.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jens,

after "navigating" to the items node, you can loop through the elements of the node like:


for(int ix = 0; ix < wdContext.nodeX().nodeY().nodeItems().size(); ix++) {
  IXElement element = wdContext.nodeX().nodeY().nodeItems().getXElementAt(ix);
  /** Do something with the element */
}

Hope that helps.

Regards

Stefan

PS.: wdThis.wdGetContext() is exactly the same as the predefined instance member wdContext.