Skip to Content

Accessing Dynamic nodes in WebDynpro

Recently by a query in SDN, was I introduced to this particular scenario of accessing a node dynamically in WebDynpro. The problem was that of getting a null pointer exception while execution. The topic might seem pretty simple; after all it is just a child’s game to create a node dynamically. So what is the big deal in accessing the dynamically created node. This was the impression the post gave me initially.

The scenario is as follows

NodeA(Statically created)
|______NodeAB(Dynamic singleton)
           |________NodeABC(Dynamic NonSingleton)
                      |________NodeABCD(Dynamic NonSingleton)

The problem was however that there was no element being created; and that it was not able to access the NodeABC with the following code.

IWDNode node = wdContext.nodeNodeA.getChildNode(“NodeAB”,IWDNode.LEAD_SELECTION).getChildNode(“NodeABC”,0);

This code returned a null value and the node.createElement() caused the exception.

So I felt that this piece of code might be useful for someone who might be having a tough time with creation and accessing nodes with dynamic programming.

IPrivateDynAppView.INodeAElement ele=wdContext.createNodeAElement(); wdContext.nodeNodeA().addElement(ele);
IWDNodeInfo salesOrgs = wdContext.nodeNodeA().getNodeInfo();
IWDNodeInfo salesOrg = salesOrgs.addChild(“NodeAB”,null,true,true,true,false,false,true,null,null,null);
IWDNodeInfo salesOrgElement = salesOrg.addChild(“NodeABC”,null,false,true,true,false,false,true,null,null,null);

IWDNode node=wdContext.nodeNodeA().getChildNode(“NodeAB”,IWDNode.LEAD_SELECTION);
IWDNodeElement elem=node.createElement();
IWDNode divNode=wdContext.nodeNodeA().getChildNode(“NodeAB”,IWDNode.LEAD_SELECTION).getChildNode(“NodeABC”,0);
IWDNodeElement element=divNode.createElement();

String text=wdContext.nodeNodeA().getChildNode(“NodeAB”,IWDNode.LEAD_SELECTION).getChildNode(“NodeABC”,0).getElementAt(0).getAttributeAsText(“AttbA”);

You must be Logged on to comment or reply to a post.
  • Hi

    When we try to create object to a WSDL from XI,it is asking for "array list parameter" in WebDynpro 7.0. Hence we are not able to solve the issue by following the way you have mentioned. Did u check the same in version 7.0 or your solution is for a specific version alone?..


    • I think the node to which you are trying to add is of cardinality 1..1 (non multiple). In this case you would not be able to add elements instead u can set or bind the instance.

      I worked on this in NW04 and haven't tried the Web Dynpro 7.0