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,
Yogesh
Hi,
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
Similar Messages
-
HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE
Hi SAP Gurus,
I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.You can transfer the contents of internal table to excel using this code..
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of itab.
select vbeln
posnr
from vbap
up to 20 rows
into table itab.
* EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
* handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_WORK TYPE OLE2_OBJECT,
H_SHEET TYPE OLE2_OBJECT,
H_CELL TYPE OLE2_OBJECT,
V_COL LIKE SY-TABIX. " column number of the cell
DATA:
V_STEP(30),
V_FILE LIKE RLGRAP-FILENAME.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Creating Excel...'
EXCEPTIONS
OTHERS = 1.
* start Excel
V_STEP = 'Starting Excel'.
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
* CALL METHOD OF H_EXCEL 'OPEN' EXPORTING #1 = 'C:DMC_REC.XLS'.
* PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* Get the list of workbooks
V_STEP = 'Preaparing Excel'.
CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
PERFORM ERR_HDL.
** Add new workbook (create a file)
CALL METHOD OF H_WORK 'ADD'.
PERFORM ERR_HDL.
* Get the created worksheet
************************Sheet Number
CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
************************Sheet Number
PERFORM ERR_HDL.
* Activate (select) the first sheet
CALL METHOD OF H_SHEET 'ACTIVATE'.
PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
V_STEP = 'Adding data to Excel'.
LOOP AT ITAB.
V_COL = SY-TABIX.
PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
ENDLOOP.
V_STEP = 'Releasing Excel'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
H_EXCEL-HANDLE = -1.
*& Form ERR_HDL
* text
* --> p1 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Error in processing Excel File:', V_STEP.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*& Form FILL_CELL
* text
* -->P_1 text
* -->P_1 text
* -->P_1 text
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_CELL
EXPORTING #1 = ROW #2 = COL.
PERFORM ERR_HDL.
SET PROPERTY OF H_CELL 'Value' = VAL .
PERFORM ERR_HDL.
ENDFORM. " FILL_CELL -
How to download report output to excel file??
Hi all,
I have a problem with downloading a report output to an excel file? May i know is there any functions or methods to do it?
My situation is like this. I used Write function to print out the report. After user click on the execute button. The report output will show to the user in a table format. And there is one button 'Save To Excel' in the report output dipslay screen for user to click to save it into excel format.
Appreciate if you could help.
Thanks.
Regards,
RachelHi Rachel,
You can use FM GUI_DOWNLOAD for transferring the data from your report program into excel sheet.
And while saving give the filename extension as .xls.
Reward if helpful.
With regards,
Syed -
How to download the output of two reports in WebTemplate into excel sheet?
How to download the output of webtemplate which consists of two reports in one Web Template into same Excel sheet?
hi sunil,
here is the HTML code for 'export to excel'
<!-- Display Export Excel--->
<td class="SAPBEXNavLine"> <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 ></td>
you can also use BEx download scheduler to download the precalculated webtemplate report to excel sheet.
Check the link below.
https://websmp104.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000401962004E
i think this will help u
regards,
sindhu. -
Download ALV output to excel with formatting
Hi All,
i want to download ALV output to excel sheet and the uneditable fields in ALV oputput should be locked (uneditable) in excel also.
Can you please tell me approach to achieve this functionality?
Thanks in advance.Thanks Vamsi. Your Suggestion was helpful.
I have used excel integration and used SET PROPERTY OF (COLUMN) 'LOCKED' = 1.
For more details refer below mentioned link.
http://webcache.googleusercontent.com/search?q=cache:SoY6hFC17PoJ:wiki.sdn.sap.com/wiki/display/Snippets/Download%2BData%2Binto%2BMultiple%2BSheet%2BExcel%2BDocument%2Bwith%2BNon%2BEditable%2BColumns%2B(Password%2Bprotected)%2BUsing%2BABAP%2BOLESetPropertynoteditableexcelsapABAP&cd=1&hl=en&ct=clnk&gl=in&source=www.google.co.in (http://webcache.googleusercontent.com/search?q=cache:SoY6hFC17PoJ:wiki.sdn.sap.com/wiki/display/Snippets/Download%2BData%2Binto%2BMultiple%2BSheet%2BExcel%2BDocument%2Bwith%2BNon%2BEditable%2BColumns%2B%28Password%2Bprotected%29%2BUsing%2BABAP%2BOLESetPropertynoteditableexcelsapABAP&cd=1&hl=en&ct=clnk&gl=in&source=www.google.co.in -
Download the output into Excel...(List- export- spreadsheet)
Dear friends,
I want to download the output into Excel...
I am using all SAP standards and using the ALV Block list
Ex: List->export->local file.. is anable from here i can download to excell .....but the same there is anothere option : List->export->spreadsheet...( this one inactive.)
I want to activate the List->export->spreadsheet option.
how to do this???
Thanks,
Sridhar.Hi
Use the Function Module:
EXCEL_OLE_STANDARD_DAT
For your purpose.
But by default you can get the option to download into several formats including your desired one.
Regards,
Sreeram -
How to download the values to excel from spool sap abap
Dear All,
I am facing a problem in downloading the Zreport to excel file ( where it consists of 95 fields) ,
1.if am running the report in foreground and downlaod to excel file , the all 95 fields are upadting in excel file .
2.if i am schecduling the programe in background and saving inspool, then form spool , i am download to excel file , at that time some of the fields are overllapning ,
for this i want to download t o excel file without overlapping fields,
can any one suggest , how to do same procedue.
regards,
manoranjanHi,
whenever you click on Excel download option select spreadsheet instead of unconverted
There is a possibility of download the spool file as txt-file. .
Use Tranx SP01 - select the spool entry -->"spool request --> forward as text . You will find the file in your SAP work directory as <sid><spool#>.
or use fm RSPO_DOWNLOAD_SPOOLJOB.
Download in Background in Excel Format
How to download the data in excel format directly while executing in background mode?
If you will execute it in bacground with ws_download or download, it will be aoutomatically cancel. so what is the procedure to do this. How is can directly read the spool from program?
Download from background is possible, if you could setup the environment
1. create a custom table first
Table : Y001
Displayed fields: 4 of 4 Fixed columns:
MANDT BNAME Y_SITE Y_PATH
010 <userid> <site> cd <novell_path>
2. rewrite ws_download to z_download (light modification required, see attachment)
3. ask your basis team to make a copy of command FTP and CHMOD to ZFTP and ZCHMOD resp., make the setting according to your environment.
Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
Hope this will will helps you,
Thanks and Regards,
Manjunath M
Edited by: manjunath4sap on Dec 23, 2010 6:20 PM
Edited by: Rob Burbank on Dec 23, 2010 9:02 PM -
How to download the output of a report along with column header
Hi,
Could someone please tell me on how to download the output of a report along with column header to .txt format. A download option needs to be given to the user using physical and logical file names .The report basically contains header details and item details and requirement is to download the same format into an .txt format.Hello,
Try this FM:
Data: being of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
end of itab.
data:begin of fld_tab occurs 0,
fld_name(20),
end of fld_tab.
fld_tab = 'Material'.
append fld_tab.
fld_tab = 'Material Desc'.
append fld_tab.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'C:\1.txt '
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES = fld_tab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
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,
Naimesh -
How to export report output into excel.
Hi all
how to export report output into excel sheet can any on give me answer step by step please as soon as possible
kkHi Prashanth,
If you are executing Query from WAD ---> Right click on Table (only on Characteristics Data) --> Enhanced Menu ---> Export as --> CSV file or MS Excel
assign points if this helps,
Thanks,
Sudhakar -
Hi,
I am new to BODS.Is it possible to have an set of records as output in Excel using BODS. I really appreciate your quick response.
Thanks,
KumarHi Kumar,
In the current version 3.2, BODS only accepts Excel as a source file. However, you can create CSV and other flat files that you can import into Excel, or you can import XML target files, or export to a database and create an Excel extract.
Using Excel as a target format is not supported.
Christian -
Problem in downloading alv output to spreadsheet using sap standard downlo.
Hi all,
I have an ALV report Output of approx 120 columns , But when I am downloading the output to spreadsheet using standard download button , thefile is downloaded but the columns in multiple lines, is there any method/setting by which i can download the column output in same line. using the same sap standard button
thanks
bobbyanswered
-
How to set Border in the Excel using UTL_FILE ?
Hi all,
Any one aware of
How to set Border in the Excel using UTL_FILE ?
Am doing excel creation from a stored procedure.
Thanks
DoraHello Dora,
if you need more than simple csv: at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the package behind the second link supports defining your own formats (and has a tutorial how to do it).
Regards
Marcus -
How can I execute a query from a BSP application?
How can I execute a query from a BSP application?
I´m trying to execute a Query from intranet. I´ve been looking for examples, but the templates I´ve found doesn´t help me.
does anybody has an example?
Thanks.Hi
Have you designed the BSP application ?
design it first with one page
page will have layout and Event handlers
Design the layout with the fields
in the event handler there are events
in the event On Initiailization or ON inputprocessing write the select query similar to what we write in routine ABAp and fetch the data into ITAB and that has to be passed to the Layout
see the doc
BSP
To learn how to create Web applications with Business Server Pages, you can work through the simple tutorials that build on each other. You should be able to run through all of the steps described here in your own system.
If you want to develop Web applications with BSPs, your system must meet the following requirements: Prerequisites for Creating Web Applications.
The following tutorials are available:
· First Tutorial: First Steps with Business Server Pages
· Second tutorial: A Small BSP Application and A Small BSP Application with HTMLB
· Third tutorial: Our First Online Bookshop
· Fourth tutorial: Further Developing the Bookshop
· A small Tutorial is also available for your first steps with the Model View Controller design pattern.
· For a more complex MVC tutorial based on the third tutorial, see: Our Little Online Bookshop Using MVC and HTMLB
When creating BSP applications, note the browser dependencies described in Note 598860.
steps:
1) start the transaction RZ10.
2) now u u have to select Profile name, so select the INSTANCE Profile from the list of options given with the Profile parameter list.U may find multiple instance profile in the list, so select the profile in which ur server name is given.
3) u will also find three options in the same window.
Administrator data, Basic Maintenance, and Extended Maintenance. So select the last one from that.
4) Now click on change button.
5) here u will find parameter icm/host_name_full, so now set it as FQDN.
6) Now copy ur settings with new version number.
7) Activate that version.
8) And now please restart ur WAS.
So this will set ur FQDN, and also don't forget to login using Admin User.
Now u also check for following service are active in your ICF setting or not,( just start transaction code SICF)
/default_host/sap/bc/bsp/sap
/default_host/sap/bc/bsp/sap/system
/default_host/sap/bc/bsp/sap/public/bc
/def ault_host/sap/public/bc
/default_host/sap/public/bc/ur
/default_host/sap/public/bsp/sap/public
/default_host/sap/public/bsp/sap/public/bc
/defaul t_host/sap/public/bsp/sap/system
/default_host/sap/public/bsp/sap/htmlb
if not then activate all.
check this link
Read this weblog...
/people/brian.mckellar/blog/2003/09/25/bsp-in-depth-fully-qualified-domain-names
http://www.thespot4sap.com/articles/SAP_WAS_Creating_BSP_Apps.asp
it consists of screen shots also
Check it.
http://help.sap.com/saphelp_nw04/helpdata/en/c8/101c3a1cf1c54be10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/e9/bb153aab4a0c0ee10000000a114084/frameset.htm
Regards
Anji -
How to Download ALV Output LOGO to Excel ?
Hi
I have Used the LOGO in ALV Output. Iam getting the LOGO through REUSE_ALV_GRID_DISPLAY. If i download the Data to Excel file, the LOGO is not coming. How to solve this problem.
Thanks & Regards,
N.L.Hi,
I had a sample code wich will insert LOGO from PRESENTATION server into excel / word.
TYPE-POOLS ole2.
DATA:
o_word TYPE ole2_object,
excel TYPE ole2_object,
o_documents TYPE ole2_object,
o_actdoc TYPE ole2_object,
o_inlineshapes TYPE ole2_object,
o_logo TYPE ole2_object,
WORKBOOK TYPE ole2_object.
*CREATE OBJECT o_word 'Word.Application'.
CREATE OBJECT EXCEL 'Excel.Application'.
*FREE OBJECT EXCEL.
*SET PROPERTY OF o_word 'Visible' = '1'.
SET PROPERTY OF excel 'Visible' = '1'.
*GET PROPERTY OF o_word 'Documents' = o_documents.
GET PROPERTY OF excel 'Documents' = o_documents.
CALL METHOD OF o_documents 'Add' = o_actdoc.
CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK.
GET PROPERTY OF o_actdoc 'InlineShapes' = o_inlineshapes.
CALL METHOD OF o_inlineshapes 'AddPicture' = o_logo
EXPORTING
#1 = 'C:\Temp\OTHERS\Scrap\COMPANY_LOGO.BMP'
#2 = 0
#3 = 1.
WRITE: / 'Test'.
Let us see if some one will come out with good idea/Example.
Thanks. -
we are having a zreport.
i am not having problem in the program.
everything is fine.once the output is
generated we will download the displayed output ( ie first
the user will see the output in the screen then if he want
he will download with the help of menu option given by sap)
into spreadsheet or html format or
richtext format etc , by clicking the option list->save list in file->spreedshet.
this we can see in foreground.
but once we execute the report in background how can we download the displayed report output into
excel.Hi,
When ever we run a report in back ground the output will be stored in spool. So download data from spool.
Check transactions SP01/SP02 to get the spools or system variable sy-spono.
Open ur spool number in SP01, Click on the icon(Page like thing), Here u will see ur output. Now from the standard SAP functionality as we have in foreground can be used to download.
Thanks,
Vinod.
Edited by: Vinod Reddy Vemuru on Jul 10, 2008 3:06 PM
Maybe you are looking for
-
No option to print in black only
PROBLEM: Do not have an option to print with BLACK ink only. Background: Have a Photosmart D5160 printer. Up until a few weeks ago experienced no problems with printer. Then installed non-HP ink carts and experienced some faults. About this same time
-
Special G/L indicator or alternative reconciliation accounts in RH
HI. Is possible to use special G/L indicator or alternative reconciliation accounts in RH ? I have a employee that is registered as vendor too.. and I need to post 2 diferents accounts from RH, it's possible ? I'll assign good points.
-
ABAP Classical Report in background
Hi, I have written a ABAP classical report, when i run in foreground the format of the report works fine. When i run the same report in background the format of the report is changing. I.e end of page triggers in between the page. I am dynamically ha
-
SCANNER UPDATES FOR EPSON v500 not available for maverick?
OK - I updated to MAverick and have no scanner. You know, the little white circle with the line through it, indicating that the woftware and drivers will not work on Maverick. So, I went to Epson (I have Epson perfection v500 photo scanner), and th
-
Can I retrieve data I had before I updated with a backup?
I just got a new iPhone 3Gs to replace a 3G that I lost. After I activated it, I received and sent a bunch of new text messages and added a few contacts. Then I synced it with my computer and used a backup that I had made on 7/14/09. I should've seen