on 04-24-2010 3:40 AM
Hi Friends,
I have one doubt in WDJ,
Note: Req: I want browse excel file from the desktop and past into one perticular path of the EP Server System
I was write some codeing but i m not able to past into that path. if u have any Codeing pls share with me.
Path: is Y:\sc\MJD
And another way
ABAPer Given one BAPI in that BAPI one Input attribute is here.
Note: I need how to pass the complete path of the file in WDJ and as an input filed to a ABPI
when we have to browse the from the desktop that time i need to find out the total path. how to get that path by using WDJ
I was writing code like this
File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
// String File = "abc.xls";
// String file = "anat" + ".xls";
wdComponentAPI.getMessageManager().reportSuccess("File::"+file);
now i m getting out here only file name.
but i need total path of the File .
Regards
Vijay Kalluri
Hi
Code to upload file and store in portal location using WDJ:
Create a file node containing 2 attributes filename and filedata.This filename can be used to access the name of the file.The data stored in the file is being passed as a binary stream.
Therefore the filedata should be of binary type.
fileelement = wdContext.createFilenodeElement();
wdContext.nodeFilenode().bind(fileelement);
/Make a simple type of that type/
IWDAttributeInfo attInfo = wdContext.nodeFilenode().getNodeInfo().getAttribute("filedata");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
Following is the code for uploading files
/*Get an object of current Portal user */ IWDClientUser wdClientUser =
WDClientUser.getCurrentUser(); com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
/*create an ep5 user from the retrieved user
IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
/*Give the path to KM in the variable path */
RID rid = RID.getRID(path);
IResourceFactory factory =
ResourceFactory.getInstance();
ICollection folder = (ICollection) factory.getResource(rid,context);
Using the upload element we can upload the files to a location in the server drive
/*temperory location for writing */
String location = u201Cgive the location hereu201D;
String fileName = location+fileelement.getFilename();
file = new File(fileName);
/Create an output stream for writing to the temperory location/
FileOutputStream out = new FileOutputStream(file);
out.write(fileelement.getFiledata());
out.close();
/From the temporary location read the file using an input stream/
FileInputStream fin = new FileInputStream(fileName);
fin.read();
/*Using this input stream we can write to the repository
Content content = new Content(fileelement.getFiledata(),fileelement.get) */
Content content = new Content(fin,"byte", -1);
IResource newResource = folder.createResource(fileelement.getFilename(),null, content);
After uploading files to KM repository delete the file from its temporary location .Close the input stream when you have uploaded
fin.close();
file.delete();
write the above code within a try-catch block. After writing the code organize imports .
These are the imports to be organised
import com.sapportals.portal.security.usermanagement.IUser;
import com.sapportals.wcm.repository.Content;
import com.sapportals.wcm.repository.ICollection;
import com.sapportals.wcm.repository.IResource;
import com.sapportals.wcm.repository.IResourceContext;
import com.sapportals.wcm.repository.IResourceFactory;
import com.sapportals.wcm.repository.IResourceList;
import com.sapportals.wcm.repository.IResourceListIterator;
import com.sapportals.wcm.repository.ResourceContext;
import com.sapportals.wcm.repository.ResourceFactory;
import com.sapportals.wcm.util.uri.RID;
import com.sapportals.wcm.util.usermanagement.WPUMFactory
Edited by: Yogesh Galphade on Apr 26, 2010 11:02 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Patana,
I am doing like this 1.Create one Application Open FirtsView in that FV i have Created 2 attaributes 1. data and 2. Resource (datatype---Resource) Now Open the FileUplaod UI Element and bind to the these two attribues.
after that i was created one button. in that button action i was write this code
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionUpload(ServerEvent)
//$$begin ActionButton(1889399541)
* InputStream text = null;*
* int temp = 0;*
* try*
* { *
* *
* File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());*
* FileInputStream in = new FileInputStream(file); *
* FileOutputStream op = new FileOutputStream(file);*
* // FileOutputStream op = new FileOutputStream("Y:
sc
MJD
"+file);*
* if (wdContext.currentContextElement().getResource()!= null)*
* {*
* text = wdContext.currentContextElement().getResource().read(false);*
* *
* while((temp=text.read())!= -1)*
* {*
* op.write(temp);*
* }*
* }*
* op.flush();*
* op.close();*
* path = "Y:
sc
MJD
"+file;*
* }*
* catch(Exception ex)*
* {*
* ex.printStackTrace();*
* }*
//@@end
}
My Req is Browse the from any location and click on Upload button that file moves to Y:
sc
MJD
this Path
I need some help from yours side.
Regards
Vijay Kalluri
Hi Patana,
I am doing like this 1.Create one Application Open FirtsView in that FV i have Created 2 attaributes 1. data and 2. Resource (datatype---Resource) Now Open the FileUplaod UI Element and bind to the these two attribues.
after that i was created one button. in that button action i was write this code
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )*
{
//@@begin onActionUpload(ServerEvent)
//$$begin ActionButton(1889399541)
InputStream text = null;
int temp = 0;
try
{
File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
FileInputStream in = new FileInputStream(file);
FileOutputStream op = new FileOutputStream(file);
// FileOutputStream op = new FileOutputStream("Y:
sc
MJD
"+file);
if (wdContext.currentContextElement().getResource()!= null)
{
text = wdContext.currentContextElement().getResource().read(false);
while((temp=text.read())!= -1)*
{
op.write(temp);
}
}
op.flush();
op.close();
path = "Y:
sc
MJD
"+file;
}
catch(Exception ex)
{
ex.printStackTrace();
}
*//@@end
}
My Req is Browse the from any location and click on Upload button that file moves to Y:
sc
MJD
this Path
I need some help from yours side.
Regards
Vijay Kalluri
Hi Patana,
I am doing like this 1.Create one Application Open FirtsView in that FV i have Created 2 attaributes 1. data and 2. Resource (datatype---Resource) Now Open the FileUplaod UI Element and bind to the these two attribues.
after that i was created one button. in that button action i was write this code
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )*
{
//@@begin onActionUpload(ServerEvent)
//$$begin ActionButton(1889399541)
InputStream text = null;
int temp = 0;
try
{
File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
FileInputStream in = new FileInputStream(file);
FileOutputStream op = new FileOutputStream(file);
// FileOutputStream op = new FileOutputStream("Y:
sc
MJD
"+file);
if (wdContext.currentContextElement().getResource()!= null)
{
text = wdContext.currentContextElement().getResource().read(false);
while((temp=text.read())!= -1)*
{
op.write(temp);
}
}
op.flush();
op.close();
path = "Y:
sc
MJD
"+file;
}
catch(Exception ex)
{
ex.printStackTrace();
}
//@@end
}
My Req is Browse the from any location and click on Upload button that file moves to Y:
sc
MJD
this Path
I need some help from yours side.
Regards
Vijay Kalluri
Hi Vijay,
Refer below links (try to use FileUpload UI):-
http://wiki.sdn.sap.com/wiki/display/WDJava/UploadingexcelfileusingWebDynproforJava
http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproforJava-+FileUploadUIElementHope this may help you.
Deepak!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Friend
I am doing like this 1.Create one Application Open FirtsView in that FV i have Created 2 attaributes 1. data and 2. Resource (datatype---Resource) Now Open the FileUplaod UI Element and bind to the these two attribues.
after that i was created one button. in that button action i was write this code
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )*
{
//@@begin onActionUpload(ServerEvent)
//$$begin ActionButton(1889399541)
InputStream text = null;
int temp = 0;
try
{
File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
FileInputStream in = new FileInputStream(file);
FileOutputStream op = new FileOutputStream(file);
if (wdContext.currentContextElement().getResource()!= null)
{
text = wdContext.currentContextElement().getResource().read(false);
while((temp=text.read())!= -1)*
{
op.write(temp);
}
}
op.flush();
op.close();
path = "Y:\sc\MJD"+file;
}
catch(Exception ex)
{
ex.printStackTrace();
}
//@@end
}
My Req is Browse the from any location and click on Upload button that file moves to Y:\sc\MJD this Path
I need some help from yours side.
Regards
Vijay Kalluri
Hi Vijay,
Well, you got to change your code a bit to successfully upload to the said path (Y:). Write the below code in you onActionUpload method:
String outputFolder = "Y:\\sc\\MJD\\";
File file = new File(wdContext.currentContextElement().getResource().getResourceName());
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateXXXView.iContextElement element = wdContext.currentContextElememt();
if(element.getFileResource() != null){
IWDResource resource = element.getFileResource();
is = resource.read(ture);
int size = is.available();
byte[] outBytes = new byte[size];
outputFile = new FileOutputStream(outputFolder + file.getName());
int length;
while((lenght - is.read(outBytes)) != -1){
outputFile.write(outBytes,0,length);
}
outputFile.close();
is.close();
element.setFileResource(null);
As simple as it is, and it is assumd that the path "Y:\sc\MJD\" is a servers local path. There are other ways to do the same, but this is the coolest ones, hoping it solves all your quesries.
Thanks,
MS
Hi Friend i will follow this code
String outputFolder = "Y:
sc
MJD
";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateUploadASNFileView.IContextElement element = wdContext.currentContextElement();
if(element.getFileResource() != null)
{
IWDResource resource = element.getFileResource();
is = resource.read(ture);
int size = is.available();
byte[] outBytes = new byte[size];
outputFile = new FileOutputStream(outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
int length;
while((length - is.read(outBytes)) != -1){
outputFile.write(outBytes,0,length);
}
outputFile.close();
is.close();
element.setFileResource(null);
Here is = resource.read(ture); here i am getting Error i.e true cant resolved like that
Regards
Hi Friend,
I will use this code.But i am getting error.
is = resource.read(ture); Here i am getting error that error is true cant be resolved
How to Solve this error can u tell me
String outputFolder = "Y:\sc\MJD\";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateUploadASNFileView.IContextElement element = wdContext.currentContextElement();
boolean flag = false;
if(element.getFileResource() != null)
{
IWDResource resource = element.getFileResource();
is = resource.read(ture);
int size = is.available();
byte[] outBytes = new byte[size];
outputFile = new FileOutputStream(outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
int length;
while((length - is.read(outBytes)) != -1){
outputFile.write(outBytes,0,length);
}
outputFile.close();
is.close();
element.setFileResource(null);
Hi Munna,
i had wrote this code like this. But when i deploed the application our explorer opend. then browse the .xls file click on uplaod buttion it will take more time.meas wait for 10 to 15 min file not uload. i am not getting any output.After click on upload button process will started up to 10 min also same process. i am not getting any openput. whats problem.
wdComponentAPI.getMessageManager().reportSuccess("file:");
try
{
String outputFolder = "Y:
sc
MJD
";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateUploadASNFileView.IContextElement element = wdContext.currentContextElement();
//boolean flag = false;
if(element.getFileResource() != null)
{
IWDResource resource = element.getFileResource();
is = resource.read(true);
int size = is.available();
byte[] outBytes = new byte[size];
outputFile = new FileOutputStream(outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
while((length - is.read(outBytes)) != -1)
{
outputFile.write(outBytes,0,length);
}
}
outputFile.close();
is.close();
element.setFileResource(null);
}
catch (FileNotFoundException fnf)
{
fnf.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("FileNotFound");
}//catch close
catch (IOException ioe)
{
ioe.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("IO Exception");
}
catch(Exception e1)
{
e1.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("Normal Exception");
}
Hi Vijay,
I didn't see your replies and i cudn't reply to the previous messages, and sorry it was typoo...
is = resource.read(ture); to is = resource.read(true);
Anyways, make sure that the first folder 'sc' and sub-folder 'MJD' exists in drive 'Y' in the server first. If yes, the program should work fine..! Make use of some MessageManager.reportSuccess() messages where ever needed to know the status of the program.
Thanks,
MS
Hi Mauna,
Yes absolutely correct that server path in y drive. Make sure that the first folder 'sc' and sub-folder 'MJD' exists in drive 'Y' in the server first. I have use you are code. See this code. I am getting Exception that is u201CFileNotFoundu201D
Up to this code I am getting proper output
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
here File name is printed. After that any statement not executed. Please check it this code once.
This is code
try
{
String outputFolder = "Y:
sc
MJD
";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateBrowseView.IContextElement element = wdContext.currentContextElement();
if(element.getFileResource() != null)
{
IWDResource resource = element.getFileResource();
is = resource.read(true);
int size = is.available();
byte[] outBytes = new byte[size];
outputFile = new FileOutputStream(outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
int length;
while((length - is.read(outBytes)) != -1)
{
outputFile.write(outBytes,0,length);
}
outputFile.close(); is.close();
element.setFileResource(null);
}
}
catch (FileNotFoundException fnf)
{ fnf.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("FileNotFound");
}//catch close
catch (IOException ioe)
{ ioe.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("IO Exception");
} catch(Exception e1) {
e1.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("Normal Exception");
}
Could you tell me what is the problem here any Braces "} " Problem
In My Appliaction what i am doing like this
I have to One FileUpload UI Element. and create two attribues 1 is Data for data type--String and FileResource datatype Resource and Bind to UI Element
Regards
Vijay Kalluri
Hi Vijay,
What are you getting when you print the below code:
outputFolder + file.getName()
And check whether the control going inside if() statement,
if(element.getFileResource() != null)
also try to print 'element.getFileResource()' should get value otherthan null.
And "Could you tell me what is the problem here any Braces "} " Problem", can let you compile the WD App.
Data for data type--String, make Data as binary type.
Thanks,
MS
Hi Munna,
In that above Code i am getting output upto "outBytes" this. after this " byte[] outBytes = new byte[size];" i am not getting output.
i.e outputFile = new FileOutputStream(outputFolder + file.getName()); ( here i can't print the outputFile)
ASNCRTTST.xls --- This is Excel File Name
What i am getting OutPut Like This
file:ASNCRTTST.xls
Element:../../local/Browse/Browse/~wd_key10_1272869209044/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=a0f684f3567f11dfce97001c23c00c5f&sap-wd-appwndid=a0f684f4567f11dfc5a0001c23c00c5f&sap-wd-norefresh=X
resource:../../local/Browse/Browse/~wd_key10_1272869209044/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=a0f684f3567f11dfce97001c23c00c5f&sap-wd-appwndid=a0f684f4567f11dfc5a0001c23c00c5f&sap-wd-norefresh=X
is:java.io.FileInputStream@536f72f5
size:18944
outBytes:[B@39e45d9e
FileNotFound This FileNot Found Exception
What is the Problem in this Method."outputFile = new FileOutputStream(outputFolder + file.getName());"
Why it not working Here.
Regards
Vijay Kalluri
Hi Vijay,
Tell me what is the output of the below statement and put this code after "byte[] outBytes = new byte[size];" line
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path: "+ outputFolder + file.getName());
this should print "Y:\sc\MJD\filename.ext"
And tell what are the other drives presend in your server other than 'Y:' ?
Thanks,
MS
Hi Munna
I am getting output like this This is Code
try
{
String outputFolder = "C:
SAP
";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateBrowseView.IContextElement element = wdContext.currentContextElement();
//boolean flag = false;
if(element.getFileResource() != null) {
wdComponentAPI.getMessageManager().reportSuccess("Element:"+element.getFileResource());
IWDResource resource = element.getFileResource();
wdComponentAPI.getMessageManager().reportSuccess("resource:"+resource);
is = resource.read(true);
wdComponentAPI.getMessageManager().reportSuccess("is:"+is);
int size = is.available();
wdComponentAPI.getMessageManager().reportSuccess("size:"+size);
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path4: "+ outputFolder + file.getName());
byte[] outBytes = new byte[size];
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path1: "+ outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outBytes:"+outBytes);
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path2: "+ outputFolder + file.getName());
outputFile = new FileOutputStream(outputFolder + file.getName());
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path3: "+ outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
while((length - is.read(outBytes)) != -1)
{
outputFile.write(outBytes,0,length);
}
}
outputFile.close();
is.close();
element.setFileResource(null);
}
catch (FileNotFoundException fnf)
{
fnf.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("FileNotFound");
}//catch close
catch (IOException ioe)
{
ioe.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("IO Exception");
}
catch(Exception e1)
{
e1.printStackTrace();
wdComponentAPI.getMessageManager().reportSuccess("Normal Exception");
}
This is Out Put
file:ASNCRTTST.xls
Element:../../local/Browse/Browse/~wd_key14_1272875202435/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=95e5ff65568d11df9045001c23c00c5f&sap-wd-appwndid=95e5ff66568d11dfb35b001c23c00c5f&sap-wd-norefresh=X
resource:../../local/Browse/Browse/~wd_key14_1272875202435/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=95e5ff65568d11df9045001c23c00c5f&sap-wd-appwndid=95e5ff66568d11dfb35b001c23c00c5f&sap-wd-norefresh=X
is:java.io.FileInputStream@5861b35
size:18944
outPutFile path4: C:\SAP\ASNCRTTST.xls
outPutFile path1: C:\SAP\ASNCRTTST.xls
outBytes:[B@27643768
outPutFile path2: C:\SAP\ASNCRTTST.xls
* FileNotFound*
After this Line We can't print the data outputFile = new FileOutputStream(outputFolder + file.getName()); This Line is not working.
outputFile = new FileOutputStream(outputFolder + file.getName());
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path3: "+ outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
Regards
Vijay Kalluri
Hi Munna I am getting output like this This is Code
try {
String outputFolder = "C:
SAP
";
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName());
wdComponentAPI.getMessageManager().reportSuccess("file:"+file);
InputStream is = null;
FileOutputStream outputFile = null;
IPrivateBrowseView.IContextElement element = wdContext.currentContextElement();
//boolean flag = false;
if(element.getFileResource() != null)
{
wdComponentAPI.getMessageManager().reportSuccess("Element:"+element.getFileResource());
IWDResource resource = element.getFileResource(); wdComponentAPI.getMessageManager().reportSuccess("resource:"+resource);
is = resource.read(true);
wdComponentAPI.getMessageManager().reportSuccess("is:"+is);
int size = is.available();
wdComponentAPI.getMessageManager().reportSuccess("size:"+size);
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path4: "+ outputFolder + file.getName());
byte[] outBytes = new byte[size];
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path1: "+ outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outBytes:"+outBytes);
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path2: "+ outputFolder + file.getName());
outputFile = new FileOutputStream(outputFolder + file.getName());
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path3: "+ outputFolder + file.getName());
wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
while((length - is.read(outBytes)) != -1)
{
outputFile.write(outBytes,0,length);
}
}
outputFile.close();
is.close();
element.setFileResource(null);
}
catch (FileNotFoundException fnf)
{ fnf.printStackTrace(); wdComponentAPI.getMessageManager().reportSuccess("FileNotFound"); }//catch close catch (IOException ioe) { ioe.printStackTrace(); wdComponentAPI.getMessageManager().reportSuccess("IO Exception"); } catch(Exception e1) { e1.printStackTrace(); wdComponentAPI.getMessageManager().reportSuccess("Normal Exception"); }
This is Out Put *
file:*ASNCRTTST.xls
Element:../../local/Browse/Browse/~wd_key14_1272875202435/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=95e5ff65568d11df9045001c23c00c5f&sap-wd-appwndid=95e5ff66568d11dfb35b001c23c00c5f&sap-wd-norefresh=X
resource:../../local/Browse/Browse/~wd_key14_1272875202435/ASNCRTTST.xls?sap-wd-download=1&sap-wd-cltwndid=95e5ff65568d11df9045001c23c00c5f&sap-wd-appwndid=95e5ff66568d11dfb35b001c23c00c5f&sap-wd-norefresh=X
is:java.io.FileInputStream@5861b35
size:18944
outPutFile path4: C:\SAP\ASNCRTTST.xls
outPutFile path1: C:\SAP\ASNCRTTST.xls
outBytes:[B@27643768
outPutFile path2: C:\SAP\ASNCRTTST.xls
FileNotFound*
After this Line We can't print the data outputFile = new FileOutputStream(outputFolder + file.getName()); This Line is not working. outputFile = new FileOutputStream(outputFolder + file.getName()); wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("outPutFile path3: "+ outputFolder + file.getName()); wdComponentAPI.getMessageManager().reportSuccess("outputFile:"+outputFile);
Regards Vijay Kalluri
Hi Vijay,
Just for the clarity again, where are you creating these folders under drives(C:/Y:)? In portal server file system where all your WD applications are deployed or in your local file system?
All the code looks fine and it shows the file size even, and it runs perfectly at my environment and you should not be getting the problem at all!
Thanks,
MS
Hi Munna,
I am working on Portal Server that path is Y:/sc/MJD. Now Portal Server is down. So I am working in Local System. Its Working fine in Local System..I will put this code in Develop System.
Local System also not working file is not moved to that path.
Hey Friend this is my gmail id kallurivijay.sapep at gmail please add meu2026 or give me u r gmail id
Regards
Vijay Kalluri
Hi Vijay,
Answer me the below Qs:
1. is your portal system on Windows or Unix
2. is Y: drive is mapped drive or OS drive of Portal server
3. Where is C:\SAP drive - it should be in Portal Server Filesystem and not the local filesystem (your desktop)!
Make sure you create SAP folder under C drive and give the path as C:\SAP\ and use the code to upload file. Your code can't read local systems C:\SAP\ folder.
Hope it solves
Thanks,
MS
Hi Munna,
Answer me the below Qs:
1. is your portal system on Windows or Unix--- Unix System
2. is Y: drive is mapped drive or OS drive of Portal server---
Ans:In Mapped Drive we canu2019t read the file Or OS Drive we can read file na u2026what is the difference between these two drives
3. Where is C:\SAP drive - it should be in Portal Server Filesystem and not the local filesystem (your desktop)! :::
This is Correct path: Y:\sc\MJD\
This Path is C:\SAP is my Desktop Path
Make sure you create SAP folder under C drive and give the path as C:\SAP\ and use the code to upload file. Your code can't read local systems C:\SAP\ folder.---Okay
Regards
Vijay Kalluri
Hi Vijay,
It should have been specified that your Portal environment is on UNIX (during your first post), all the code(s) posted by me or others works for Windows env and not for UNIX env.
I think its getting into another issue rather-than the actual. Well Vijay, refer to the below links to understand the basics in Read/Write File(s) on Windwos/UNIX envs:
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
http://java.sun.com/docs/books/tutorial/essential/io/file.html
Hoping the best...!
Thanks,
MS
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.