on 11-23-2007 6:37 AM
Hi All,
I am creating the Value Node and Value Attribute at Runtime, but i am getting Error of nullpointerException.....
Following is the code Snipet:
public void wdDoInit()
{
//@@begin wdDoInit()
IWDNodeInfo rootnodeInfo = wdContext.getNodeInfo();
IWDNodeInfo soNodeInfo = rootnodeInfo.addChild(
"SalesOrders",
null,
true,
false,true,
false,false,
true,
null,
null,
null);
soNodeInfo.addAttribute("OrderNo","ddic:com.sap.dictionary.integer");
soNodeInfo.addAttribute("SalesDate","ddic:com.sap.dictionary.date");
soNodeInfo.addAttribute("SalesRep","ddic:com.sap.dictionary.string");
soNodeInfo.addAttribute("LongText","ddic:com.sap.dictionary.string");
IWDNode soNode = wdContext.getChildNode("SalesOrder",0);
IWDNodeElement soElement = soNode.createElement();
soElement.setAttributeValue("OrderNo",new Integer(100));
soElement.setAttributeValue("SalesDate",new Date(System.currentTimeMillis()));
soElement.setAttributeValue("SalesRep","Dhruv Shah");
soElement.setAttributeValue("Long Text","Printer Supplies");
soNode.addElement(soElement);
//@@end
}
public static void wdDoModifyView(IPrivateMainView wdThis, IPrivateMainView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if(firstTime)
{
IWDTransparentContainer rootElement = (IWDTransparentContainer) view.getRootElement();
rootElement.createLayout(IWDMatrixLayout.class);
IWDNodeInfo soNodeInfo = wdContext.getChildNode("SalesOrders", 0).getNodeInfo();
for(Iterator iter = soNodeInfo.iterateAttributes(); iter.hasNext();)
{
IWDAttributeInfo soAttrInfo = (IWDAttributeInfo)iter.next();
IWDLabel label = (IWDLabel)view.createElement(IWDLabel.class,soAttrInfo.getName() + "Label");
label.setText(soAttrInfo.getName());
label.createLayoutData(IWDMatrixHeadData.class);
label.setDesign(WDLabelDesign.LIGHT);
label.setLabelFor(soAttrInfo.getName()+ "Input");
rootElement.addChild(label);
IWDInputField ioField = (IWDInputField) view.createElement(IWDInputField.class,soAttrInfo.getName()+"Input");
ioField.createLayoutData(IWDMatrixData.class);
ioField.bindValue(soAttrInfo);
rootElement.addChild(ioField);
}
}
//@@end
}
So can anybody help me out......
Regards,
Dhruv Shah
Hi,
before this IWDNodeElement soElement = soNode.createElement(); line
check soNode is null
Pl post the entire stack.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.