cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically creating table.

Former Member
0 Kudos

Hi

I wrote the following code for dynamically creating the table but i m fetting error:The initial exception that caused the request to fail, was:

java.lang.NullPointerException

at com.mphasis.app.EstimateappsView.wdDoModifyView(EstimateappsView.java:467)

at com.mphasis.app.wdp.InternalEstimateappsView.wdDoModifyView(InternalEstimateappsView.java:792)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)

at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:337)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:481)

My code is :

boolean b,cb1,cb2,cb3,cb4,cb5;

int x;

b=wdThis.wdGetEstimateappsController().wdGetContext().currentContextElement().getClickPopupCreateButton2();

cb1=wdThis.wdGetEstimateappsController().wdGetContext().currentVn_checkboxElement().getVa_checkbox_portalcust();

//cb2=wdThis.wdGetProjectAppController().wdGetContext().currentVnCheckboxesElement().getVaCB2();

//cb3=wdThis.wdGetProjectAppController().wdGetContext().currentVnCheckboxesElement().getVaCB3();

//cb4=wdThis.wdGetProjectAppController().wdGetContext().currentVnCheckboxesElement().getVaCB4();

//cb5=wdThis.wdGetProjectAppController().wdGetContext().currentVnCheckboxesElement().getVaCB5();

x=wdThis.wdGetEstimateappsController().wdGetContext().currentVn_inputfieldElement().getVa_portalc();

//||cb2==true||cb3==true||cb4==true||cb5==true

//if(wdContext.currentContextElement().getVASelectedTab()!=null && wdContext.currentContextElement().getVASelectedTab().equalsIgnoreCase("Guide_Create_New_Objects"))

{

if(b==true)

{

if(cb1==true)

{

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

{

IWDTransparentContainer container =(IWDTransparentContainer) view.getElement("TransparentContainer13");

IWDCaption h1=(IWDCaption)view.createElement(IWDCaption.class,"Phase"+i);

h1.setText("Phase");

IWDCaption h2=(IWDCaption)view.createElement(IWDCaption.class,"Topic"+i);

h2.setText("Topic");

IWDCaption h3=(IWDCaption)view.createElement(IWDCaption.class,"Sub-Topic"+i);

h3.setText("Sub-Topic");

IWDCaption h4=(IWDCaption)view.createElement(IWDCaption.class,"Quantity"+i);

h4.setText("Quantity");

IWDCaption h5=(IWDCaption)view.createElement(IWDCaption.class,"Complexity"+i);

h5.setText("Complexity");

WDCaption h6=(IWDCaption)view.createElement(IWDCaption.class,"CP"+i);

h6.setText("CP");

IWDCaption h7=(IWDCaption)view.createElement(IWDCaption.class,"PhaseTotals"+i);

h7.setText("PhaseTotals");

IWDTextView editor =(IWDTextView) view.createElement(IWDTextView.class,"PhaseColumnEditor"+i);

editor.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCphase");

IWDTextView editor1 =(IWDTextView) view.createElement(IWDTextView.class,"TopicColumnEditor"+i);

editor1.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCtopic");

IWDTextView editor2 =(IWDTextView) view.createElement(IWDTextView.class,"Sub-TopicColumnEditor"+i);

editor2.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCsubtopic");

IWDTextView editor3 =(IWDTextView) view.createElement(IWDTextView.class,"QuantityColumnEditor"+i);

editor3.bindText("Vn_changeexistingpopupPC.va_changeexistingupPCquantity");

IWDTextView editor4=(IWDTextView)view.createElement(IWDTextView.class,"abcd" ""i);

editor4.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCcomplexity");

IWDTextView editor5 =(IWDTextView) view.createElement(IWDTextView.class,"CPColumnEditor"+i);

editor5.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCcp");

IWDTextView editor6 =(IWDTextView) view.createElement(IWDTextView.class,"PhaseTotalsColumnEditor"+i);

editor6.bindText("Vn_changeexistingpopupPC.va_changeexistingpopupPCphasetotals");

IWDTableColumn column =(IWDTableColumn) view.createElement(IWDTableColumn.class,"PhaseColumn"+i);

column.setHeader(h1);

column.setTableCellEditor(editor);

IWDTableColumn column1 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"TopicColumn"+i);

column1.setHeader(h2);

column1.setTableCellEditor(editor1);

IWDTableColumn column2 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"Sub-TopicColumn"+i);

column2.setHeader(h3);

column2.setTableCellEditor(editor2);

IWDTableColumn column3 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"QuantityColumn"+i);

column3.setHeader(h4);

column3.setTableCellEditor(editor3);

column3.setWidth("50");

IWDTableColumn column4 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"ComplexityColumn"+i);

column4.setHeader(h5);

column4.setTableCellEditor(editor4);

column4.setWidth("60");

IWDTableColumn column5 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"CPColumn"+i);

column5.setHeader(h6);

column5.setTableCellEditor(editor5);

column5.setWidth("50");

IWDTableColumn column6 =(IWDTableColumn) view.createElement(IWDTableColumn.class,"PhaseTotalsColumn"+i);

column6.setHeader(h7);

column6.setTableCellEditor(editor6);

column6.setWidth("70");

IWDTable tablePC =(IWDTable) view.createElement(IWDTable.class, "Portal_Customizatns"+i);

tablePC.bindDataSource("Vn_changeexistingpopupPC");

tablePC.addColumn(column);

tablePC.addColumn(column1);

tablePC.addColumn(column2);

tablePC.addColumn(column3);

tablePC.addColumn(column4);

tablePC.addColumn(column5);

tablePC.addColumn(column6);

container.addChild(tablePC);

tablePC.setFooterVisible(false);

tablePC.setVisibleRowCount(3);

tablePC.setRowSelectable(false);

}

}

}

// //wdThis.wdGetEstimateappsController().Reset();

}

wdThis.wdGetEstimateappsController().wdGetContext().currentContextElement().setClickPopupCreateButton2(false);

How thsi error can be removed.

Edited by: saurabh.c on Dec 15, 2010 2:31 PM

Edited by: saurabh.c on Dec 15, 2010 2:31 PM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Saurabh,

It seems that you have written a code in wdModifyview which is doing set or get operation.

if(wdContext.nodexxxx() !=null)

Please write your current code inside this if condition stating your node name instead of xxxx and you may not get this error.

Regards,

Vivek

former_member185879
Active Contributor
0 Kudos

Hello Saurabh,

Please format it and also tell us what is the code available in line no.467!

Regards

Nizamudeen SM

Former Member
0 Kudos

Hi ,

It seems you are trying to access some value which is null (for example you dont set the value of boolean b - context value attribute so it is null , you can set the initial value of the value attribute to false). When you compare a null value with true or false runtime error will come.

suggest you to debug your code line by line and you will find out the error urself.

Regards

Deepak

Former Member
0 Kudos

Use "code" tags to format your code and mark the line where the exception occurs.