on 04-08-2009 11:23 AM
Hi Experts,
I am using one RFC to show data in one of my screens. There was some change in the RFC structure due to shich I re created another model and imported this RFC into it and binded this to the screen UI 's now, but as I have moved the changed development to Quality Server it's showing an error like:
java.lang.ArrayIndexOutOfBoundsException: -1
Following is the code that I am using:
public void onPlugfromSearch_eCofc(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String Number, java.sql.Date eCofC_Creation_Date )
{
//@@begin onPlugfromSearch_eCofc(ServerEvent)
IWDAttributeInfo attribinfo= null;
ISimpleTypeModifiable simpleTypeModifiable = null;
wdContext.currentVn_GlobalLotNoToDelElement().setVa_GlobalLotNoToDel(eCofCLotNumber.trim());
pwc.ca.viewmod.model.Z_Esrce_Disp_Inspn_Lot_Input input = new pwc.ca.viewmod.model.Z_Esrce_Disp_Inspn_Lot_Input();
wdContext.nodeZ_Esrce_Disp_Inspn_Lot_Input().bind(input);
try
{
wdContext.currentZ_Esrce_Disp_Inspn_Lot_InputElement().setP_Prueflos(Number.trim());
input.execute();
wdContext.nodeOutput().invalidate();
String matLoc = "";
for(int i=1;i<wdContext.nodeP_K_Matloc().size();i++)
{
matLoc = matLoc+wdContext.nodeP_K_Matloc().getP_K_MatlocElementAt(i).getTdline() +"\n";
}
wdContext.currentVn_MaterialLocationElement().setVa_MatLoc(matLoc);
attribinfo = wdContext.getNodeInfo().getChild("vn_GlobalLotNoToDel").getAttribute("va_DateFromSearch");
simpleTypeModifiable = attribinfo.getModifiableSimpleType();
simpleTypeModifiable.setFormat("yyyy.MM.dd");
wdContext.currentVn_GlobalLotNoToDelElement().setVa_DateFromSearch(eCofC_Creation_Date);
}
catch (WDDynamicRFCExecuteException e)
{
wdComponentAPI.getMessageManager().reportException("Error in executing RFC "+e.getMessage(),false);
}
//@@end
}
My RFC Sturcture is:
Z_Esrce_Disp_Inspn_Lot_Input
Output
P_K_Display
inside am having my attribs for data
It's working okay in Development Server... But not in Quality :-(.
Will be grateful if someone can suggest me where am I going wrong??
Helpful answers will be appreciated.
Thanks in advance.
Regards,
Gaurav Bhardwaj
Hi,
Issue resolved by restarting the Quality Server. No changes in code made. It seems there was some memory leak due to which the cache was not getting cleared properly.
Thanks for all your time.
Regards,
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gaurab,,
I think all most currect in your code...
just few line i have correction....
public void onPlugfromSearch_eCofc(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String Number, java.sql.Date eCofC_Creation_Date )
{
//@@begin onPlugfromSearch_eCofc(ServerEvent)
IWDAttributeInfo attribinfo= null;
ISimpleTypeModifiable simpleTypeModifiable = null;
wdContext.currentVn_GlobalLotNoToDelElement().setVa_GlobalLotNoToDel(eCofCLotNumber.trim());
pwc.ca.viewmod.model.Z_Esrce_Disp_Inspn_Lot_Input input = new pwc.ca.viewmod.model.Z_Esrce_Disp_Inspn_Lot_Input();
wdContext.nodeZ_Esrce_Disp_Inspn_Lot_Input().bind(input);
try
{
// wdContext.currentZ_Esrce_Disp_Inspn_Lot_InputElement().setP_Prueflos(Number.trim());
input.setP_Prueflo(Number.trim());
wdContext.currentZ_Esrce_Disp_Inspn_Lot_Input().modelobject().excute();
wdContext.nodeOutput().invalidate();
String matLoc = "";
for(int i=1;i<wdContext.nodeP_K_Matloc().size();i++)
{
matLoc = matLoc+wdContext.nodeP_K_Matloc().getP_K_MatlocElementAt(i).getTdline() +"\n";
}
wdContext.currentVn_MaterialLocationElement().setVa_MatLoc(matLoc);
attribinfo = wdContext.getNodeInfo().getChild("vn_GlobalLotNoToDel").getAttribute("va_DateFromSearch");
simpleTypeModifiable = attribinfo.getModifiableSimpleType();
simpleTypeModifiable.setFormat("yyyy.MM.dd");
wdContext.currentVn_GlobalLotNoToDelElement().setVa_DateFromSearch(eCofC_Creation_Date);
}
catch (WDDynamicRFCExecuteException e)
{
wdComponentAPI.getMessageManager().reportException("Error in executing RFC "+e.getMessage(),false);
}
//@@end
}
thanks
jati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for your quick replies. Is that all am I doing wrong?? Whatever corrections mentioned here may stop this exception. I mean is the mistake in code is leading me to this error. As I mentioned before it's working perfectly in Development Environment, but not in Quality.
If I made these changes I won't get this error: java.lang.ArrayIndexOutOfBoundsException: -1 any more???
A quick response will be appreciated.
Thanks & Regards,
Gaurav
Hi,
The problem is not with environment. It is with data.
May be in Development environment you are getting enough records, that is why you are not getting any exception. And in QA you are not getting enough records.
The actual problem is at the below line ...
nodeP_K_Matloc().getP_K_MatlocElementAt(i).
Suppose if the node size is 5 then the elements of the node are node.getElementAt(0), node.getElementAt(1), node.getElementAt(2), node.getElementAt(3)and node.getElementAt(4). So your for loop should be for(int i=0;i<node.size();i++).
But the for loop which you wrote was for(int i=1;i<node.size();i++). And it works fine when there is data.
But if there is only one record the element can be accessed only by nodeP_K_Matloc().getP_K_MatlocElementAt(0) and nodeP_K_Matloc().getP_K_MatlocElementAt(1) is invalid since it is trying to access 2nd element.
Hope this clarifies!!!
Thanks & Regards,
JayaRam.
Hi JayaRam,
You are very much clear to me now... and I don mind doing whatever change u said. But would liek to mention the following:
1. The error is not from the node where this field is initialized at 1, as this filed was okay in Quality server also with the same piece of code.
2. We request a cache clearing and the previous error is now replaced with:
Detailed Error Information
Detailed Exception Chain
java.lang.ArrayIndexOutOfBoundsException: ArrayIndexOutOfBoundsException
with no stack trace further.
Am unable to proceed further. Kindly suggest what may be the issue.
Regards,
Gaurav
Hi Gaurav,
The problem is at the below line only because ArrayIndexBoundException comes only when you are trying to access array element which is not present.
matLoc = matLoc+wdContext.nodeP_K_Matloc().getP_K_MatlocElementAt(i).getTdline() +"\n";
In your code you are dealing with arrays only at the above line.
To confirm this, can you execute the ABAP function module directly and see how many records you are getting. If you are getting less than or equal to 1 records then the issue with above line only. If the result is more than 1 records then the issue is some thing different.
Provide the same input parameters which you are providing from your webdynpro screen.
Thanks & Regards,
Jaya.
Hi,
Change for(int i=1;i<wdContext.nodeP_K_Matloc().size();i++) to
for(int i=0;i<wdContext.nodeP_K_Matloc().size();i++)
Thanks & Regards,
JayaRam.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.