Problem in downloading excel file
Hi,
I am downloading output of SQ01 into excel file using BDC, but windows system stores the whole data in one cell of sheet instead of all other cells.
Please anybody tell me solution.
Thanks & Regards,
Umesh
Hi,
Check the followinf code:
IF sy-ucomm = 'DOWNLOAD' AND sy-lsind = 1.
DATA: fullpath TYPE string,
filename TYPE string,
path TYPE string,
user_action TYPE i,
encoding TYPE abap_encoding.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Gui_Download Demo'
with_encoding = 'X'
initial_directory = 'C:\'
CHANGING
filename = filename
path = path
fullpath = fullpath
user_action = user_action
file_encoding = encoding
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF user_action <> cl_gui_frontend_services=>action_ok.
EXIT.
ENDIF.
Ascii download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = fullpath
FILETYPE = 'DAT'
tables
data_tab = itab.
ENDIF.
Hope it will help you.
Regards
Rajesh Kumar
Similar Messages
-
Facing problem with posting Excel file for download - Content in browser
I am trying to post an Excel file to download from a servlet to a JSP. The content is written properly but to the IE browser and not in an Excel. I even tried giving the ContentType as Word/CSV etc. But nothing works, the content gets displayed only in the browser.
PLEASE HELP.
Code snippet in calling JSP:
DownloadServlet downServlet = new DownloadServlet();
downServlet.download(response);
Code in Servlet:
public class DownloadServlet extends HttpServlet{
public void download(HttpServletResponse response) throws IOException {
/*PrintWriter out = response.getWriter( );
response.setContentType("text/html");
out.println("<H1>Hello from a Servlet</h2>"); */
/*HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Sheet1");*/
String strData = "This is a Test for Download";
byte[] b = strData.getBytes();
//response.reset();
response.setHeader("Content-disposition", "attachment; filename=" + "Download.xls");
response.setContentType( "application/msword" );
//response.addHeader( "Content-Description", "Download Excel file" );
ServletOutputStream out = response.getOutputStream();
out.write(b);
//out.flush();
out.close();
}Hi Naresh,
My thoughts on a possible solution, convert the last character value to a HEX value and check if it falls within the ASCII/Unicode CP range, Obviously this becomes easier if you are just looking at a single language character set.
The below FM and code helps you check if the character falls within the ASCII char set.
DATA: l_in_char TYPE string,
l_out TYPE xstring.
CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'
EXPORTING
lang_used = sy-langu
SOURCE = l_in_char
TO_FE = 'MS '
IMPORTING
RESULT = l_out
SUBSTED =
EXCEPTIONS
illegal_syst_codepage = 1
no_fe_codepage_found = 2
could_not_convert = 3
OTHERS = 4.
IF l_out LT '0' OR l_out GT '7F'.
WRITE: 'error'.
ENDIF.
Links: http://www.asciitable.com/
http://www.utf8-chartable.de/unicode-utf8-table.pl
Regards,
Chen
Edited by: Chen K V on Apr 21, 2011 11:25 AM -
URL Link on downloaded Excel File
Hi,
I have got a requirement.
For study and analysis purpose user download data on excel file from OCOD. Struture(Contents) of downloaded excel file is same as screen.
But the problem is when user click on 'DETAIL' (which has URL link) he/she is directed to Live OCOD and asked for log in with ID and Password, even if
user is logged in OCOD.
What i want to do is.
1) Download Excel file without any URL link.
2) If 1) is not possible then do not want to have 'DETAIL' option of downloded file.
3) Method for avoiding relog into OCOD.
Thanks in Advance
YujYuj, within the application click on the Training and Support link in the upper right, then click on Add-On Applications, then click on Reports and Analysis for Excel Template. In order to take the webinar click on Browse Training, then click on Training Resources by Job, then click on All Users, then click on Using Mail Merge for Word and Reports and Analysis for Excel with Oracle CRM On Demand.
-
I can not do the update , what should I do to fix this error ?
"There was a problem with downloading the file . For tips on troubleshooting , please go to Customer Support . ( Error code : 204 ) ." thanksHi,
Please refer to the help document below:
Error downloading, installing, or updating Creative Cloud applications
Regards,
Sheena -
Problem while updating excel file in Km
Hai,
I am using jxl api to generate excel file . I need to update the excel file. for that i am creating tht excel file in temp location , and updating using this code.
excelFile=new File(fileName);
embedDataIntoExcel();
workbook.write();
workbook.close();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/path/excelFile.xls");
IResourceFactory factory =ResourceFactory.getInstance();
IResource folder = (IResource) factory.getResource(rid,context);
FileInputStream fin = new FileInputStream(excelFile);
fin.read();
Content content = new Content(fin,"ms-excel", -1);
folder.updateContent(content);
<b>problem is the excel file is generating with some junk data </b>
how can i solve this
regards,
nagaHai,
I am using jxl api to generate excel file . I need to update the excel file. for that i am creating tht excel file in temp location , and updating using this code.
excelFile=new File(fileName);
embedDataIntoExcel();
workbook.write();
workbook.close();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/path/excelFile.xls");
IResourceFactory factory =ResourceFactory.getInstance();
IResource folder = (IResource) factory.getResource(rid,context);
FileInputStream fin = new FileInputStream(excelFile);
fin.read();
Content content = new Content(fin,"ms-excel", -1);
folder.updateContent(content);
problem is the excel file is generating with some junk data
how can i solve this
regards,
naga -
In SAP Webdynpro using ABAP,how to colour the downloaded excel file?
Hi all Experts'
I have downloaded the data from the webdynpro application into an excel file in the presentation server using a custom button in a layout of a view in the webdynpro component.
Now the requirement is to colour the column heading names and the downloaded excel file should show the full column length.
Could anybody help me on this how to do this two things.
Thanks in advance.Hi,
You can use this function GUI_EXEC.
Let say you want to use winzip to zip the file then what you should do like this:
use this command --> ' -min -a D:\WALCOTT.ZIP D:\MBARANG.TXT'
D:\MBARANG.TXT --> path to the file you want to Zip
D:\WALCOTT.ZIP --> result zip file
The command above is depends on the software you use to zip.
then
DATA: cmdguiexec(150).
cmdguiexec = cmd.
CALL FUNCTION 'GUI_EXEC'
EXPORTING
command = cmdguiexec.
Hope this help you.
Best Regards,
Victor. -
Download Excel file from from a second server
Hi,
In our Java based web application (jsp pages) users need to download Excel files stored on a different server (business tier) than the first application server server that hosts only the presentation tier.
For security reasons users don't access the second application server. From a technical point of view what's the best solution to answer this requirement ? The logic should be the following: the user clicks on a report name that is displayed on this browser, the request is sent to the first application server that will retrieve the report stored on a second server and will return it to the user.
Thanks a lot.it's been a while since i've done ejb stuff, but i believe you can configure an ejb to "runas" a different user. so, you would configure an ejb on the accessible server to "runas" a user who has access to the secondary server.
-
Filename of downloaded Excel file
I frequently download Excel files from a website that seems for the most part windows centric. These excel files have an extension of .xls, I can double click them to open, but when opened they just have the file name of WORKSHEET. If I rename the file in the finder the same thing happens. If I try to open the file in numbers I get something like
<table border="1">
<!-- <tr><td colspan = "15" valign="middle" align="center">Date: 8/1/2008</td></tr>-->
<!-- <tr><td colspan = "15" valign="middle" align="center">Investor's Business Daily Æ</td></tr> -->
<tr><td colspan = "15" valign="middle" align="center">Investor's Business Daily 100</td></tr>
<tr><td colspan = "15" valign="middle" align="center">Data as of 8/1/2008 market close</td></tr>
Any idea? Now I have to open the file in excel, then do a save as, type in the file name (if I don't want WORKBOOK), then delete (or write over) the original file. What can I tell the website people?Hello ,
In my procedure i am passing id and with the help of that id , ia am fetching values from the database.
i have declared on clob type variable say v_insert where i am storing table structure(like worksheet) which i need on excel
example
v_insert := v_insert||'<tr>';
v_insert := v_insert||'<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td><b>Column1_Value</b></td> <td>abc</td>';
v_insert := v_insert||'</tr>';then i am converting that clob into blob and storing the content into BLOB type variable say v_blob
below is the code used for downloding the blob content.
wpg_docload.download_file(v_blob);Thanks,
Jitendra -
Dear All,
I have a problem with an EXCEL file, i'm in a domain with windows server 2003 and all of the computer have windows 7, a user had open 3 weeks ago a fil excel after she gone on holiday so the file remain open (i don't know how) by she.
I've try with all unlocker program to make the file deletable, but not work... it is very strange because if i try to open it with the account of the user that open the file appears always the same error (open read only)...
Could you help me?
thanksHi,
You may end the Excel process first, the “PsTools” have a pskill command that you can use to end a process remotely.
Here’s a simple command:
pskill \\computer –u username -p password excel.exe
For more information, please see the KB below:
http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
Best Regards -
Where are the Download Excel Files going?
Safari 6 seems to download Excel files as requested from a web site but they do not appear anywhere in the Download Folder I have specified. The site successfully downloaded the files before I upgraded to Safari 6. I now have to switch to Firefox to download these files. Where are they going?
Erik Lommers (guest) wrote:
: What happened to the files? Yesterday I tried to download the
: different trunks of the ora805 file and suddenly everything
: stops.
: The ftp-server is there, but the whole linux directory is gone!
: Does anyone have an explanation?
: When will the files be available again?
Point your browser to:
http://www.oracle.com/products/trial/html/trial.html#oracle8
null -
Problem making an Excel file from a jsp
Hi.
I'm developing a web application that uses Excel for printing the reports. So far everything has worked fine, at least for the created Excel files that do not have any images on them. Now I need to create an excel file with an image as the header. I tried adding the necessary code to include the image, but when I open it, the image is not displayed (like when you open an HTML page that could load a certain image). I tried using different ways to set the src to see if maybe the path was the problem, but everytime I got the same result...
How can I do this? How can I include the image and actually display it when the user opens the file in Excel?
Thanks in advance
CyberSpiderI had a similar porblem....
I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
This is my code in servlet...
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("Users");
spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
// Creating Rows
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short) 1);
cell.setCellValue("Year 2005");
cell = row.createCell((short) 2);
cell.setCellValue("Year 2004");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cell = row1.createCell((short) 0);
cell.setCellValue("Revenue ($)");
cell = row1.createCell((short) 1);
cell.setCellValue("25656");
cell = row1.createCell((short) 2);
cell.setCellValue("15457");
FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
ServletOutputStream out = response.getOutputStream();
wb.write(output);
output.flush();
output.close();
forward = null;
In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
Thanks in advance... -
Hi......
I've written a logic for sending mail through FM SO_DOCUMENT_SEND_API1 every thing works fine a get a attachment of the excel file with all the data but when i open the file i get a pop message saying Worksheet setting problem.....and the file does'nt gets open........i'm just wondering what might be the problem.......it was working on well yesterday and now i get this....strange......what might be going wrong........Let me know and correct answers would be surely awarded.........
I use to get a same message for other program's excel file and it still opens the file......but this current excel file seems to be not opening.......Hi,
Better use 'SO_OBJECT_SEND' FM .
Sample code:
Declaration
DATA: lwa_hd_change TYPE sood1,
lt_objcont TYPE STANDARD TABLE OF soli,
lwa_objcont TYPE soli,
lt_receivers TYPE STANDARD TABLE OF soos1,
lwa_receivers TYPE soos1 ,
lt_att_cont TYPE STANDARD TABLE OF soli,
lwa_att_cont TYPE soli,
lt_packing TYPE STANDARD TABLE OF soxpl,
lwa_packing TYPE soxpl,
lf_sent TYPE sonv-flag,
lf_size TYPE i.
CONSTANTS: lc_obj(11) TYPE c VALUE 'BOMSouthco',
lc_desc(20) TYPE c VALUE 'BOM Download',
lc_lang(1) TYPE c VALUE 'E',
lc_raw(3) TYPE c VALUE 'RAW',
lc_net(1) TYPE c VALUE 'U',
lc_mail(4) TYPE c VALUE 'MAIL',
lc_xls(3) TYPE c VALUE 'XLS',
lc_ext(3) TYPE c VALUE 'EXT'.
Passing values to the strutures used in SO_OBJECT_SEND function module
lwa_hd_change-objla = lc_lang.
lwa_hd_change-objnam = lc_obj.
lwa_hd_change-objdes = lc_desc.
lwa_hd_change-objlen = 255.
lwa_objcont-line = text-t29.
APPEND lwa_objcont TO lt_objcont.
CLEAR lwa_objcont.
lwa_receivers-recextnam = text-t31.
lwa_receivers-recesc = lc_net.
lwa_receivers-sndart = lc_mail.
lwa_receivers-sndex = 'X'.
lwa_receivers-sndpri = 1.
lwa_receivers-mailstatus = 'E'.
APPEND lwa_receivers TO lt_receivers.
CLEAR lwa_receivers.
lwa_receivers-recextnam = text-t30.
lwa_receivers-recesc = lc_net.
lwa_receivers-sndart = lc_mail.
lwa_receivers-sndex = 'X'.
lwa_receivers-sndpri = 1.
lwa_receivers-mailstatus = 'E'.
APPEND lwa_receivers TO lt_receivers.
CLEAR lwa_receivers.
Passing values for the attachment file
LOOP AT gt_output INTO gwa_output.
CONCATENATE gf_lf gwa_output-matnr gf_etb gwa_output-idnrk gf_etb
gwa_output-type gf_etb gwa_output-menge gf_etb
gwa_output-meins gf_etb gwa_output-comp gf_etb
INTO lwa_att_cont-line.
APPEND lwa_att_cont TO lt_att_cont.
CLEAR lwa_att_cont.
ENDLOOP.
CHECK lt_att_cont IS NOT INITIAL.
DESCRIBE TABLE lt_att_cont LINES lf_size.
lwa_packing-transf_bin = ' '.
lwa_packing-head_start = 1.
lwa_packing-head_num = 0.
lwa_packing-body_start = 1.
lwa_packing-body_num = lf_size.
lwa_packing-file_ext = lc_xls.
lwa_packing-objlen = lf_size * 255.
lwa_packing-objtp = lc_ext.
lwa_packing-objdes = lc_desc.
lwa_packing-objnam = lc_obj.
APPEND lwa_packing TO lt_packing.
CLEAR lwa_packing.
CHECK gf_error IS NOT INITIAL. "Check if unix file is written
FM to send email to the intended recipients
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = lwa_hd_change
object_type = lc_raw
IMPORTING
sent_to_all = lf_sent
TABLES
objcont = lt_objcont
receivers = lt_receivers
packing_list = lt_packing
att_cont = lt_att_cont
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
OTHERS = 22.
IF sy-subrc = 0.
MESSAGE s004 WITH text-t34.
ENDIF.
COMMIT WORK.
Reward if helpful.
Regards,
Ramya -
Problem in Uploading excel file using WebDynpro for Java
Hi All
I have followed for Uploading excel file using WebDynpro for Java added by Tulasi Palnati
I done all, but I'm getting 500 Exception please contact u r system admin meag at run time also Jxl/Workbook class not found msag but i downloaded Jxl.jar file and there is no error signals in coding part. How can I solve the Problem.
Thanks
PolakaPlease ask the people in the Web Dynpro Java forum for a solution.
-
Hi All,
I am working on a JAVA/JSP application. JSP page passes the user inputs to JAVA page (using POST method) which queries to the database and generate an Excel file and returns the link for that file. I am displaying that link in JSP page ("Your file is successfully saved. Click here to download or view your file).
Now what I want is when the user clicks on the link, open/save dialog will appear which give flexibility to the user to download or view the file in same JSP page. The problem is I don�t want to post again the data or dont want to open a child window. How to set the content type without posting it (I don�t know much about this). Is there any way to do this?
Any help is highly appreciated. Thanx in advance
Cheers
InderpalHi
Iam retreiving a file which is in image type in Ms SQl database, but while im retreiving the data from database using Servlet OutputStream the data is showing in binary format with all speciall symbols and text inside .Iamunable to find the solution for that,
Pleas help me
my code
response.setContentType("application/msword");
OutputStream ros = response.getOutputStream();
ros.flush();
ros.write(bt,0,bt.length);
Thankz for ur help ,
my id: [email protected] -
Problem opening exported Excel file
Hi
We recently experienced a problem that has never occurred before. When trying to open an exported Excel file from a query with hierarchical structures (using the link <SAP_BW_URL DATA_PROVIDER="DP" CMD="EXPORT" FORMAT="XLS"> on the 0ANALYZER template), we are asked to log on to the BEx web, as if it's a Web application. If it is an Excel exported from a hierarchy-free query, then the file open directly without the logon prompt. According to the user, he used to be able to open downloaded hierarchy-expanded data without going through the logon process.
Has anyone experienced the same problem before? Can you share you solution to help us? Thank you in advance!If I understand your issue correctly we used a different fix. Very easy to do.
First, what I believe is happening is that your icons for the hierarchy are being exported as a reference with absolute URL (images can not be exported). This means that when Excel opens the file it tries to resolve the URL and to do that it requires a login.
You can verify that absolute URLS are being exported by opening your excel export in a text processor (its actually XML). Look for URLS that start "http://.../MIME/BEx/Analyser/xxxx.gif". which are icons.
This took us quite a while to figure out because excel was not asking us to log in. It just timed out for each URL reference. Took forever.
The fix we used was to add the following entry to this table on your BW system... (LANG must be empty), Caption is optional:
Table=RSZCONTROLTEXTS,
Entry=
Lang = "",
TARGET_ID="ID_FLAG_XLS_ABS_URL",
CAPTION=Force Excel Export to use relative URLs in XML output for icons
You can experiment with results before you try by editing your XML file (the excel export from web) and removing from those icon URLS the "http:...." up to Mime. This makes it a relative URL. The down side is that it cannot find the icon and displays a box with an X in it. I believe there are techniques for importing icons into excel. They would look like this after surgery <img src="Mime/BEx/Analyzer/hieric2.gif">
If you implement the fix and don't like the effect just remove the entry from the table and all is back to before. I do not believe this is a transportable fix though.
We discovered it when we were pretesting a bunch of service pack upgrades. See SAP note #650887
Hope this helps
Dave Schuh
Maybe you are looking for
-
Printing from my MacBook Pro on my Windows 7 printer.
Until 2 weeks ago I had no issues. I had a Windows XP box with a local Epson printer. From my MacBookPro, I was able to print wirelessly to that printer directly. All I did was select it from my list of printers and off I went. My XP box died. I repl
-
I am getting error 200452 on a channel that is not active. The DAQMX task includes channels from three different devices, I specify only channels from one device as active and it is returning the 200452 error on a channel that was not selected. Que
-
Itunes creating many playlists when dragging mp3's to itunes library
I have an external hard drive, and hooked it up to a new computer. Whe I dragged the mp3 collection to itunes, it created hundreds of playlists, some being albums and some being artists lists. Is there a setting I can change to keep itunes from rand
-
I have an IPhone 4 with software version 4.3.5 (8L1) installed on it. On my windows XP computer I updated I Tunes to 10.4.0.80 and since then my I Tunes quits while synchronizing with my IPhone. before i updated I Tunes everythings was running well.
-
In FCP, there's "open in editor". In Motion, there's only "open in Viewer" and "open in QuickTime". They are pretty useless consider all the files are created in either Photoshop and/or Illustrator. Is there anyway you can change that? Thanks.