on 08-15-2007 1:19 PM
Hi Experts,
I am getting following error message:
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.sap.aii.proxy.framework.core.JcoBaseList.get(JcoBaseList.java:268)
at com.sap.aii.proxy.framework.core.AbstractList.get(AbstractList.java:230)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCList.get(DynamicRFCList.java:281)
... 35 more
Detailed Error Information
Detailed Exception Chain
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.sap.aii.proxy.framework.core.JcoBaseList.get(JcoBaseList.java:268)
at com.sap.aii.proxy.framework.core.AbstractList.get(AbstractList.java:230)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCList.get(DynamicRFCList.java:281)
at com.sap.tc.webdynpro.progmodel.context.Node$ModelElementList.getElement(Node.java:2549)
at com.sap.tc.webdynpro.progmodel.context.Node$MappedElementList.getElement(Node.java:2399)
at com.sap.tc.webdynpro.progmodel.context.Node.getElementAtInternal(Node.java:621)
at com.sap.tc.webdynpro.progmodel.context.Node.getElementAt(Node.java:628)
at com.sastech.app.models.TimesheetView.onActionFindRecord(TimesheetView.java:196)
at com.sastech.app.models.wdp.InternalTimesheetView.wdInvokeEventHandler(InternalTimesheetView.java:365)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Can you please help me in resolving the issue? The code which is causing the above error is as below:
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
for (int i=1 ; i<=wdContext.currentWorklistElement().node().size() ; i++){
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.nodeWorklist().getElementAt(i).getAttributeAsText("Reciever_Wbs_Element");
categoryElement.setCategoryText(wdContext.currentWorklistElement().getReciever_Wbs_Element() );
categoryElement.setSeries1Value(8);
categoryElement.setSeries2Value(2);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
}
Regards,
S
Hi Experts,
Further to the above message, please note that follwoing line is causing the error:
wbs = wdContext.nodeWorklist().getElementAt(i).getAttributeAsText("Reciever_Wbs_Element");
Can you please help me?
Regards,
S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is other way of doing same thing, this might be helpful.
replace your old code with this:
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
for (int i=0 ; i<wdContext.nodeWorklist.size() ; i++){
wdContext.nodeWorkList().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(8);
categoryElement.setSeries2Value(2);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
}
Regards
Abhilash
Thanks Abhilash,
The issue got resolved. Now I am facing another issue. I have further modified the code. The new code is as below.
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
double num1 = 0;
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
num1 = wdContext.currentWorklistElement().getDay1();
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(8);
categoryElement.setSeries2Value(2);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
}
Following line is causing the problem:
num1 = wdContext.currentWorklistElement().getDay1();
The error is "Type Mismatch: Can not convert from string to double."
Is there is any workaround to resolve the issue?
In R/3 datatype of Day1 is String. However in the front end I am using double for num1. I can not use any other datatype in front end as it is needed for displaying the graph.
I tried using following
num1 = (double) wdContext.currentWorklistElement().getDay1();
However I am getting following error.
Can not cast from String to double.
Can you please help me?
Regards,
S
Hi,
I am using following code:
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
double d ;
String Day1 =" ";
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
Day1 = wdContext.currentWorklistElement().getDay1();
d = Double.parseDouble(Day1) ;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
categoryElement.setSeries2Value(2);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
The issue has got resolved. However, now I am getting following error:
java.lang.NumberFormatException: empty String
Can you please help me in resolving the issue?
Regards,
S
Hi,
The new code is
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
double d =0;
String Day1 ="";
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
Day1 = wdContext.currentWorklistElement().getDay1();
if(""!=Day1 && null!=Day1)
d = Double.parseDouble(Day1) ;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
categoryElement.setSeries2Value(2);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
However I am still getting following error.
java.lang.NumberFormatException: empty String
Can you please help me?
Regards,
S
Hi,
Define following funtion to validate.
public boolean isNumber(String strNum)
{
String strValidChars = "0123456789.";
boolean blnNumber=true;
char chrNum;
for (int i = 0; i < strNum.length() && blnNumber == true; i++)
{
chrNum = strNum.charAt(i);
if ((i == 0) && (chrNum == '-')) // check first character for minus sign
continue;
if (strValidChars.indexOf(chrNum) == -1)
{
blnNumber = false;
}
}
return blnNumber;
}
Add this condition in if as
if(null != Day1 && isNumber(Day1))
d= Double.parseDouble(Day1);
Let me know is there is any problem
Hi Abhilash,
Thanks. The code is working fine. Now, I am facing another problem. In back end certain data (sum_hrs) is stored as String. The values are like 7,00. This 7,00 has be converted into 7.00. How we can do it?
The code is as below. I tried using replace function. However it is not working.
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
double d =0;
String sum_hrs ="";
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
sum_hrs = sum_hrs.replace(",",".");
if( sum_hrs != null && sum_hrs.trim().length()>0)
d = Double.parseDouble(sum_hrs) ;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
The error message is
java.lang.NoSuchMethodError: java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
Can you please help me?
Regards,
S
Hi Abhilash,
Thanks. The code is working fine. Now, I am facing another problem. In back end certain data (sum_hrs) is stored as String. The values are like 7,00. This 7,00 has be converted into 7.00. How we can do it?
The code is as below. I tried using replace function. However it is not working.
IPrivateTimesheetView.ICategoriesElement categoryElement;
String wbs ="h";
double d =0;
String sum_hrs ="";
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
sum_hrs = sum_hrs.replace(",",".");
if( sum_hrs != null && sum_hrs.trim().length()>0)
d = Double.parseDouble(sum_hrs) ;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
wdContext.nodeCategories().addElement(categoryElement);
wbs = "";
The error message is
java.lang.NoSuchMethodError: java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
at com.sastech.app.models.TimesheetView.onActionFindRecord(TimesheetView.java:253)
at com.sastech.app.models.wdp.InternalTimesheetView.wdInvokeEventHandler(InternalTimesheetView.java:365)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
... 26 more
Can you please help me?
Regards,
S
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.