Skip to Content
avatar image
Former Member

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

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) {

}

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 05, 2004 at 06:20 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 05, 2004 at 06:14 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded