Download output in excel
Hi experts,
I am running my program in backgroung mode.I want to get output in excel in given path on my PC.How to do this.
Please help me.
check out this link and particularly the responses from Ram Manohar Tiwari
Re: Move a file from external server to SAP server
Regards
Raja
Similar Messages
-
How to download output into Excel with Header?
Dear Friends,
I want to download a my list output into excel format with <b>Column heading</b>. How will I do this?
Another question is i want name of database table in Which SAP stores <b>DDIC object name and its property</b>, so that i can write Select * from ' ' where .... For example i have table ZABC with three fields so i need In which table it stores ZABC as table and a table in which it stores Its field name.Hi,
Look at the sample code for Download into Excel.
data: begin of excel_sum_it occurs 0,
bukrs(80),
belnr(80),
gjahr(80),
blart(80),
budat like bkpf-budat,
monat(80),
cpudt like bkpf-cpudt,
cputm like bkpf-cputm,
usnam(80),
tcode(80),
xblnr(80),
waers(80),
dwrbtr(25),
cwrbtr(25),
end of excel_sum_it.
data: begin of titles_it occurs 10,
title(80),
end of titles_it.
at user-command.
case sy-ucomm.
when 'SUMMARY'.
perform summary_download.
when 'DETAIL'.
perform detail_download.
when others.
endcase.
******Create one PF-STATUS for one push button for download.
Before this FM you need to move your date to Execl_sum_it Internal table.
For example here I used this table for down load.
*& Form summary_download
text
--> p1 text
<-- p2 text
form summary_download.
data: fname like rlgrap-filename value 'Summary_Details.xls'.
perform fill_titles.
check not excel_sum_it[] is initial.
call function 'DOWNLOAD'
exporting
filename = fname
filetype = 'DAT'
tables
data_tab = excel_sum_it
fieldnames = titles_it
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.
if sy-subrc ne 0.
message e000 with text-e07.
endif.
endform. " summary_download
*& Form fill_titles
text
--> p1 text
<-- p2 text
form fill_titles.
refresh titles_it.
concatenate text-h06 text-h16 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h17 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h18 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h19 into titles_it-title
separated by space.
append titles_it.
concatenate text-h09 text-h20 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h21 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h22 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h23 into titles_it-title
separated by space.
append titles_it.
concatenate text-h12 text-h24 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h25 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h26 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h28 into titles_it-title
separated by space.
append titles_it.
concatenate text-h14 text-h27 into titles_it-title
separated by space.
append titles_it.
concatenate text-h15 text-h27 into titles_it-title
separated by space.
append titles_it.
endform. " fill_titles
***Here in the FILL_TITLES you give you own HEADER .
Thanks.
If this helps you reward with points. -
Error while downloading output in excel format using FM Gui_download
Hello All,
<removed by moderator>
While downloading the necessary output of a Ztransaction in excel format the excel file only shows one 1 record whereas in the output there were 88 records.
When I am downloading it in other formats like Rich text etc. the data is getting downloaded correctly as per the output.
Now this problem is occuring in Production & Quality whereas in Development the excel file is downloading data correctly.
I have compared the code in the different clients as well as debugged it but the code is the same in each case.
There is no data corruption in the final internal table as well.
So what else can be done?....
The data needs to be downloaded as it is in the output in the excel format.
Kindly give me some suggestion and help me out in this regard.
Edited by: Thomas Zloch on Nov 1, 2011 10:04 AMHi,
Did you the use the GUO_download using the following values:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = fullpath
filetype = 'ASC'
codepage = space
write_bom = 'X'
TABLES -
Download output to excel in graphical form.
Hi,
I have a requirement in my project that has to download ouput of a report to a Excel sheet with a Graph I found some sample program for that. But right now the program is downloading in a Bar Chart Format . I have to chage this parameter to a Line Chart. In the program I am attaching in line 221 the chart type has been specified as vertical bar chart. I know I need to chage this parameter but I am not able to figure out how to do it or what is the value I need to set it to. Can u help me in this in any way or send me some informative material which would help me in this.
Please create a report and see the output after executing.
The Code is
*& Report ZNEGI9 *
REPORT ZNEGI9 NO STANDARD PAGE HEADING.
INCLUDE ole2incl .
DATA: gs_excel TYPE ole2_object ,
gs_wbooklist TYPE ole2_object ,
gs_application TYPE ole2_object ,
gs_wbook TYPE ole2_object ,
gs_activesheet TYPE ole2_object ,
gs_sheets TYPE ole2_object ,
gs_newsheet TYPE ole2_object ,
gs_cell1 TYPE ole2_object ,
gs_cell2 TYPE ole2_object ,
gs_cells TYPE ole2_object ,
gs_range TYPE ole2_object ,
gs_font TYPE ole2_object ,
gs_interior TYPE ole2_object ,
gs_columns TYPE ole2_object ,
gs_charts TYPE ole2_object ,
gs_chart TYPE ole2_object ,
gs_charttitle TYPE ole2_object ,
gs_charttitlechar TYPE ole2_object ,
gs_chartobjects TYPE ole2_object .
DATA gv_sheet_name(20) TYPE c .
DATA gv_outer_index LIKE sy-index .
DATA gv_intex(2) TYPE c .
DATA gv_line_cntr TYPE i . "line counter
DATA gv_linno TYPE i . "line number
DATA gv_colno TYPE i . "column number
DATA gv_value TYPE i . "data
PARAMETERS: p_sheets TYPE i .
START-OF-SELECTION .
DO p_sheets TIMES .
*--Forming sheet name
gv_intex = sy-index .
gv_outer_index = sy-index .
CONCATENATE 'Excel Sheet #' gv_intex INTO gv_sheet_name .
*--For the first loop, Excel is initiated and one new sheet is added
IF sy-index = 1 .
CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF gs_excel 'Visible' = 1 .
GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooklist .
GET PROPERTY OF gs_wbooklist 'Application' = gs_application .
SET PROPERTY OF gs_application 'SheetsInNewWorkbook' = 1 .
CALL METHOD OF gs_wbooklist 'Add' = gs_wbook .
GET PROPERTY OF gs_application 'ActiveSheet' = gs_activesheet .
SET PROPERTY OF gs_activesheet 'Name' = gv_sheet_name .
*--For the rest of loops, other sheets are added
ELSE .
GET PROPERTY OF gs_wbook 'Sheets' = gs_sheets .
CALL METHOD OF gs_sheets 'Add' = gs_newsheet .
SET PROPERTY OF gs_newsheet 'Name' = gv_sheet_name .
ENDIF .
gv_line_cntr = 1 . "line counter
*--Title
*--Selecting cell area to be merged.
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = 1
#2 = 1.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING
#1 = 1
#2 = 4.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING
#1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
*--Merging
CALL METHOD OF gs_cells 'Merge' .
*--Setting title data
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 1.
SET PROPERTY OF gs_cell1 'Value' = 'KISHAN' .
*--Formatting the title
GET PROPERTY OF gs_cell1 'Font' = gs_font .
SET PROPERTY OF gs_font 'Underline' = 2 .
SET PROPERTY OF gs_font 'Bold' = 1 .
SET PROPERTY OF gs_cell1 'HorizontalAlignment' = -4108 .
GET PROPERTY OF gs_cell1 'Interior' = gs_interior .
SET PROPERTY OF gs_interior 'ColorIndex' = 15 .
SET PROPERTY OF gs_interior 'Pattern' = -4124 .
SET PROPERTY OF gs_interior 'PatternColorIndex' = -4105 .
gv_line_cntr = gv_line_cntr + 1 .
*--Writing some additional data for the title
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 1.
SET PROPERTY OF gs_cell1 'Value' = 'Sheet No' .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 5.
SET PROPERTY OF gs_cell1 'Value' = ':' .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 6.
SET PROPERTY OF gs_cell1 'Value' = gv_intex .
*--Formatting the area of additional data 1
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = 1
#2 = 1.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING
#1 = gv_line_cntr
#2 = 5.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING
#1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
GET PROPERTY OF gs_cells 'Font' = gs_font .
SET PROPERTY OF gs_font 'Bold' = 1 .
*--Formatting the area of additional data 2
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = 1
#2 = 5.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING
#1 = gv_line_cntr
#2 = 5.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING
#1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
GET PROPERTY OF gs_cells 'Columns' = gs_columns .
CALL METHOD OF gs_columns 'AutoFit' .
*--Bordering title data area
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = 1
#2 = 1.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING
#1 = gv_line_cntr
#2 = 6.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING
#1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
CALL METHOD OF gs_cells 'BorderAround'
EXPORTING
#1 = 1 "continuous line
#2 = 4. "thick
*--Putting axis labels
gv_colno = 2 .
gv_line_cntr = gv_line_cntr + 5 .
gv_linno = gv_line_cntr - 1 .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_linno
#2 = 1.
SET PROPERTY OF gs_cell1 'Value' = 'X' .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 1.
SET PROPERTY OF gs_cell1 'Value' = 'Y' .
*--Generating some data
DO 3 TIMES .
gv_value = gv_outer_index * sy-index * 10 .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_linno
#2 = gv_colno.
SET PROPERTY OF gs_cell1 'Value' = sy-index .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = gv_colno.
SET PROPERTY OF gs_cell1 'Value' = gv_value .
gv_colno = gv_colno + 1 .
ENDDO .
*--Source data area
gv_colno = gv_colno - 1 .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING #1 = gv_linno
#2 = 1.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING #1 = gv_line_cntr
#2 = gv_colno.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING #1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
GET PROPERTY OF gs_application 'Charts' = gs_charts .
CALL METHOD OF gs_charts 'Add' = gs_chart .
CALL METHOD OF gs_chart 'Activate' .
SET PROPERTY OF gs_chart 'ChartType' = '51' . "Vertical bar graph
CALL METHOD OF gs_chart 'SetSourceData'
EXPORTING #1 = gs_cells
#2 = 1.
SET PROPERTY OF gs_chart 'HasTitle' = 1 .
GET PROPERTY OF gs_chart 'ChartTitle' = gs_charttitle .
GET PROPERTY OF gs_charttitle 'Characters' = gs_charttitlechar .
SET PROPERTY OF gs_charttitlechar 'Text' = 'Sample Graph' .
*--Locate the chart onto the current worksheet
*--Activate current sheet
CALL METHOD OF gs_excel 'WorkSheets' = gs_activesheet
EXPORTING #1 = gv_sheet_name.
CALL METHOD OF gs_activesheet 'Activate' .
CALL METHOD OF gs_chart 'Location'
EXPORTING #1 = 2
#2 = gv_sheet_name.
*--Reposition the chart on the worksheet (cut&paste)
CALL METHOD OF gs_activesheet 'ChartObjects' = gs_chartobjects .
CALL METHOD OF gs_chartobjects 'Select' .
CALL METHOD OF gs_chartobjects 'Cut' .
*--Select new area
gv_line_cntr = gv_line_cntr + 2 .
CALL METHOD OF gs_excel 'Cells' = gs_cell1
EXPORTING
#1 = gv_line_cntr
#2 = 1.
CALL METHOD OF gs_excel 'Cells' = gs_cell2
EXPORTING
#1 = gv_line_cntr
#2 = 1.
CALL METHOD OF gs_excel 'Range' = gs_cells
EXPORTING
#1 = gs_cell1
#2 = gs_cell2.
CALL METHOD OF gs_cells 'Select' .
CALL METHOD OF gs_activesheet 'Paste' .
enddo.
*--Deallocating memory
FREE: gs_excel, gs_wbooklist, gs_application, gs_wbook,
gs_activesheet,gs_sheets, gs_newsheet, gs_cell1,
gs_cell2, gs_cells, gs_range, gs_font, gs_interior,
gs_columns, gs_charts, gs_chart, gs_charttitle,
gs_charttitlechar, gs_chartobjects .
Thanks
SujanaExample for differt graph formats, try with different options
CALL METHOD OF ACTIVECHART 'APPLYCUSTOMTYPE' = APPLYCUSTOMTYPE
EXPORTING
#1 = '21'
#2 = 'Line - Column on 2 Axes'.
or
CALL METHOD OF ACTIVECHART 'Axes' = AXIS
EXPORTING
#1 = 1. "1='xlCategory'.
or
CALL METHOD OF ACTIVECHART 'Axes' = AXIS
EXPORTING
#1 = 2. "2='xlValue'.
Regds
Manohar -
Code to download output to excel sheet
Hi friends,
My requirement is to schedule a batch job in which a program runs with a particular variant. The output should be transported to an excel file and this file has to be placed in the Y drive.
Can you please tell me how I can code to transfer the output to an excel sheet. Also how to go about this requirement.
Appreciate your help.
Thanks in advance,
Dikshitha
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Oct 9, 2009 9:17 AMHi,
If your Y drive is in the presentation server it wont be possible to download the excel in background. If its a application server you can use DATASET statements and download in the application server.
If its a windows shared network drive probably you could check this blog
[http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID1328113750DB01926002626283648817End?blog=/pub/wlg/6830]
Vikranth -
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 -
Hello
I want to download the data from my cube to excel. The amount of data is too large and there is no other filter i can apply to cut down the data as i am running it for the 9th period. Now when i click on local file icon it is taking too much time. Is there a quick way to download this data to excel..
thankswhat u can do is copy it on Clip board and paste in notepad.
Later Split that notepad into smaller notepad files and convert it into csv formats...
u can have the desired output though it might take long time to store in clipboard best of luck,,,
Regards,
Aadil -
Avoid splitting of columns ALV report while download output to Excel sheet
Hi friends,
I have 170 columns in my ALV report
while downloading the report to Excel sheet
the column descriptions and values are splitting in two lines.
How can i avoid the problem.
before calling REUSE_ALV_GRID_DISPLAY function module in my code
for the Layout i assigned LS_LAYOUT-MAX_SIZE = 1023.
but still the problem is not solved.
Please help me in this Issue.
Thanks in Advance,
GaneshHi friends,
I dont want to use and Keyboard shiftcntrl....
or dont want to change any code in ALV report
by simply assigning some value to any of the export parameter in ALV function module
can we achieve the functionality
Thanks in Advance,
Ganesh -
Down Loading ALV Output to Excel Sheet
Hi All,
I am working on Vendor Line Items Report which have both Header details as well as line item details.
So i developed Heirarical ALV to display the output and it is working fine.But my problem is Downloading output to Excel sheet functionality is not working.
In output screen LIST->EXPORT->SPREADSHEET functionality is not working.
Please give me suggestions regarding the same or is there any another way to do the same by using ALV List Display.
Points will be rewarded
Thanks and Regards,
Siva.hi ,
this is a working example check this...
REPORT zvenkattest0.
TABLES:pa0002,pa0008.
TYPE-POOLS:slis.
CONSTANTS:c VALUE 'X'.
DATA:BEGIN OF it_pa0008 OCCURS 0,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
preas LIKE pa0008-preas,
ansal LIKE pa0008-ansal,
lga01 LIKE pa0008-lga01,
expand TYPE xfeld,
END OF it_pa0008.
DATA:BEGIN OF it_pa0002 OCCURS 0,
pernr LIKE pa0002-pernr,
vorna LIKE pa0002-vorna,
nachn LIKE pa0002-nachn,
gbdat LIKE pa0002-gbdat,
gblnd LIKE pa0002-gblnd,
sprsl LIKE pa0002-sprsl,
perid LIKE pa0002-perid,
END OF it_pa0002.
DATA: wa_field_cat TYPE slis_fieldcat_alv,
it_field_cat TYPE slis_t_fieldcat_alv,
wa_keyinfo TYPE slis_keyinfo_alv,
it_layout TYPE slis_layout_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR pa0002-pernr NO INTERVALS.
SELECTION-SCREEN: SKIP.
PARAMETERS:p_expand AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_field_cat.
PERFORM disply_data.
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
SELECT pernr
begda
endda
preas
ansal
lga01
FROM pa0008
INTO CORRESPONDING FIELDS OF TABLE it_pa0008
UP TO 10 ROWS.
IF NOT it_pa0008[] IS INITIAL.
SELECT pernr
vorna
nachn
gbdat
gblnd
sprsl
perid
FROM pa0002
INTO CORRESPONDING FIELDS OF TABLE it_pa0002
FOR ALL ENTRIES IN it_pa0008
WHERE pernr = it_pa0008-pernr.
ENDIF.
SORT it_pa0008 BY pernr.
ENDFORM. " SELECT_DATA
*& Form BUILD_FIELD_CAT
text
--> p1 text
<-- p2 text
FORM build_field_cat .
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PERNR'.
wa_field_cat-seltext_l = 'personnelno'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'BEGDA'.
wa_field_cat-seltext_l = 'begindate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ENDDA'.
wa_field_cat-seltext_l = 'enddate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PREAS'.
wa_field_cat-seltext_l = 'reason'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ANSAL'.
wa_field_cat-seltext_l = 'annualsalary'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'LGA01'.
wa_field_cat-seltext_l = 'wagetype'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'VORNA'.
wa_field_cat-seltext_l = 'firstname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'NACHN'.
wa_field_cat-seltext_l = 'lastname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBDAT'.
wa_field_cat-seltext_l = 'birhtdate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBLND'.
wa_field_cat-seltext_l = 'birthcountry'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'SPRSL'.
wa_field_cat-seltext_l = 'languageused'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'PERID'.
wa_field_cat-seltext_l = 'personnelid'.
APPEND wa_field_cat TO it_field_cat.
ENDFORM. " BUILD_FIELD_CAT
*& Form DISPLY_DATA
text
--> p1 text
<-- p2 text
FORM disply_data .
it_layout-group_change_edit = c.
it_layout-colwidth_optimize = c.
it_layout-zebra = c.
it_layout-detail_popup = c.
it_layout-get_selinfos = c.
IF p_expand = c.
it_layout-expand_fieldname = 'EXPAND'.
ENDIF.
wa_keyinfo-header01 = 'PERNR'.
wa_keyinfo-item01 = 'PERNR'.
wa_keyinfo-item02 = 'SUBTY'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = it_layout
it_fieldcat = it_field_cat
i_tabname_header = 'PA0008'
i_tabname_item = 'PA0002'
is_keyinfo = wa_keyinfo
TABLES
t_outtab_header = it_pa0008
t_outtab_item = it_pa0002.
ENDFORM. " DISPLY_DATA
regards,
venkat. -
Reg: ALV Output to EXCEL
Hi
i am working in a alv report and i got the output and when i download in to excel some of the columns getting mismatched..
I got some solution from theSDN have to do some modification in Excel sheet,But now i am using EXCEL 2007 version can any one gimme some logice how to come out of this issue??
Thanks and Regards,
Arun JosephArun,
some time when you download output to excel than may be some of the field or sorting critieria may be not reflect in excel so you need to do some adjustment even you are using excel2007.
Amit. -
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 -
Hi gurus,
Cany anybody explain what is the procedure to download the alv output to EXCEL sheet?
Marks will be awarded
Thanks in Advance
RaviHi
when display the ALV . select from PF-STATUS menu bar select download option then SPEADSHEET. Thats all.
Reward all the helpful answers..
With Regards
Navin Khedikar -
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 alv report output to excel format with out header line
Hi experts,
i want to download a alv report output into excel formatt with out the header line but it has to download including field description. as this output will fed into another transaction, the downloaded excel file should be with out header line.
fro eg:
Report : Zabc ABAP Development Page : 1
Run Date : 12/14/06 System: UD400
Run Time : 08:45:37
this header details should not be downloaded into the excel file.
could somebody help me please.
thanks
deepuhi jayanti,
thanks for your response.
i have delclared all the field types as character but still it is not downloading and it 's sy-subrc is 4... the code is as below.
*field names
lt_fieldnames-value = 'Material Number'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Plant'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Material Group'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Material Description'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'UOM'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Price Unit'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Material Type'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'X-Plant Status'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Valuation Class'.
APPEND lt_fieldnames.
lt_fieldnames-value = lw_avmng.
APPEND lt_fieldnames.
lt_fieldnames-value = lw_avntp.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Latest PO Qty'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Latest PO Cost'.
APPEND lt_fieldnames.
lt_fieldnames-value = 'PO Creation Date'.
APPEND lt_fieldnames.
lt_fieldnames-value = lw_fcaqt.
APPEND lt_fieldnames.
lt_fieldnames-value = 'Prev. Yr. Std. Cost'.
APPEND lt_fieldnames.
lt_fieldnames-value = lw_stcst.
APPEND lt_fieldnames.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'XLSHEET'
CREATE_PIVOT = 0
DATA_SHEET_NAME = ' '
PIVOT_SHEET_NAME = ' '
PASSWORD = ' '
PASSWORD_OPTION = 0
TABLES
PIVOT_FIELD_TAB =
data_tab = t_output1
fieldnames = lt_fieldnames
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_pivot_fields = 6
download_problem = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE e001 WITH 'Data could not be downloaded'.
ENDIF.
ENDFORM. " z_dwn_xl
thanks
deepu -
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
Maybe you are looking for
-
Hi Experts Could you please update me with the start routine for the below scenario. I had 2 DSO PAS--> DSO A Delta>DSO B DSO A (Active Table: /BIC/AZDSOA999) DSO B (Active Table: /BIC/AZDSOB999) Key Fields in DSO B : ZLOC,ZEMP_ID Data Fields in DSO
-
PrivilegedActionException using On Demand Dataloader
Hello. While updating Account data in CRM On Demand, I am getting the below error. While inserting, I got no error. And while updating Custom Object, I got no error. It seems while updating Account. Does anyone know how to solve this error? *Import R
-
Downloading Adobe TV episodes for offline viewing?
Is it possible to download Adobe TV episodes for offline viewing? I am in an area with bad internet connectivitiy and would like to store the episodes to watch from my local hard drive. After googling, it seems like there isn't much in the way out th
-
Can't find my templet library in Encore
I was following a turorial on Adobe TV about making menus in Encore and when they came to opening templets in the library, I find that I have no library. I have looked everywhere and just don't seem to have a library. Would reloading the program help
-
Dear All, I need a J2EE User with all its Authorities in order to test a webservice. Do you know how can I create a J2EE User. SAP J2EE Engine/7.00 Regards sas