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
deepu
hi 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
Similar Messages
-
ALV Report output in Excel format
Hi ,
I am facing a different behaviour in two computers , while trying to take an Excel format of an ALV report output. After generating the ALV output ,in one , when I click on the Excel Format button - the Excel spreadsheet opens with the output data. In the second computed , under the same action , a blank Excel sheet opens .
Could someone tell me a solution . What aspect is responsible for this ?
Regards ,
SujataReduce the MACRO security settings in the Excel to Medium.
Open an execl sheet, Chose from menu Tootls->Macro->Security.
Chose the radio-buton medium. Close the file and all excel applications.Then try downloading again.
Regards,
Ravi -
Problem when dowloading the ALV report output to Excel Sheet.
Hi ,
I am dowloading the ALV report output to Excel Sheet.
There is field Condition Unit(KOMP-KMEIN) in the output of the ALV, this has values PC and CSE , but when I download to Excel Sheet, CSE is appearing as CSE ,but PC is appearing as ******.
Can you please help me in knowing the reson for this.
Regards,
Madhu.hi
refer to following link
http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
Cheers
Snehi
Edited by: snehi chouhan on Jul 11, 2008 12:42 PM -
Hi Experts,
My requriement is I have to send a mail with report output in excel format as an attachment.
I wrote the below subroutine for building excel sheet but I am getting output in the single row. I am using version 4.6
Please help me regarding this. ASAP
FORM BUILD_XLS_DATA .
CONSTANTS: CON_CRET TYPE STRING VALUE '0D', "OK for non Unicode
CON_TAB TYPE STRING VALUE '09'. "OK for non Unicode
CONCATENATE 'Vendor' 'Country' 'Name'
INTO IATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IATTACH INTO IATTACH.
APPEND IATTACH.
LOOP AT IT_lfa1.
CONCATENATE IT_lfa1-lifnr IT_lfa1-land1 IT_lfa1-name1 INTO IATTACH
SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IATTACH INTO IATTACH.
APPEND IATTACH.
ENDLOOP.
ENDFORM. "build_xls_data
Thanx,
SudhaHi Sudha,
I am sending the standard format of sending a mail along with an attachment in .xls format.
Try this code.
form sendmail.
CLEAR GV_DELIMIT.
GV_DELIMIT = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
TEMPREAD = LV_LNCNT1.
REFRESH OBJTXT.
CONCATENATE 'The no. of error records are : ' TEMPREAD
INTO OBJTXT-LINE.
APPEND OBJTXT.
CLEAR OBJPACK. REFRESH OBJPACK.
CONCATENATE C_CODE
C_CMMT
C_COMMENT1
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
LOOP AT IT_DATA INTO WA_DATA.
CONCATENATE WA_DATA-ZCODE
WA_DATA-ZCOMMENT
WA_DATA-ZREASON
INTO OBJTXT-LINE SEPARATED BY GV_DELIMIT.
APPEND OBJTXT.
ENDLOOP.
CLEAR GV_DELIMIT.
CLEAR OBJPACK. REFRESH OBJPACK.
CLEAR DOC_CHNG.
TAB_LINES = 0.
OBJHEAD = REJFILE. APPEND OBJHEAD.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-OBJ_NAME = REJFILE.
MOVE TEXT-006 TO
DOC_CHNG-OBJ_DESCR.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 1. " 3.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
FOR ASCII TO BINARY OBJECT FUNCTION
TOTLINEXFER = 0.
TOTXFER = 0.
BINMAXLEN = 255.
REFRESH OBJBIN.
LV_CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
TGTMAXLEN = BINMAXLEN.
TGTLEN = 0.
LOOP AT OBJTXT FROM 2.
IF NOT OBJTXT-LINE CP 'The no. of records are '." AND
CONCATENATE OBJTXT-LINE LV_CR INTO BUFFER.
SRCOBJLEN = STRLEN( BUFFER ).
SRCOBJPTR = 0.
WHILE SRCOBJLEN > 0 .
XFERLEN = TGTMAXLEN - TGTLEN.
IF XFERLEN > SRCOBJLEN.
XFERLEN = SRCOBJLEN.
MOVE BUFFERSRCOBJPTR TO OBJBIN-LINETGTLEN.
TGTLEN = TGTLEN + SRCOBJLEN.
SRCOBJLEN = 0.
CLEAR BUFFER.
ELSE.
MOVE BUFFER+SRCOBJPTR(XFERLEN) TO
OBJBIN-LINE+TGTLEN(XFERLEN).
APPEND OBJBIN.
CLEAR OBJBIN-LINE.
TGTLEN = 0.
SRCOBJLEN = SRCOBJLEN - XFERLEN.
SRCOBJPTR = SRCOBJPTR + XFERLEN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
TOTXFER = TOTXFER + XFERLEN.
ENDWHILE.
ENDIF.
ENDLOOP.
IF TGTLEN > 0.
APPEND OBJBIN.
TOTLINEXFER = TOTLINEXFER + 1.
ENDIF.
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TOTLINEXFER.
OBJPACK-DOC_TYPE = 'XLS'.
OBJPACK-OBJ_NAME = REJFILE.
OBJPACK-OBJ_DESCR = 'Rejected Entries File'.
OBJPACK-DOC_SIZE = TOTXFER.
APPEND OBJPACK.
REFRESH RECLIST.
MAIL1 = Recepient Mail Id
RECLIST-RECEIVER = MAIL1.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T -
Facing problem while downloading ALV grid Output into Excel
Hi Guys,
I am facing problem while downloading ALV grid Output into Excel.
It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
Can someone help me regarding this
thanks for your helpHi,
Open up Excel on your desktop. Goto Tools > Macro > Security.
Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
Was this your problem? Don't forget those points, either.
check with this wetther it is solved or not.
Regards,
sana. -
Xml report output in excel format without using options tab in EBS
How to get xml publisher report output in excel format without using options tab in EBS?
I am getting XML Publisher report output in excel format by using options tab while submitting the concurrent request .
But i want to get excel output automatically.
Can anyone give idea to get XML publisher Report output in excel without selecting options tab.
Thanks in advance
Sandeep VHey Sandeep,
I am working on a similar format for a report and if possible can you please give me some guidelines. I have initially created reports using XML Publisher, but for those , the output preview format was PDF. So, if I select the preview format as EXCEL will it give me output in Excel and for this to happen, how do I define the rtf template. I believe the working will be same as for PDF, create a rdf report, get output in XML and apply the template to get the data in Excel or there is something different to this.
Thanks,
Sunil -
Oracle reports output in excel format does not display the graphs
Oracle reports output in excel format does not display the graphs: "linked image cannot be displayed".
The output file in PDF format the graph is supported.Do you have any header and footer on your template?
If you have any header and footer then try to adjust it as of to display full page.
Thanks
Yasar -
Displaying the report output in excel format
Please help me in getting the report output in excel format.
thnksI ran into a BIG problem after passing from 6i rep server to 9i rep server.
On 6i rep server I used to set DESFORMAT='DELIMITED', and that produced reasonable tab-delimited output for reports that did not have group above (all the query groups were from left to right, not a single group having fields displayed above some other group). When deployed on rep server 9i, the same reports produced some unexplainable output: some of the rows were duplicated, but I couldn't figure out any rule.
So, the best thing to get the reports into something that fits in .xls would be to have the output in .xml, that may be imported in Excel. -
Internal table with out header line
Hi friends,
Can u send me code for internal table with out header line : how to declare ,how to populate data and how to access the data
Regards,
vijayHi Vijay
There are several ways to declare an internal table without header line:
A) You can define a type table
TYPES: BEGIN OF TY_ITAB OCCURS 0,
INCLUDE STRUCTURE ZTABLE.
TYPES: END OF TY_ITAB.
and then your intrnal table:
DATA: ITAB TYPE TY_ITAB.
B) DATA: ITAB TYPE/LIKE STANDARD TABLE OF ZTABLE.
C) DATA: ITAB TYPE/LIKE ZTABLE OCCURS 0.
All these ways create a STANDARD TABLE
You can create other types of internal table, for example SORTED TABLE or HASHED TABLE.
These kinds of table can allow to improve the performance because they use different rules to read the data.
When it wants to manage a table without header line, it need a work area, it has to have the same structure of table.
DATA: WA LIKE ZTABLE.
DATA: T_ZTABLE LIKE STANDARD TABLE OF ZTABLE.
A) To insert the record:
If you use INTO TABLE option you don't need workarea
SELECT * FROM ZTABLE INTO TABLE T_ZTABLE
WHERE FIELD1 = 'Z001'
AND FIELD2 = '2006'.
but if you want to append a single record:
SELECT * FROM ZTABLE INTO wa WHERE FIELD1 = 'Z001'
AND FIELD2 = '2006'.
APPEND WA TO T_ZTABLE.
ENDSELECT.
Now you need workarea.
B) To read data: you need always a workarea:
LOOP AT T_ZTABLE INTO WA WHERE ....
WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
ENDLOOP.
or
READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
IF SY-SUBRC = 0.
WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
ENDIF.
Anyway if you want to know only if a record exists, you can use the TRANSPORTING NO FIELDS option, in this case it doesn't need a workarea.
READ T_ZTABLE WITH KEY FIELD3 = '0000000001'
TRANSPORTING NO FIELDS.
IF SY-SUBRC = 0.
WRITE 'OK'.
ENDIF.
C) To update the data: it always needs a workarea
LOOP AT T_ZTABLE INTO WA WHERE FIELD3 = '0000000001'.
WA-FIELD3 = '0000000002'.
MODIF T_ZTABLE FROM WA.
ENDLOOP.
or
READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
IF SY-SUBRC = 0.
WA-FIELD3 = '0000000002'.
MODIF T_ZTABLE FROM WA INDEX SY-TABIX
ENDIF.
AT the end you can use the internal table to update database:
MODIFY/UPDATE/INSERT ZTABLE FROM T_ZTABLE.
See Help online for key words DATA, you can find out more details.
Max
Message was edited by: max bianchi -
With header line & with out header line ?
what is difference between with header line & without header line ?
When you create an internal table object you can also declare a header line with the same name. You can use the header line as a work area when you process the internal table. The ABAP statements that you use with internal tables have short forms that you can use if your internal table has a header line. These statements automatically assume the header line as an implicit work area. The following table shows the statements that you must use for internal tables without a header line, and the equivalent statements that you can use for internal tables with a header line:
Operations without header line
Operations with header line
Operations for all Table Types
INSERT <wa> INTO TABLE <itab>.
INSERT TABLE ITAB.
COLLECT <wa> INTO <itab>.
COLLECT <itab>.
READ TABLE <itab> ... INTO <wa>.
READ TABLE <itab> ...
MODIFY TABLE <itab> FROM <wa> ...
MODIFY TABLE <itab> ...
MODIFY <itab> FROM <wa> ...WHERE ...
MODIFY <itab> ... WHERE ...
DELETE TABLE <itab> FROM <wa>.
DELETE TABLE <itab>.
LOOP AT ITAB INTO <wa> ...
LOOP AT ITAB ...
Operations for Index Tables
APPEND <wa> TO <itab>.
APPEND <itab>.
INSERT <wa> INTO <itab> ...
INSERT <itab> ...
MODIFY <itab> FROM <wa> ...
MODIFY <itab> ...
Using the header line as a work area means that you can use shorter statements; however, they are not necessarily easier to understand, since you cannot immediately recognize the origin and target of the assignment. Furthermore, the fact that the table and its header line have the same name can cause confusion in operations with entire internal tables. To avoid confusion, you should use internal tables with differently-named work areas.
The following example shows two programs with the same function. One uses a header line, the other does not.
With header line:
TYPES: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1
WITH HEADER LINE.
DO 4 TIMES.
ITAB-COL1 = SY-INDEX.
ITAB-COL2 = SY-INDEX ** 2.
INSERT TABLE ITAB.
ENDDO.
ITAB-COL1 = 2.
READ TABLE ITAB FROM ITAB.
ITAB-COL2 = 100.
MODIFY TABLE ITAB.
ITAB-COL1 = 4.
DELETE TABLE ITAB.
LOOP AT ITAB.
WRITE: / ITAB-COL1, ITAB-COL2.
ENDLOOP.
Without header line:
TYPES: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA: ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1,
WA LIKE LINE OF ITAB.
DO 4 TIMES.
WA-COL1 = SY-INDEX.
WA-COL2 = SY-INDEX ** 2.
INSERT WA INTO TABLE ITAB.
ENDDO.
WA-COL1 = 2.
READ TABLE ITAB FROM WA INTO WA.
WA-COL2 = 100.
MODIFY TABLE ITAB FROM WA.
WA-COL1 = 4.
DELETE TABLE ITAB FROM WA.
LOOP AT ITAB INTO WA.
WRITE: / WA-COL1, WA-COL2.
ENDLOOP.
The list, in both cases, appears as follows:
1 1
2 100
3 9
The statements in the program that does not use a header line are easier to understand. As a further measure, you could have a further work area just to specify the key of the internal table, but to which no other values from the table are assigned.
Internal table with header line
you can use anywhere except obkect oriented concept.
Internal table without header line :
You should use in Object oriented concept..
Always try to use without header line,performance point of view it is best..
Example :
Without header line.
Structure
types : begin of ty_itab ,
matnr type mara-matnr,
end of ty_itab.
Internal table
data i_itab type standard table of ty_itab .
Work area
data wa_itab like line of i_itab
With header line
data : begin of i_itab occurs 0,
matnr like mara-matnr,
end of i_itab
itab with header lines are obsolete, anyway it will work but not recommended. instead use work area or more effiecient is field symbols. so donot use itab with header line.
i will explain use of itab w/o header line.
Data: itab1 type standard table of mara with header line occurs 0,
itab2 type standard table of mara,
wa_itab2 type mara.
loop at itab1.
"This will work fine.
endloop.
loop at itab2.
"This will give erro that itabd does not hav workarea
endloop.
"so write
loop at itab2 into wa_itab2.
"This will work
endloop.
<b>The difference between
whih header line and with out heater line of internal table.
ex:-
a) Data : itab like mara occurs 0 with header line.
b) Data: itab like mara occurs 0.
-While adding or retrieving records to / from internal table we have to keep the record temporarily.
-The area where this record is kept is called as work area for the internal table.
-The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
-Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
a) Data : itab like mara occurs 0 with header line.
table is with header line
b) Data: itab like mara occurs 0.
table is without header line</b>
regards,
srinivas
<b>*reward for useful answers*</b> -
Download the ALV Report output into excel sheet or notepad
Hi,
how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
Thanks in advance!!!!
Regards,
kranthi.Hi
Download a report to excel with format (border, color cell, etc)
Try this program...it may help you to change the font ..etc.
Code:
REPORT ZSIRI NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
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
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Please note that this example maybe slow at filling the excel table
(perhaps four fields per second on a 900 MHz machine - almost 30 seconds
for a short example).
To get the data on properties and methods - there is a bit of smoke and mirrors
going on here; they are EXCEL properties and methods, not sap ones - so you need
to look at excel help to determine how a particular function is structured. then
build the block in sap, as shown in the example.
If you only want to transfer the data to Excel like when you transfer the data from
ALV to Excel simply use the Function Modules:
XXL_SIMPLE_API
If you want more modifications when you transfer it to Excel use:
XXL_FULL_API -
Issue while downloading the alv report output in spreadsheet format .
Hi,
I have a report output, whenever I try to download it in the spreadsheet format to my desktop,
I get the following issue:
Say the correct material number is 10833340001218999 or 10030000063207001
(This appears in the report output)
But in the excel file the number is displayed as 10833340001218900 and 10030000063207000.
Please help.
Regards,
Sucharita.Hi Sucharita,
The reason for your problem could be that in excel 2007, characters more that 15 are replaced with 0.
Or you can try downloading the data using FM 'GUI_DOWNLOAD' , if currently you are using stadard SAP functionality of data downloading.
Best Regards,
Vishal. -
Formatting problem when downloading classical report output to excel sheet.
Dear Experts,
My classical report o/p looks like:
SI Name ID
1 xyz 11
2 abc 22
3 eet 33
4 jnc 44
When I download the same to a excel sheet from List->Save->file->Spreadsheet and save it.
The formatting looks like this:
SI Name ID
1 xyz 11
2 abc 22
3 eet 33
4 inc 44
That is the heading and column entries are in different columns.
There is no GUI_Download used.
Kindly help what may be the issue.Hi,
In the report output the formatting looks fine. It is exactly below the heading. But only when I save it to excel, this alignment issue is coming. Even the columns after this column are are properly aligned and there is no issue at all. Only this column in the middle has issue. -
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 -
SAP WEBGUI - How to download the report output to Excel ?
Hi Folks ,
We have generated a report in standard SAP GUI 7.1 . But our requirement is to view the report in SAP WEBGUI and download as EXCEL .
We can view the report output in SAP WEBGUI , but could find an option to download as excel !
Is there any option in webgui ?
Please provide you valuable inputs !
Thanks.,
V.RangarajanHi V.Ranjarajan,
Have you created an ALV report?
If yes, there are many ways to download the output to excel:
Go to Menu -> Export - > Local File... , local file button, etc.
In SAP CRM 7.0 there is a std functionality to even download search result list to excel.
Hope this helps!
Regards,
Saumya
Maybe you are looking for
-
Project Pro hangs while opening a schedule from Project 2010 server.
Hi, We have an issue with opening a schedule from Project server 2010. Project client is not responding. when we try to open schedule in PWA. I am getting unable to open file do you want to open in default view. No matter which view I choose keep get
-
Hi Experts, i have a new problem. I'm using Netveawer V 7.0.09 and i have created a static checkbox element in my View. This element is showed in the portal at runtime but it is locked. So i can't check it. I have setted the checked property as a boo
-
Cd burner will not verify disk
My cd burner will burn but it won't verify the disk. I tried 4 times with no success, even bought new cds to try--still didn't work
-
"No valid RFC for the system VEP" in solman_setup in solman7.1
Hi Gurus, I've installed Solman 7.1. Configured STMS as single domain alone. STMS was successfull and the RFC was created and that also successfull. But in solman_setup, in system preparation phase, check STMS, its throwing the error "No Valid R
-
Have had my PowerMac G5 for just over a year. Rebooted yesterday and the fans started running full out and haven't stopped since. Here are somethings that I have tried: Reset PRAM Press Power Manager Button on the logic board Ran Applejack Repaired p