Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tree UI element init. gives NullPointerException

I am new to WebDynPro.

I am working with Netweaver Studio version 2.0.14

I am trying to use a Tree UI element.

The tree element(context) has recursive node and 4 attributes. The UI element has been binded to context.

I have coded following init method to initialize the tree element.

IPrivateTreeCom1View.ITreeNodeElement nodeelement;

for(int i=0;i<2;i++)

{

nodeelement = wdContext.createTreeNodeElement();

nodeelement.setText("Node:");

nodeelement.setLevel(1);

nodeelement.setHasChildren(true);

nodeelement.setIgnoreAction(false);

wdContext.nodeTreeNode().addElement(nodeelement);

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

{

IPrivateTreeCom1View.ITreeNodeElement level2element = nodeelement.nodeChild().createTreeNodeElement();

level2element.setText("Level 2 element"+j);

level2element.setLevel(2);

level2element.setHasChildren(true);

nodeelement.nodeChild().addElement(level2element);

}

When I try to run the application it throws following exception

The initial exception that caused the request to fail, was:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TreeAdapter$Nodes.next(TreeAdapter.java:1326)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.renderTreeNodeFragment(TreeRenderer.java:2335)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.renderTreeFragment(TreeRenderer.java:673)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.render(TreeRenderer.java:69)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

... 44 more

Please help.

Suresh Yadav

Former Member
Not what you were looking for? View more on this topic or Ask a question