Need Output in Excel file
Hi,
One Classical report is there, After executing this report i am getting output as per user requirement the output is to save in excel file. Can any body Tell me RH_START_WITH_EXCEL_DATA is sufficent, if s tell me the procedure.
Thanks & Regards,
Raj
Hi,
Please refer to the following program.
Driver program.
report zrich_0001.
data: list type table of abaplist with header line.
data: ascilines(1024) type c occurs 0 with header line.
data: htmllines type table of w3html with header line.
data: istr type table of string with header line.
parameters: d1 type localfile default '/usr/sap/NSP/SYS/Data1.csv'.
start-of-selection.
submit zrich_0002 exporting list to memory and return.
call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.
call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = ascilines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
loop at ascilines.
check sy-tabix > 2.. "Don't include headings
concatenate ascilines+0(10)
ascilines+19(10)
ascilines+39(10)
into istr separated by ','.
append istr.
endloop.
open dataset d1 for output in text mode encoding default.
loop at istr.
transfer istr to d1.
endloop.
The report program.
report zrich_0002.
write:/ 'Field1', at 20 'Field2', at 40 'Field3'.
write:/ 'Field1', at 20 'Field2', at 40 'Field3'.
write:/ 'Field1', at 20 'Field2', at 40 'Field3'.
write:/ 'Field1', at 20 'Field2', at 40 'Field3'.
Of course, parsing your report program is going to be more difficult, but it can be done.
Also, this will only work if the the report program can output its list as a standard list display, if it is forcing an ALV grid, then I think that it can not be retrieved from memory using the funtion module LIST_FROM_MEMORY.
Hope it helps.
Thanks
Rajesh Kumar
Similar Messages
-
How to run the report and show the output in excel file
salam
how to run the report and show the output in excel file,
how to run the report and print the o/p via printer
how to run the report and send the o/p via mail
thank u allHi,
There are Parameters DESTTYPE, DESFORMAT and DESNAME. You can set these parameters to get as you want.
1) Output in Excel File
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'FILE');
ADD_PARAMETER(PL_ID, 'DESFORMAT', TEXT_PARAMETER, 'DELIMITED');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<file_name>.XLS');2) output to printer
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PRINTER');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<printer_name>');3) Email - Have to configure SMTP and all. ( i didn't checked it)
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'MAIL');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<email_id>');Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
Hi All,
I am downloading the ALV output to Excel file.I am making use of LIST--->EXPORT--->SPREADSHEET option.
My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems
1.Even i am getting the empty columns betweeen my output.
2.In the Place of sub totals i am getting astericks
3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top
Thanks,
Ravee...Hello Vinod,
1.I am getting the empty columns betweeen my output.
I am having 16 columns in the ALV output,but i got 19 columns in my excel file.
2.In the Place of sub totals i am getting astericks.
Generally there is no possibility to download the sub totals.i am using LIST->EXPORT->SPREADSHEET.
I am having the sub totals in my output.
*You would have noticed the' * ' for sub total and ' ** ' for grand totals values.*These sub total & total values are not downloaded but these asterisks are carried to excel file.
3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top.
I am using the application tool bar icon only.Still i am getting the same.
Thanks,
Ravee... -
How to download a smartform output as excel file WITH EXACT LAYOUT.
Hi,
I have searched the forum but could not found any satisfactory answer. I have a smartform with a table, some texts and a logo. I have to write a code which will save the smartform output as excel file in the system keeping the layout of the smartform output EXACT.
i.e., the excel file will contain the output with EXACTLY THE SAME layout as would have been for a pdf file (if the smartform output is converted to a pdf file) and the client can then edit the fields of the table in the excel file. How can I achieve this? Please give a suggestion.. Thanks in advance.Hi Anirban,
Your Requirement is to download a smartform to microsoft Excel .
Well unfortunately we can only download data into excel which is in a tabular format i.e stored in internal tables we have function modules to do the same even u can do that using OLE2.
If u try to download a smartform to Excel only format supported will be ASCII, if u will continue with that the smartforms text's will get downloaded to excel but whole data would be downloaded in a single Cell.
Code to do the same is -
>>>>
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = w_form
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = w_fmname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE E002(zcpm) WITH 'Smartform call fails'.
ENDIF.
wa_outopt-tdprinter = v_e_devtype.
wa_ctrlop-no_dialog = 'X'.
wa_ctrlop-getotf = 'X'.
CALL FUNCTION w_fmname "'/1BCDWB/SF00000025'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = WA_CTRLOP
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = WA_OUTOPT
* USER_SETTINGS = ' '
IMPORTING
* DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_OTFDATA
* JOB_OUTPUT_OPTIONS =
* document_output_info = st_document_output_info
* job_output_info = st_job_output_info
* job_output_options = st_job_output_options
TABLES
T_FINAL = T_FINAL
T_ZSDT_WAGONS = T_ZSDT_WAGONS_1
T_QTY = T_QTY
T_QTY1 = T_QTY1
T_CON1 = T_CON1
T_CON2 = T_CON2
"T_ZTMM_OUTWB_TXN = T_ZTMM_OUTWB_TXN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
T_OTF[] = T_OTFDATA-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'ASCII'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if tabix_m = 1.
*CALL METHOD cl_gui_frontend_services=>file_save_dialog
*CHANGING
*filename = w_FILE_NAME
*path = w_FILE_PATH
*fullpath = w_FULL_PATH
** USER_ACTION =
** FILE_ENCODING =
*EXCEPTIONS
*CNTL_ERROR = 1
*ERROR_NO_GUI = 2
*NOT_SUPPORTED_BY_GUI = 3
*others = 4
*IF sy-subrc <> 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL function 'TMP_GUI_BROWSE_FOR_FOLDER'
EXPORTING
WINDOW_TITLE = 'Select A File Folder'
INITIAL_FOLDER = 'C:\'
IMPORTING
SELECTED_FOLDER = W_PATH.
endif.
CONDENSE W_PATH.
concatenate W_PATH '\' wa_final-vbeln '.XLS' into w_FULL_PATH.
****************************************************************************Saving the PDF file on to Application server************************
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = w_bin_filesize
FILENAME = w_FULL_PATH
FILETYPE = 'BIN'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = w_filesize
TABLES
DATA_TAB = t_pdf_tab
* FIELDNAMES =
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
As u said ,u want to download a smartform to Excel it could be done but only if u r using a internal table and exactly printing line by line values in the smartform, But if u are performing calculation in between, using multiple internal table Work areas, structures, etc i.e if whole smartform is developed with many distributed windows , unfortunately it wont be possible to download a smartform to excel in such cases, because the whole output comes from multiple internal tables, calculations, etc all the data is not printed in a tabular manner so in such a case it would be just impossible to download the smartform to excel.
But we definitely have a workaround which could be done to download the data into excel.
you can develop a ALV report with a header and footer u can define the header and footer of the alv according to the smartform and the middle portion would contain the tabular kind of data which u must be using as Smartform table to print the same.
So if u have a similar kind of smartform with some header data, tabular data, and some footer data, then u can use ALV to do the same thing , advantage with ALV would be that u can easily download the same into excel.
Other alternative is that u can Convert and download the smartform to PDF and copy the same to an Excel wooksheet.
These are all the possibilities with which u can do the same.
Regards,
Akash Rana -
Q: XML Publisher build template on Word then Output to Excel file
Hi All
When create template on MS-Word then output to Excel file
When Data Format include percentage then output to Excel The Excel just only show two decimal
Ex: 9.6549% Excel show ->9.65%
* Except 9.6549% on Excel *
Thanks
JohnsonHi
What version of XML/BI Publisher you have?
Thanks
Ravi -
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 -
Need to open excel file and read comment field on ipad
Hi,
I need to open excel files on my ipad and read the comment fields that our ofiice wrote for me . But this doesn´t work .
I tried it over several apps (office2HD, etc.) but with no result.
It´s also necessary to work on our office google drive for me ..
Can someone help me with this problem???
BR
GunnarCALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 4
i_end_col = 12
i_end_row = 60000
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT it_excel[] IS INITIAL.
SORT it_excel BY row col.
LOOP AT it_excel.
CASE it_excel-col.
WHEN 1.
it_file-hiden = it_excel-value.
WHEN 2.
it_file-budat = it_excel-value.
WHEN 3.
it_file-ltext = it_excel-value.
WHEN 4.
it_file-subsystem = it_excel-value.
WHEN 5.
it_file-work = it_excel-value.
WHEN 6.
it_file-role = it_excel-value.
WHEN 7.
it_file-sgtxt = it_excel-value.
WHEN 8.
it_file-company = it_excel-value.
WHEN 9.
it_file-megbtr = it_excel-value.
WHEN 10.
it_file-realbtr = it_excel-value.
WHEN 11.
it_file-comment = it_excel-value.
ENDCASE.
AT END OF row.
APPEND it_file.
CLEAR it_file.
ENDAT.
ENDLOOP.
ELSE.
MESSAGE i000 WITH 'The input file is empty'.
STOP.
ENDIF. -
Hi Friends,
I want to save the ALV output as a excel file on local drive.
From the ALV output, I am using menu path : Views --> Microsoft Excel (Ctrl + Shift + F7) to switch from ALV to Excel mode.
It is switched to excel mode but not showing any data in the columns?
If I use the Path: List --> Export --> Local File --> Spread Sheet --> Gave excel file name.
Here, I am not able get data for all columns. Some columns are not being displayed.
What is the problem in this? Is this coding error? Do we need to apply any OSS notes?
Thanks in advance,
SreeniHi soumya,
I want to download from standard functionality only, that means I want to download using standard menu paths only.
I have tried giving .csv file also, but not able to download all fields. It is missing first 4 fields and downloading all the remaining
fields.
Please try to through some light on it.
Thanks in advance,
Sreenivas reddy -
ALV report output to excel file, zip it and send to email
my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
has anyone had the same requirement before?
Would be thankful to your input guys, thanks!any ideas guys?
-
Problem while downloading the alv output to excel file.
Hii,
While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
Cant put in txt file as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
So what are the other ways to do so.
Edited by: mansi_v27 on Mar 24, 2010 12:35 PMHi,
Welcome to SCN!!!.
Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
Thanks,
Vinod. -
Regarding ALV output to Excel file download
Hi all,
i had a requirement when downloading the ALV output to the Excel file it should ask for the password.if the user enters the password then this pass word shuld be assigned to the Excel file that was downloaded.
Can i know how this can be implementedHi,
Using EXCEL_OLE_STANDARD_DAT you can specify the PASSWORD & PASSWORD OPTION.
Regards,
Sharat -
Need to generate excel file with different sheets
Hi,
I need to generate the excel file with diffrent sheets . Currently I am generating the data in three diffrent excel files
and my requirement is to generate this in a single excel file with diffrent sheets.
Please help on this
Thanks & Regards,
Krishna VyavahareI'm not able to realize how Oracle will help in the problem. You may probably want to look at some [.net forums|http://www.google.com.sg/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS280&q=.net+forums&btnG=Google+Search&meta=lr%3D] about this.
Cheers
Sarma. -
Save ALV report output as excel file in background
Hi all,
As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
And any limitation?
Thanks!Try to create ALV output to spool in background then try to use any of the below mentioned fm
SAP_CONVERT_TO_XLS_FORMAT
MS_EXCEL_OLE_STANDARD_DAT
RSPO_DOWNLOAD_SPOOLJOB
RH_START_EXCEL_WITH_DATA
or
create CSV using OPEN DATASET & TRANSFER
a® -
Convert report output into excel file
hiii,
Can we convert output of report into excel file format?
Plz tell me the.
Thanks in advanceHello,
http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_paptoexcel.htm
29 Building a Report for Spreadsheet Output
Regards -
Regarding ME2L - Download output to Excel File
Hi Friends,
In ME2L, I have requirement to download the Purchasing Documents Per Vendor Report Output to a Excel File.
Could be helpful is there any UserExit or Enhancement point to modified or Can let me know how to do this.
Regards,
sg.Hi,
Go to me2l tcode.....then change the "Scope of List" into "ALV".....and execute it.....now on the tool bar...click on "LOCAL FILE"....now select the radio button "Spreadsheet".....and perform your work..
Arunima
Maybe you are looking for
-
How do you sync your iPad with apple tv
I'm trying to sync my iPad to my apple tv so that I can live stream free movies/tv shows - anyone know how to do this? Thanks for your help
-
Connecting a Printer to USB and AirPort Express Simultaneously
I have a Samsung laserprinter - the only connection on it is USB. I currently have this connected to a XP laptop. Aswell as connecting it to my XP laptop, I wish to share the printer around the house. The other computers around the house are a combin
-
Hi, I'm trying to export my first Blu-Ray today and I'm getting an error. It says, " Share Failure: HOST (............local) Final Cut Pro generated an error or unexpectedly quit. It has also said, "Share Failure. An Internal error occurred: Apple Qm
-
TS1702 How do I cancel youtube App? Will not delete like other Apps.
How do I cancel a youtube App on my Iphone4 ? Will not cancel like other Apps.
-
Help please, Help please
i get this message when i tried to download Maverick from app store.. we could not complete your purchase INSTALL DISTRIBUTION ERROR SIGNED BY APPLE I FIT lll the specs on my imac , even got the migration software update to maverick today.. any idea