cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.ArrayIndexOutOfBoundsException: -1

Former Member
0 Kudos

Hi All

Please explain me the reason for the occurence of this error I have attached the error stacktrace.Kindly suggest me ways to solve it.

Error stacktrace:

java.lang.ArrayIndexOutOfBoundsException: -1

at com.sap.mw.jco.JCO$MetaData.getType(JCO.java:9391)

at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:731)

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValueAsString(DynamicRFCModelClass.java:658)

at com.sap.f4help.test1.model.Zwd_Vendor_Getlist_Input.setLifnr_Struc(Zwd_Vendor_Getlist_Input.java:207)

at com.sap.f4help.test1.comp.Vendor_OVS_Help$OVSDemoContextNotificationListener.onQuery(Vendor_OVS_Help.java:215)

at com.sap.tc.webdynpro.progmodel.valuehelp.OVSCMIQuery.onQuery(OVSCMIQuery.java:153)

at com.sap.tc.webdynpro.components.ovs.OVSComponent.query(OVSComponent.java:174)

at com.sap.tc.webdynpro.components.ovs.wdp.InternalOVSComponent.query(InternalOVSComponent.java:159)

at com.sap.tc.webdynpro.components.ovs.views.MainView.onActionGoSearch(MainView.java:150)

at com.sap.tc.webdynpro.components.ovs.views.wdp.InternalMainView.wdInvokeEventHandler(InternalMainView.java:138)

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.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)

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:392)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

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:95)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mansoor,

I think you are trying to get a value from node with index that does not exist.

Please post the code where you are getting the problem(read the line number of your component in the trace) for further analysis.

Regards,

Shubham

Former Member
0 Kudos

Hi

Here is code that I have written in the Controller where the exception is raised.

public void onQuery(

IWDNodeElement queryInputNodeElement,

IWDNode queryOutputNode) {

IPublicVendor_OVS_Help.IQuery_vendor_resultElement input =

(IPublicVendor_OVS_Help

.IQuery_vendor_resultElement) queryInputNodeElement;

IPublicVendor_OVS_Help.IQuery_outputNode output =

(IPublicVendor_OVS_Help.IQuery_outputNode) queryOutputNode;

Zwd_Vendor_Getlist_Input bapiInput1 = new Zwd_Vendor_Getlist_Input();

// Lfa1 vendor = new Lfa1();

bapiInput1.addLfa1_Tab(new Lfa1());

if (input.getLifnr() != null) {

bapiInput1.setLifnr_Struc(input.getLifnr());

}

//if (input.getLifnr() != null) {

//vendor.setLifnr(input.getLifnr());

// }

// bapiInput.setLifnr_Struc(input.getLifnr());

try {

wdContext.currentUser_helpsElement().modelObject().execute();

} catch (Exception e) {

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

msgMgr.reportException(e.getLocalizedMessage(), false);

}

wdContext.nodeLfa1_Tab().invalidate();

queryOutputNode.bind(bapiInput1.getOutput().getLfa1_Tab());

}

I'am using a RFC to just get the list of vendors,the import parameters for the RFC are Vendor Number,Name and city.In the tables I have declared a structure which is similar to the LFA1 table.All the Importing parameters are optional and i'am using this only as output.I'am trying to implement a input help for vendor number.

regards

Mansoor

Former Member
0 Kudos

Hi Mohamed,

I have few questions regarding your code.

First of all, you have created object of Zwd_Vendor_Getlist_Input, i guess this is your model. But, you have not bound your model object to your context.

So, write following thing.

wdcontext.node<node name>.bind(bapiInput1);

And, you are executing following model.

wdContext.currentUser_helpsElement().modelObject().execute();

Is this the same one for which you have created model object?

Means, have you bound User_helps context node to your model Zwd_Vendor_Getlist_Input bapiInput1?

This error is occuring because you have not bound your model object to your context node. So, at the time of executing model it will fire this exception.

Regards,

Bhavik

Former Member
0 Kudos

Hi Mansoor,

There are two problems I see.

1) You are populating bapiInput1, but you are executing

wdContext.currentUser_helpsElement().modelObject().execute();

instead, you should execute bapiInput1 or bind this to your node.

2) Why are you adding a record to Lfa1_tab. This will get your output records as I can see.

Zwd_Vendor_Getlist_Input bapiInput1 = new Zwd_Vendor_Getlist_Input();

// Lfa1 vendor = new Lfa1();

bapiInput1.addLfa1_Tab(new Lfa1());

Correct these and then try, it should work.

Regards,

Shubham

Former Member
0 Kudos

Hi

Thanks Both of you,i had not done the binding for bapiInput1 with the node.

After doing the binding it is working perfectly.

Thanks once again.

Answers (0)