cancel
Showing results for 
Search instead for 
Did you mean: 

Filedownload UI element not working in production

Former Member
0 Kudos

Hi,

There is filedownload UI element used along with a dropdown UI element

This is working fine in dev and quality but in production it doesnt pick the file.

It is made to work as follows -

u2022 first of all the files are placed at root location of the file system of server (filedownload ui element is used to download these files)

u2022 The data and resource properties of the filedownload are populated upon the action of dropdown ui element

u2022 so user has to select the dropdown frst and then click on filedownload UI element (which is a link)

u2022 Following code is onaction of the dropdown ui element.

byte b[];

try {

String excelpath = null;

String systemID = System.getProperty("SAPSYSTEMNAME");

String appDir = System.getProperties().getProperty("Applications Directory");

// if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Financial Forms - 1")

// excelpath = "/usr/sap/"systemID"/JC00/j2ee/cluster/server0/apps/sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Financial Forms - 1.xls";

// if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Financial Forms - 2")

// excelpath = "/usr/sap/"systemID"/JC00/j2ee/cluster/server0/apps/sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Financial Forms - 2.xls";

// if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Non Financial Forms")

// excelpath = "/usr/sap/"systemID"/JC00/j2ee/cluster/server0/apps/sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Non Financial Forms.xls";

if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Financial Forms - 1")

excelpath = appDir+"sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Financial Forms - 1.xls";

if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Financial Forms - 2")

excelpath = appDir+"sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Financial Forms - 2.xls";

if(wdContext.currentExcelName_downloadElement().getExcelName()=="Template for Non Financial Forms")

excelpath = appDir+"sap.com/com.sap.engine.docs.examples/servlet_jsp/_default/root/Template for Non Financial Forms.xls";

//wdComponentAPI.getMessageManager().reportSuccess(excelpath);

File input = new File(excelpath);

int length =(int)input.length();

// Create a byte array b to hold the file

b = new byte[length];

FileInputStream in = new FileInputStream(input);

// Reading the file to a byte array b

in.read(b);

in.close();

// Setting the data from the byte array to the context element.

wdContext.currentContextElement().setData_filedownload(b);

// Populating the resource attribute

String filename = wdContext.currentExcelName_downloadElement().getExcelName();

IWDResource resource = WDResourceFactory.createResource(b, filename, WDWebResourceType.XLS);

wdContext.currentContextElement().setResource_filedownload(resource);

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

This is working fine in all systems but after I deployed the code in production system it doesnt work. When user clicks on filedownload it doesnt open up any file download dialog box

when similar problem occured in quality it was because the files were not placed at proper location

but now the files are properly places i checked along with basis

kindly advice what could be the problem here

does it not determine link correctly or what could be difference betw non-production and productio environment ?

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Did you check the user permssions on the seected directory? The loged-in user should have at least reading permissions.

Regards,

Alain.

bhakti2
Active Participant
0 Kudos

Hi Alain,

thanks for the response

i found out that it was browser related problem. i installed jre and it works now

thanks

B

Answers (1)

Answers (1)

bhakti2
Active Participant
0 Kudos

.