In download to excel from bsp hw to increase excel column width to wrap txt
in download to excel from bsp how to increase excel column width to wrap text
in each column.
My client does not want to manually click each cell aftet downloading to excel to see full text in each column
Hi,
You can achieve this by formatting your output using HTML table tag.
Try the following code.
DATA: lv_output TYPE string.
concatenate
'<table border="1">'
'<tr style="font-weight: bold; text-align:center; "><td>Name</td><td width="150">Description</td></tr>' cl_abap_char_utilities=>cr_lf
'<tr><td>First Name</td><td>Some Description goes here..... ....... ...... </td></tr>' cl_abap_char_utilities=>cr_lf
'<tr><td>2nd Name</td><td>XYZ.......</td></tr>' cl_abap_char_utilities=>cr_lf
'</table>'
into lv_output.
response->set_cdata( data = lv_output ).
Regards
Geogy
PS. Reward the useful answers.
Similar Messages
-
Upload/download excel from BSP
Hi all
I am new to BSP's and and need to investigate the following:
Is it possible to create an excel file, manipulate certain cells (e.g. read only, format colours etc.) then export the file to a supplier via the portal. Then read the file and update R3. As the file will be quite large is it possible to compress it?
Thanks
ZaneHi look at these blogs:
/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table
/people/sap.user72/blog/2006/02/07/downloading-data-into-excel-with-format-options
But I don't know any way of communication from the excel-sheet back to the R/3.
Regards,
Steffen -
Download internal table from BSP application to C:\ drive of the user
Hi,
How do we download a internal table data from a BSP application to the C:\ drive of the user. Have tried GUI Download, but it doesn't work. Also don't want a pop up to appear while this is happening. The code has to there in 'OnInputProcessing' event.
Regards,
JaisonHi Raja,
I went through few of the blogs and wrote the below code for downloading data. My requirement is that in the InputProcessing event i need to write a subset of data to the users C:\ drive. But even after doing the below change i'm unable to get the requirement done. Can you please tell me as to what i'm missing. I'm new to BSP development and help would be highly appreciated.
if not it_messages1[] is initial.
clear wa_messages1.
loop at it_messages1 into wa_messages1.
clear temp_string.
concatenate wa_messages1-PROJECT wa_messages1-FILENAME.......
into temp_string separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
concatenate main_string temp_string into main_string separated by
CL_ABAP_CHAR_UTILITIES=>CR_LF.
endloop.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = main_string
MIMETYPE = 'APPLICATION/MSEXCEL;charset=utf-16le'
ENCODING =
IMPORTING
BUFFER = xmain_string.
EXCEPTIONS
FAILED = 1
OTHERS = 2
CALL METHOD cl_bsp_utility=>download
EXPORTING
object_s = xmain_string
content_type = 'APPLICATION/MSEXCEL;charset=utf-16le'
content_disposition = 'attachment;filename=test.xls'
response = mresponse
navigation = navigation.
Edited by: Jaison Yohannan on Jun 3, 2009 2:16 PM -
Download clob contents from function instead of a blob column in a table
I found some examples how to create a download link for data stored in a blob column. However my data is not stored in a blob column but is created in a function returning a clob. Obviously this function can be used to fill a blob column that can then be downloaded but maybe there is a more direct route.
Hello Rene,
I adapted one of my snippets for download-links for your case. The procedure is pretty much the same like the one concerning an existing blob. To provide the download, you need to convert your clob into a blob, which can be done easily by using the corresponding function provided by the [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm]DBMS_LOB-API.
The result might look like the following (untested) code snippet:
CREATE OR REPLACE procedure download_from_function (p_func_argument IN VARCHAR2, p_filename IN VARCHAR2)
AS
l_http_response UTL_HTTP.resp;
l_blob BLOB;
l_raw RAW(32767);
l_length INTEGER;
l_dest_offset INTEGER := 1;
l_src_offset INTEGER := 1;
l_lang_context INTGER := DBMS_LOB.DEFAULT_LANG_CTX;
l_warning INTEGER;
BEGIN
-- Initialize the BLOB.
DBMS_LOB.createtemporary(l_blob, FALSE);
-- replace the function call for src_clob
DBMS_LOB.convertToBlob( dest_lob => l_blob,
src_clob => your_clob_function(p_func_argument),
amount => DBMS_LOB.LOBMAXSIZE,
dest_offset => l_dest_offset,
src_offset => l_src_offset,
blob_csid => DBMS_LOB.DEFAULT_CSID,
lang_context => l_lang_context,
warning => l_warning);
l_length := DBMS_LOB.getlength(l_blob);
-- create response header
OWA_UTIL.mime_header('text/plain', false);
-- add furhter header attributes
htp.p('Content-length: ' || l_length);
htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
-- close the headers
OWA_UTIL.http_header_close;
-- download the BLOB
WPG_DOCLOAD.download_file( l_blob );
-- release BLOB from memory
DBMS_LOB.freetemporary(l_blob);
EXCEPTION
WHEN OTHERS THEN
DBMS_LOB.freetemporary(l_blob);
RAISE;
END download_from_function;
-- Page process before header on blank page
BEGIN
download_from_function (p_func_argument => 'your_argument_for_your_clob_returning_function',
p_filename => 'filename_for_download.txt');
END;You should change function name and arguments to fit your clob-function's signature. You may also want to add a characterset conversion if needed. See the [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm]API-doc for details.
-Udo -
A Fluid Gallery from MySQL using PHP and various column widths
I have decided to try the new Fluid Layout option in Dreamweaver. I pull information from a database (MySQL) and use php to present it.
To show a gallery, I would pull the info and use the repeater code, and something like Tom Muck's horizontal repeater script to create a gallery. The images need to be shown with other text-based information (not just a caption). However, the HR script is a set amount of columns - and I want the number of columns to change depending on the width of the browser.
So it's more than just a gallery - pulling images from a database with Title = "x" these would be a repeated stylised DIV with multiple texts fields and styles within.
Let's take the example of a car dealership website it must show the car image, year, prices, description etc all in different style fonts so it can just be a caption to the image.
So the options are:
A fixed number of columns for each width: Monitor 5, Tablet 3, Mobile 1. Can this be achieved by having a "IF" statement in the actual code, if width = x use this version of the Horizontal Repeater?
A fluid version that has 6 columns and as you slide the browser's width you can see the gallery's width has less columns until it reaches 1 for mobile.
The fluid version would be better.
Any links to a tutorial or example would be most appreciated.
Many thanks
HVRThe only issue with using <divs> instead of a table to create your grid columns is that you will have to set a minimum height on the <divs> to keep them all at the same depth,much like a table cell construction looks and behaves. If you don't set a minimum height the grid will look all ragged PLUS the very big drawback is the <divs> won't clear if another <div> has more content in it which is going to happen if you include a 'description' of the car as this will never be the same length unless you are prepeared to edit the text.
See fluid sample below: You can just populate the <divs> from your database and loop through them
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: verdana;
font-size: 13px;
#pageWrapper {
width: 98%;
max-width: 980px;
margin: 0 auto;
overflow: hidden;
.imageDetails {
width: 22.5%;
float: left;
margin: 0 0 15px 2%;
background-color: #CCC;
padding: 8px 0;
min-height: 200px;
dl {
margin: 0 8px;
padding: 0;
dt {
float: left;
width: 50%;
padding: 0 0 5px 0;
dd {
text-align: right;
padding: 0 0 5px 0;
h3 {
font-size: 13px;
margin: 0;
padding: 8px 8px 5px 8px;
p {
margin: 0;
padding: 0 8px;
@media screen and (max-width: 760px) {
.imageDetails {
width: 30%;
float: left;
margin: 0 0 15px 2%;
background-color: #9F3;
@media screen and (max-width: 480px) {
.imageDetails {
width: 45%;
float: left;
margin: 0 0 15px 2%;
background-color: #FC9;
@media screen and (max-width: 320px) {
.imageDetails {
width: 100%;
float: none;
margin: 0 0 15px 0;
background-color: #9CC;
</style>
</head>
<body>
<div id="pageWrapper">
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car. This is a description about the car. This is a description about the car.</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
</div>
</body>
</html> -
PDF download from BSP application
hi all,
With the bellow code i am able to download to PDF from BSP application
Issue is when i click on the download button waiting popup window is not disappearing even after PDF displayed.
Please help me to resolve how to stop this waiting popup window.
response->delete_header_field( name = 'Cache-Control' ). "#EC NOTEXT
response->delete_header_field( name = 'Expires' ). "#EC NOTEXT
response->delete_header_field( name = 'Pragma' ). "#EC NOTEXT
Deactivated because of Note 904314 and Kompression in Kernel
response->set_compression( options = '4' ).
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field(
name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field(
name = 'content-disposition'
value = 'attachment; filename=candidate.pdf' ).
l_pdf_len = XSTRLEN( l_pdf_xstring ).
response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
navigation->response_complete( ).
Any help on this is highly appreciated.
Thanks,
RaviMay be you can navigate to another page AFTER the response_complete() method and show the message that 'PDF is downloaded successfully'
or something meanful message. so that it will get a response back from server and 'wait...Processing' message might disappear.
I'm not sure and didnt try..may be you can give it a try and let us know..
navigation->response_complete( ).
navigation->goto_page(....) -
Download Text file to Local drive from BSP Application
Hi Guys,
I am new to BSP, and I am doing a BSP application in which i want to download a text file to local drive C: on click of button. For that I am having a data in Internal table and Onclick event, in model class method DO_HANDLE_EVENT i want to download text file to local machine drive.
Can anybody provide me full code with all data declaration and all?
Your help would be appriciable. Thanks in Advance.Hi Jessy ,
You can download the file from BSP pages using the method
CL_BSP_UTILITY=>download.
Please follow the below mentioned steps.
1.Convert the text to a text table ie Internal table with a line type char255 or some others.
2.Convert the text table into a string.
3.Convert the string to XSTRING.
4.Download that XSTRING as text file using the method
CL_BSP_UTILITY=>download.
Parameters:
OBJECT_S - XSTRING data
CONTENT_TYPE = ' application/download'
CONTENT_DISPOSITION = 'attachment; file=test.txt'
RESPONSE = runtime->server->response
NAVIGATION = navigation
OBJECT_T
I dont have system to give a programatical explanation to u.
If you have any doubt kindly post.
Reward for every useful solutions..
Best Regards
Renga -
Stop download to Excel from converting string of digits & dashes into date
Hi,
How can I stop BI and Excel data from converting a column of string data that is comprised of numbers and dashes into a date format when it is downloaded into Excel?
I'd like to solve this problem in BI, so that any users can download the data from a BI report into Excel without having to change the Excel date column back into a string column.
Thanks,
DarcyHi Again Darcy,
hmmm... That is very interesting. I just tried on OBIEE 10.1.3.2 ( a version before yours) on Windows XP with Office 2003 and an Oracle 11g DB backend and it did not have any problems pulling the value as text and not a DATE
Can you try something for me? In a new report, add any old dimensional (year, month name, etc) field twice into the report and change the second column formula to be following: '7001-2'
Try to export that report and see if that value comes through as text or a date. If it is something about the SQL server data set, then the above test should come through as text object in your excel download because we aren't pulling it from SQL Server, we'll creating it directly in OBIEE. If the above test does come through as a date, then it should mean that SQL Server isn't the issue. And if that is the case, I am starting to wonder if there's a setting in Office to can be enabled/disabled to avoid any data casting.
Best regards,
-Joe -
Download to excel in different tabs from bsp page
Hi all,
I have a requirement in which I have to download to xl-sheet in different tabs based on some conditions from a bsp page.
I am successful in downloading data into different tabs.
Now I had written the piece of code required to download to xl in a function module
and I am calling that function module when pressing a button in bsp page.
When I run the fm seperately its working but when I run it from bsp page its not working.But while debugging I found that the fm is being called and executed perfectly without any errors.
But the xl is not being created on our side.
Can anyone suggest me how to proceed on this.
Helpful answers will be rewarded.
Thanks,
UgaHi Raja,
Yes I am using ole objects.
For more clarity I am alos pasting my code.
If this is not possible then please guide how to achieve this in BSP.
*******************CODE*****************************************
include ole2incl.
data: w_cell1 type ole2_object,
w_cell2 type ole2_object.
*--- Ole data Declarations
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
gs_interior type ole2_object, " Pattern
worksheet type ole2_object,
h_cell type ole2_object,
h_cell1 type ole2_object,
range type ole2_object,
h_sheet2 type ole2_object,
h_sheet3 type ole2_object,
gs_font type ole2_object,
flg_stop(1) type c.
Internal table Declaration
data:gt_kna1 type standard table of kna1,
gt_knvv type standard table of knvv,
wa_kna1 type kna1,
wa_knvv type knvv.
types: data1(1500) type c,
ty type table of data1.
data: it type ty with header line,
it_2 type ty with header line,
it_3 type ty with header line,
rec type sy-tfill,
deli(1) type c,
l_amt(18) type c.
data: begin of hex,
tab type x,
end of hex.
field-symbols: <fs> .
constants cns_09(2) type n value 09.
assign deli to <fs> type 'X'.
hex-tab = cns_09.
<fs> = hex-tab.
data gv_sheet_name(20) type c .
SELECT kunnr name1
INTO corresponding fields of table gt_kna1
FROM kna1
UP TO 1000 ROWS.
SELECT kunnr vkorg
INTO corresponding fields of table gt_knvv
FROM knvv
UP TO 3 ROWS.
loop at gt_kna1 into wa_kna1.
concatenate wa_kna1-kunnr wa_kna1-name1 into it separated by deli.
append it.
clear it.
endloop.
loop at gt_knvv into wa_knvv.
concatenate wa_knvv-kunnr wa_knvv-vkorg into it_2 separated by deli.
append it_2.
clear it_2.
endloop.
if h_excel-header = space or h_excel-handle = -1.
*start Excel
create object h_excel 'EXCEL.APPLICATION'.
endif.
call method of h_excel 'Workbooks' = h_mapl.
set property of h_excel 'Visible' = 1.
*add a new workbook
call method of h_mapl 'Add' = h_map.
gv_sheet_name = 'KNA1'.
get property of h_excel 'ACTIVESHEET' = worksheet.
set property of worksheet 'Name' = gv_sheet_name .
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
*CALL METHOD OF gs_cells 'Select' .
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
data l_rc type i.
call method cl_gui_frontend_services=>clipboard_export
importing
data = it[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
*PERFORM err_hdl.
call method of worksheet 'Paste'.
****for second sheet**********
GV_SHEET_NAME = '2ND SHEET'.
gv_sheet_name = 'Knvv'.
get property of h_excel 'Sheets' = h_sheet2 .
call method of h_sheet2 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
get property of h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
call method cl_gui_frontend_services=>clipboard_export
importing
data = it_2[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
PERFORM err_hdl.
call method of worksheet 'Paste'.
Can you people give me inputs so that I can proceed further.
Thanks,
Uga -
Taking download into excel from ALV Grid - header is printing in two lines
Hi All,
I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
I am using function module "Reuse_alv_grid_display" for the purpose.
Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
Thanks in Advance,
ChandanHi..
1. Pass header name in internal table appned first line.
2. after that pass u r data .
3. Use FM. WS_DOWNLOAD
Salil ......
Edited by: salil chavan on Nov 26, 2008 11:07 AM -
How to download a file from AL11 inot Excel format without collapse the col
Hi,
Please suggest how to download a file from AL11 to Excel sheet.currenlty all field are merging into single column.I writing this file via using DATASET.
Regards
RickyHi,
Try this code,
==============================================
TYPES : BEGIN OF ty_emp,
empno(2) TYPE c,
empid(10) TYPE c,
empname(3) TYPE c,
END OF ty_emp.
DATA : it_emp TYPE TABLE OF ty_emp,
wa_emp TYPE ty_emp.
DATA : pbk TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file TYPE rlgrap-filename.
PARAMETERS : p_asfile TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
pbk = p_file.
OPEN DATASET p_asfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET p_asfile INTO wa_emp.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_emp TO it_emp.
ENDDO.
CLOSE DATASET p_asfile.
Filling the already created file with download PS radiobutton
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = pbk
FILETYPE = 'ASC'
append = 'X'
write_field_separator = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_emp
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
==============================================
Regards,
Krrishna -
Issue in downloading excel from SM37
Hi Experts,
I am facing a weird behavior in SM37, I am not able to download all pages of a particular program in excel format on the other side I am able to download 100-500 pages of spool of another programs. In that program's spool, when I am downloading other formats except spreadsheet, all pages are downloading without any error. There is an issue in spreadsheet downloading only.
I have also created a program for that particular program spool's. But facing the same issue.
Below is my code:
REPORT ZSPOOL_DOWNLOAD_XLS.
* TYPE POOLS *
TYPE-POOLS:TRUXS.
* SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_SPOOL TYPE RSPOID,
P_FILE TYPE RLGRAP-FILENAME.
SELECTION-SCREEN: END OF BLOCK B1.
* DATA DECLARATION *
DATA: IT_SPOOL_XLS TYPE TABLE OF CHAR4000,
LVAR_FILE TYPE STRING,
IT_XLS_SPOOL TYPE TABLE OF CHAR4000,
WA_SPOOL_XLS TYPE CHAR4000.
* AT SELECTION-SECREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM FILE_SELECTION.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM SPOOL_DATA.
PERFORM SPOOL_DOWNLOAD.
*& Form FILE_SELECTION
* text
* --> p1 text
* <-- p2 text
FORM FILE_SELECTION .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE.
ENDFORM. " FILE_SELECTION
*& Form SPOOL_DATA
* text
* --> p1 text
* <-- p2 text
FORM SPOOL_DATA .
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
EXPORTING
RQIDENT = P_SPOOL
FIRST_LINE = 1
TABLES
BUFFER = IT_SPOOL_XLS
EXCEPTIONS
NO_SUCH_JOB = 1
NOT_ABAP_LIST = 2
JOB_CONTAINS_NO_DATA = 3
SELECTION_EMPTY = 4
NO_PERMISSION = 5
CAN_NOT_ACCESS = 6
READ_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT IT_SPOOL_XLS INTO WA_SPOOL_XLS..
REPLACE ALL OCCURRENCES OF '|' IN WA_SPOOL_XLS WITH CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
APPEND WA_SPOOL_XLS TO IT_XLS_SPOOL.
ENDLOOP.
ENDFORM. " SPOOL_DATA
*& Form SPOOL_DOWNLOAD
* text
* --> p1 text
* <-- p2 text
FORM SPOOL_DOWNLOAD .
LVAR_FILE = P_FILE.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = LVAR_FILE
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_XLS_SPOOL
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " SPOOL_DOWNLOAD
Please suggest me asap.
Thanks & Regards
Shubhanshu Agrawal.Hello Shubhanshu,
where in your report is something transformed in XLS file? I canot see that. You got your spool number and with help of function RSPO_RETURN_ABAP_SPOOLJOB, your spool list will be transformed into internal table. This internal table will be saved as ASCII then, but no XLS in your coding.
And then the GUI download function deals with ASCII rows, but not with pages. The number of pages when you import ASCII rows in an excel file is definitely NOT the same like in your spool! I do not know any way to compare the page numbers..why so? It goes about the data rows.
Did you have a look at your internal table IT_XLS_SPOOL, if any data row from your spool is listed there?
Regards
Michael -
How to Download displayed output to Excel Using Bsp Application
Hi Experts,
please give me some idea because I am New In BSP.
How to Download displayed output to Excel Using Bsp Application.
If any sample code please do send me.
In my condition I am getting data in 2-3 table view formats on one page and i want download that in Excel.
please help me.
Regards & Thanks,
YogeshHi,
This is more a question for the BSP forum.
Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
runtime->server->response->set_header_field( name = 'Contnet-Type'
value = 'application/vnd.ms-excel' ).
runtime->server->response->delete_header_field( name = 'Cache-Control' ).
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).
Also check threads like
Download BSP data into Excel
export bsp-table to excel
Export BSP Table to Excel
Eddy
PS. Reward useful answers and earn points yourself -
Download to excel from alv display
Hi,
How to download to excel from alv display.I am using object oriented abap for using alv.If i click export->spreadsheet i am getting fatal error and if i export->local file->spreadsheet i am getting only the column names and heading but no contents.Can anyone tell me how to overcome this problem.
Regards,
Sowmya.Hi Sowmya,
Just put break point near FM reuse_alv_grid_display and check if internal table which is used to display output is popullated or not.
Regards Sachin. -
Facing a Problem while downloading the data from ALV Grid to Excel Sheet
Hi Friends,
Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
Can any one help me out in this case.hi...
if this problems happens dont display the same internal as u finally got.
just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
for eg.
ur final internal int table for disp,
data : begin of itab occur 0,
matnr like mara-matnr,
end of itab.
create new like this,
data : begin of itab occur 0,
matnr(12) type N,
end of itab.
Maybe you are looking for
-
Can and how do you buy an iTunes gift card with an Apple Store gift card?
Hi. I received an Apple Store gift card as a gift and really want to buy an iTunes gift card with it. I looked it up and nothing returned, so just checking here to see if you guys know anything. Thanks!
-
Position of new record in a table
When I click CreateInsert button, a new blank record inserted above previously selected record in a table component. May I configure components so after clicking CreateInsert the record appears in the bottom of the list (like last record)? Thanks, Se
-
My laptop y510p has an issue for the third time and i need a replacement
my y510p laptop got an issue for three times and i need a replacement i bought it in april/2014 and more than 2 and half months wasted for maintenance. first time: after few weeks i got problem with screen colors and i sent the laptop and the problem
-
How to call parent constructor from subtype body ?
create or replace TYPE person as object( p_name varchar2(10), p_age NUMBER, p_status CHAR, p_addr addr_type, constructor function person ( p_name char, p_age NUMBER, p_status CHAR, p_addr addr_type ) RETURN SELF AS RESULT )NOT FINAL; -- subclass crea
-
WebDav Very Slow on Windows 7 Pro
Environment: Hosted SharePoint 2010 Two laptops on a Windows Domain: 1) Windows 7 Pro 32-bit & IE11 and 2) Windows 7 Pro 64-bit & IE11. Problem: WebDAV is VERY slow on Windows 7 only. When using WebDAV on Windows 8 or using the web portal (browser),