on 07-15-2008 8:39 AM
Dear All,
I am trying to open a file which is located at
src/mimes/Components/com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp,
I am using this sample code given by sap..
*
IWDAttributeInfo attInfo =
wdContext.currentContextElement().node().getNodeInfo().
getAttribute("PdfSource");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) type;
binaryType.setFileName("TravelRequest.pdf"); // Set file name
binaryType.setMimeType(WDWebResourceType.PDF); // set the mime type
String fileName ="temp
webdynpro
web
local
TutWD_UploadDownloadInteractiveForm_Init
Components
com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp1
TravelRequest.pdf";
// path to the source file
/* converts the binary file to a byte array and moves it to the text element */
try
{
File file = new File(fileName);
FileInputStream in = new FileInputStream(file);
ByteArrayOutputStream out = new ByteArrayOutputStream();
int length;
byte[] part = new byte [10 * 1024];
while ((length = in.read(part)) != -1)
{
out.write(part, 0, length);
}
in.close();
wdContext.currentContextElement().
setPdfSource(out.toByteArray());
} catch(Exception e)
{
throw new WDRuntimeException(e);
}
*
But I am getting runtime exception...
java.io.FileNotFoundException: temp\webdynpro\web\local\TutWD_UploadDownloadInteractiveForm_Init\Components\com.sap.tut.wd.uploaddownloadinteractiveform.UploadDownloadInteractiveFormComp1\TravelRequest.pdf (The system cannot find the path specified)
Please tell me what could be the reason...
Thanks in Advance
Hi Amit/Arafat,
I am facing the same issue. I have given the complete path of where the file resides but it stills throws the same error -
java.io.FileNotFoundException: D:\Documents and Settings\divya.rao\Documents\SAP\workspace\NghiaDemo\src\mimes\Components\adobe.sap.com.Test\TraveRequest.pdf (No such file or directory)
How can I resolve this?
Many thanks,
Divya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
Try to give fully qualified name alongwith the local disk drive. like "c:\temp\abc\def.pdf".
Hope this helps!!
Regards,
Arafat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.