cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload control in Web dynpro

Former Member
0 Kudos

Hi all,

i am trying to build an application using FileUpload control in webdynpro.

The upload control gives error message that "parse method is not possible for this type".

please help me.

can anybody suggest a link to an example or Tutorial.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to assign an attribute of type binary for the data property of FileUpload UI element and implement the below code in the init() method.

IWDAttributeInfo attInfo=

wdContext.getNodeInfo().getAttribute("File");

IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attInfo.getModifiableSimpleType();

If you assign the attribute and still didnot write the above code you will get the error message "parse method is not possible for this type"

Hope this info will be helpful.

Former Member
0 Kudos

now am getting the stack tracs as

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at java.lang.String.substring(String.java:1438)

at com.sap.tc.webdynpro.services.sal.util.cache.ResourcePool.getKeyFromUrl(ResourcePool.java:215)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.datatransport.DataTransportFactory.getOutputMassDatasource(DataTransportFactory.java:76)

at com.sap.tc.webdynpro.services.sal.datatransport.core.InternalMassDataTransport.getOutputMassDatasource(InternalMassDataTransport.java:41)

at com.sap.tc.webdynpro.progmodel.context.ModifiableBinaryType.parse(ModifiableBinaryType.java:101)

at com.sap.tc.webdynpro.clientserver.data.DataContainer.doParse(DataContainer.java:1268)

at com.sap.tc.webdynpro.clientserver.data.DataContainer.validatePendingUserInput(DataContainer.java:1167)

at com.sap.tc.webdynpro.clientserver.data.DataContainer.validatePendingUserInput(DataContainer.java:529)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.validate(ClientComponent.java:592)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.validate(ClientApplication.java:635)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.transportData(WebDynproMainTask.java:596)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Former Member
0 Kudos

Are you getting this error in the initialization of the screen or on performing any action???

Former Member
0 Kudos

am getting this error on the action

Former Member
0 Kudos

I think u r not writing the data into a file properly.

U should create a file in a directory and write the data that is there in the attribute of type binary to the file.

FileOutputStream out = new FileOutputStream(new File (fileName));

out.write(wdContext.currentContextElement().getFile());

out.close();

Here File is the attribute of type binary that I have binded to the file upload control.

I think this will solve ur problem.

Answers (1)

Answers (1)

Former Member
0 Kudos

FileUpload control should have binding with only view.

If we bind data property of File Upload control to view's context element and then bind that context element to any controllers than it will give above the error.