cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading excel file

Former Member
0 Kudos

Hi Experts,

I have a requirement to send the file path name from local machine to RFC.

But while doing so i am getting the path name as

/usr/sap/DHE/J40/j2ee/cluster/server0/test.xlsx

but i need to pass C:\Users\test\Desktop\test.xls to the RFC.

Can anyone help me with this?

Regards,

Murali Krishnan

Accepted Solutions (0)

Answers (4)

Answers (4)

junwu
Active Contributor
0 Kudos

if i am not wrong, it is not possible, it is browser security restriction

Former Member
0 Kudos

Hi Murali,

You can write file to the server path as below and then perform the desired operations :

File file = new File(wdContext.currentContextElement().getFilesrc().getResourceName());

    FileOutputStream fop = new FileOutputStream(file);

    if(wdContext.currentContextElement().getFilesrc()!=null)

    {

     text=wdContext.currentContextElement().getFilesrc().read(false);

    

     while((tmp=text.read())!=-1)

    fop.write(tmp);

      fop.flush();

      fop.close();

     String filepath =file.getAbsolutePath();

     BufferedReader reader=new BufferedReader(new FileReader(filepath));

Regards,

Archana

former_member192434
Active Contributor
0 Kudos

Hi Murali,

You can do couple of things to meet your requirement.

You will always get absolutePath of the file not the exact path of the file, since its store in WD resource.

So you can talaired the absolute path and send back to RFC.

Tailering can be done in this way.

1. Read the physical location of the file by going to portal server window file system.

2. then append pre url of portal server location to '/usr/sap/' an replace '/' with '\'  and store it into temp attributes and bind this attributes to your RFC attributes .

Hope this will help.

Thanks

Sharathmg
Active Contributor
0 Kudos

How are you retrieving the file path?

The path seems to be server path.