on 04-30-2008 6:52 PM
Hi,
I am trying to implement utility class(Calculating total for 1 column) in my application.
I have 2 views and one custom controller.
1) TableUtilities.java class imported to src/packages.
2) Created a value attribute say tableutility in ResultView Context ,and assigned the properties of the attribute type Java Native Type "TableUtilities".
Do I need to create anything other than this?.
Below code is added to the ResultView wdDoModifyView
-
if(firstTime) {
IWDTextView tv = (IWDTextView)view.getElement("total");
wdContext.currentContextElement().setTableutility(new TableUtilities(wdContext.nodeDepartments()));
//Returns attribute info of a dynamically created attribute which can be bound to the UI element need.
tv.bindText(wdContext.currentContextElement().getTableutility().CalculateSum("Departments","NoOfPeople"));
}
If I implement this code in my Resultview wdDoModifyView, it is throwing run time errors.........
.at sd.salesorderslist.SalesResultView.wdDoModifyView(SalesResultView.java:146)
at sd.salesorderslist.wdp.InternalSalesResultView.wdDoModifyView(InternalSalesResultView.java:301)
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)
Please advice.
jai,
1. you need to put correct package for TableUtilities.java once you place it to src folder.
replace first line
package .........*; with your package
2. Make sure that "Departments" is your node "NoOfPeople" is the column for that you need to calculate sum are existing.
nikhiL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is my code.....
if(firstTime) {
IWDTextView tv = (IWDTextView)view.getElement("total");
wdContext.currentContextElement().setTableutility(new TableUtilities(wdContext.nodeSales_Orders()));
tv.bindText(wdContext.currentContextElement().getTableutility().CalculateSum("Sales_Orders","Req_Qt"));
Hope those 2 are correct......, I am not getting build time errors, I am getting runtime errors..
Only above part of code and tableutility context variable created in ResultView.
Do I need to create any text view to show this total or runtime it will create the textview?.
Hi Nikil,
I have created the Java class, calculating sum is working fine. For export to Excel I have created context element(Excelfile) and LinkToURL(url).
If there is any mistake, can you please correct this code,....
public void wdDoInit()
{
//@@begin wdDoInit()
ArrayList al = new ArrayList();
al.add(IPrivateResults.ISalesOrdersElement.MATERIAL);
al.add(IPrivateResults.ISalesOrdersElement.REQ__QTY);
wdContext.currentContextElement().setExcelfile((String)wdContext.currentContextElement().getTableutility().DownloadToExcel(al).get("url"));
//@@end
}
I am getting follwoing error...
-
java.lang.NullPointerException
at .sd.salesorderslist.Results.wdDoInit(Results.java:106)
at .sd.salesorderslist.wdp.InternalResults.wdDoInit(InternalResults.java:171)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
-
Thanks in advance,
Hi,
I did some debugging(Commented the complete functionality in Java Utility and tried, just to induct error is from java utility class or farm my program)...
I figured out that, when I call the method it is thorwing exception....
ArrayList al = new ArrayList();
al.add(IPrivateResult.ISalesOrdersElement.MATERIAL);
al.add(IPrivateResult.ISalesOrdersElement.REQ__QTY);
Map m = wdContext.currentContextElement().getTableutility().DownloadToExcel(al);
java.lang.NullPointerException
at .componenets.Result.wdDoInit(Result.java:111)
at .componenets.wdp.InternalResult.wdDoInit(InternalResult.java:124)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
Doing anything wrong in the Arrylist?...Please advice..this is bit urgent!!!.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.