Problem about excel download
Dear all,
I got a problem about Thai language.
I wrote down ABAP code for sent mail and attached excel file to business workplace, but when I open excel file I can not read Thai language.
Please advance.
Regard
Lee
Hi Santosh,
I cant change the code because it's SAP standard (I would njeed to find an OSS note and there doesnt seems to be one there) the SAP Standard incluse is LSLPCF02 and the code is as follows:
DATA: fname type string,
result type abap_bool.
fname = file_name.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = fname
receiving
result = result
EXCEPTIONS
others = 0.
call method cl_gui_cfw=>flush.
IF result = abap_false.
RAISE file_not_exist.
ENDIF.
This seems to be the same, only difference is the way i_result is declared ??
Thanks
Similar Messages
-
I'm trying to report a problem about a download which didn't work and I'm being charged for it.
Store > View My Account > Purchase History > Report a problem.
Contact the store and explain the issue. They should be able to reissue your download or take whatever other steps are necessary to resolve your problem.
tt2 -
Hi There,
Were upgradding to version 700 (ECC 2005) and we have a problem when we download to excel.
When program (customer) is run (in foreground) we get an dump when we try to download to excel using the MS_EXCEL_OLE_STANDARD_DAT Function Module. it seems to have a problem when it gets to the; call method cl_gui_frontend_services => file_exist
SAP kernal 700
SAP database 700
SAP Gui 640
Any thought on the problem ?
ThanksHi Santosh,
I cant change the code because it's SAP standard (I would njeed to find an OSS note and there doesnt seems to be one there) the SAP Standard incluse is LSLPCF02 and the code is as follows:
DATA: fname type string,
result type abap_bool.
fname = file_name.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = fname
receiving
result = result
EXCEPTIONS
others = 0.
call method cl_gui_cfw=>flush.
IF result = abap_false.
RAISE file_not_exist.
ENDIF.
This seems to be the same, only difference is the way i_result is declared ??
Thanks -
ALV Standard Layout with problem for excel download
Hi, i have a alv grid report with this problem:
I execute the report and see all data ok.
chose the download option to spreadsheet.
*When open the spreadshet only see headers and no data.
The report have a standard Layout with 4 of 12 column selected, if i execute this report and add a new column for the pool the download works fine, if i save this new layout as default and execute the report again the download don't work fine.
¿Some idea? ThxsJust a wild guess. In your system, check the MS excel security settings. Excel->File->options->Trust center settings. We had some similar issues with excel columns visibility when you click on the ALV spreadsheet button or download which was corrected by changing the trust center settings. I don't exctly remember which settings affect this. You may have to compare the settings with another system (If it works fine in some other system which was the case in our issue). Pls ignore if not relevant.
Regards,
Gokul -
Problem in excel download of ALV report
Hi All,
I have created an ALV report with 87 fields in it. Whenever I am trying to download that report into excel the number of column breaks into 2 rows. In this case, The downloaded file contains 57 Columns in 1 row and remaining 29 Columns in second row. Can anyone please help me in understanding why this is happening while downloading this report into excel file and what will be the solution to correct it.
To download the file I am using the icon placed at application toolbar or ( Cntrl + Shift + F9 ).
Waiting for your response.
Regards.
PraveshHI Parvesh,
If you want to download the ALV result to you local file however you can follow the below coding.
DATA: l_filename TYPE string,
l_filen TYPE string,
l_path TYPE string,
l_fullpath TYPE string,
l_usr_act TYPE I.
l_filename = SPACE.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
DEFAULT_FILE_NAME = l_filename
CHANGING
FILENAME = l_filen
PATH = l_path
FULLPATH = l_fullpath
USER_ACTION = l_usr_act
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF sy-subrc = 0
AND l_usr_act <>
CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = l_fullpath
FILETYPE = 'ASC'
TABLES
DATA_TAB = T_DOWNL
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.
ENDIF. -
Problem with Excel download and scientific number
hi:
I am downloading internal table to excel using cl_gui_frontend_services=>gui_download. The field value of a recorder is '77E000' as text type in the internal table. When it downloaded to the excel , the value is converted to the scientific number '7.7E+01'.
How can I solved it ?
thanks.Hi,
Before passing the internal table to GUI_DOWNLOAD, concatenate a apostrophe symbol to the field such that the field will be considered as text and displayed as it is in the Excel.
Eg,
If field1 is the field containing 77E000 in the internal table then use this
data: c_quote(4) type c value ''''.
loop at itab.
concatenate c_quote itab-field1 into itab-field1.
modify itab.
Now pass this internal table to GUI_DOWNLOAD and check.
Regards,
Vikranth -
A minor but annoying problem about the downloads tab
Hi All
Today I download some podcasts in the library, after downloaded 5 podcasts, I paused the rest closed iTune, and went back home.
I opened iTune again in my room, and found that the downloads tab did not appear nor resume downloading as before.
I started a new download, downloads tab came back but the previous paused downloads disappeared.
And every time the downloads stoped because of timeout (my poor network), the downloads tab also disappeared.
As I never had this problem before, and today is the first time I download after I update to 7.4.3.1, is this a bug?
Cheers
JasonWhat does this have to do with the Matrox device?
It sounds like ...
1. a time code break and FCP is creating a second clip to carry on
or
2. your capture scratch drive is set as MS-DOS and the captured segments are larger than the default file limit.
or
3. something else.
x -
Problem with excel download using ALV_XXL_CALL
Hi All,
Standard program is using this FM ALV_XXL_CALL for downloading data into excel sheet.
I am trying to download table data in the excel but the excel file is opened without data.
I am unable to view data in the excel file(2007) after the execution of program.
Any Help for the same will be highly appreciated.
ThanksOften we face situations where we need to download internal table contents onto an Excel sheet. We are familiar with the function module WS_DOWNLOAD. Though this function module downloads the contents onto the Excel sheet, there cannot be any column headings or we cannot differentiate the primary keys just by seeing the Excel sheet.
For this purpose, we can use the function module XXL_FULL_API. The Excel sheet which is generated by this function module contains the column headings and the key columns are highlighted with a different color. Other options that are available with this function module are we can swap two columns or supress a field from displaying on the Excel sheet. The simple code for the usage of this function module is given below.
Program code :
REPORT Excel.
TABLES:
sflight.
header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'Suresh',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.
Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .
Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .
Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.
Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.
Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.
Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.
Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'SURESH KUMAR PARVATHANENI'.
APPEND t_online.
Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.
t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.
Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
DATA_ENDING_AT = 54
DATA_STARTING_AT = 5
filename = 'TESTFILE'
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
SO_TITLE = ' '
TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey
EXCEPTIONS
cancelled_by_user = 1
data_too_big = 2
dim_mismatch_data = 3
dim_mismatch_sema = 4
dim_mismatch_vkey = 5
error_in_hkey = 6
error_in_sema = 7
file_open_error = 8
file_write_error = 9
inv_data_range = 10
inv_winsys = 11
inv_xxl = 12
OTHERS = 13
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
I hope it might be of some help to you.
Thanks & Regards,
Radhika
Edited by: Radhika Parag Rajopadhye on Dec 1, 2009 8:27 AM
Edited by: Radhika Parag Rajopadhye on Dec 1, 2009 8:27 AM -
About Excel download format.
Hi ,
I need to download to excel in this format .
Customer ,Customer name , Model in between row1 and row2 . Invoice Details Vehicle detail are dispalyed in row1 and Invoice Date , Net Price ,Discount , Taxes Chassis are dispalyed in row2.
where @ represents blankspace.
Customer | Customer name | Model | Invoice Details | Vehicle details
@@@@@@@@@@@@@@@ | Invoice Date | Net Price| Discount | Taxes Chassis
please Guide me regarding this.
Regards,
Kiranmai.
Edited by: kiranmai B on Dec 1, 2008 8:23 AM
Edited by: kiranmai B on Dec 1, 2008 8:24 AM
Edited by: kiranmai B on Dec 1, 2008 8:27 AM
Edited by: kiranmai B on Dec 1, 2008 8:30 AM
Edited by: kiranmai B on Dec 1, 2008 8:30 AMDear Kiran,
You can use the below piece of code.
data:lv_var1 type string,
lv_var1 = 'Customer'.
lv_var2 = 'Customer name'.
CONCATENATE lv_var1 lv_var2 ........ CL_ABAP_CHAR_UTILITIES=>CR_LF
INTO <Variable> SEPARATED by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
Now the header will be placed in your excel document. You can proceed with the other functionalists as the same.
Provide points if helpful
Regards,
Gokul.N -
Problem in excel download using OLE concept
Hi ,
i am trying to create two sheets using OLE concept.
i am able to create the excel successfully but i can't save it .
i have one problem .
GET PROPERTY OF excel 'ActiveSheet' = sheet.
CALL METHOD OF sheet 'FILESAVEAS' EXPORTING #1 = w_filename1.
IF sy-subrc eq 0.
the sy-subrc value comes as 2.
i am passing 'C:\SKD.XLS' to w_filename.
is anything wrong.
how can check this method and it's exceptions.i am getting the file name from user input using the method
*"Calling method for getting file name as saved by the user.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = w_title
CHANGING
filename = w_filnam
path = w_path
fullpath = w_filename1
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
w_filename1 is of sting type .
i am passing the full path to it .
please let me i am doing anything wrong . -
Hi,
I am downloading data in an excel file using OLE download from an internal table say t_excel_tab. I need the data to be downloaded into excel in the same order as it was in the internal table t_excel_tab but somehow it is being sorted randomly based on 2 columns.
Please help me solve this issue.
Thanks in advance,
MathangiHI
GOOD
CHECK WITH THIS CODE AND USE ACCORDINGLY.
FUNCTION-POOL ZTEST_OLE. "MESSAGE-ID ..
TYPE-POOLS: abap.
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
DEFINE ole_error.
IF NOT &1 IS INITIAL.
MESSAGE e899(v1) WITH 'OLE Error ='(002) &1
RAISING ole_error.
ENDIF.
END-OF-DEFINITION.
TYPES:
BEGIN OF ty_line,
line(4096) TYPE c,
END OF ty_line.
CONSTANTS:
c_tab TYPE x VALUE 9,
c_bgrw TYPE i VALUE 1,
c_bgcl TYPE i VALUE 1.
*For EXCEL operations through ABAP
DATA:
w_excel TYPE ole2_object, "Holds the excel application
w_wbooks TYPE ole2_object, "Holds Work Books
w_wbook TYPE ole2_object, "Holds Work Book
w_cell TYPE ole2_object, "Holds Cell
w_format TYPE ole2_object, "Object for format
w_font TYPE ole2_object,
w_sheets TYPE ole2_object, "Holds Active Sheet
w_range TYPE ole2_object, "To select a range
*For data processing
it_line TYPE STANDARD TABLE OF ty_line,
wa_line TYPE ty_line,
w_field TYPE ty_line-line,
w_tab TYPE c.
FIELD-SYMBOLS:
<fs_field> TYPE ANY,
<fs_hex> TYPE ANY.
*******************TOP Include Ends***********************
*****************Function Module starts*******************
FUNCTION ztest_ole_single_table.
"----"*"Local interface:
*" IMPORTING
*" REFERENCE(FILENAME) TYPE RLGRAP-FILENAME
*" REFERENCE(TABNAME) TYPE CHAR16 OPTIONAL
*" TABLES
*" T_DATA
*" T_HEADING STRUCTURE LINE OPTIONAL
*" T_FORMATOPT STRUCTURE ZFORMATOPTIONS OPTIONAL
*" EXCEPTIONS
*" OLE_ERROR
*" DATA_EMPTY
*" CLIPBOARD_EXPORT_ERROR
DATA:
file_already_exists TYPE c.
IF t_data[] IS INITIAL.
MESSAGE e899(v1) WITH 'No Data in the internal table'(001)
RAISING data_empty.
ENDIF.
ASSIGN w_tab TO <fs_hex> TYPE 'X'.
<fs_hex> = c_tab.
REFRESH it_line.
PERFORM prepare_int_tab TABLES t_data
t_heading.
PERFORM create_excel_sheet USING filename
tabname
t_data
CHANGING file_already_exists.
CHECK NOT t_formatopt[] IS INITIAL.
PERFORM format_cells TABLES t_formatopt
USING filename
file_already_exists.
ENDFUNCTION.
****************Function Module Ends**********************
****************F01(Form Include) starts******************
***INCLUDE LZTEST_OLEF01 .
*& Form prepare_int_tab
text
--> p1 text
<-- p2 text
FORM prepare_int_tab TABLES it_data
it_heading STRUCTURE line.
CLEAR wa_line.
IF NOT it_heading[] IS INITIAL.
LOOP AT it_heading.
CONCATENATE wa_line-line
it_heading-line
w_tab
INTO wa_line-line.
CONDENSE wa_line.
ENDLOOP.
APPEND wa_line TO it_line.
ENDIF.
LOOP AT it_data.
CLEAR wa_line.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_data TO <fs_field>.
IF NOT sy-subrc IS INITIAL.
EXIT.
ENDIF.
w_field = <fs_field>.
CONDENSE w_field.
CONCATENATE wa_line-line
w_field
w_tab
INTO wa_line-line.
CONDENSE wa_line.
ENDDO.
APPEND wa_line TO it_line.
ENDLOOP.
ENDFORM. " prepare_int_tab
*& Form create_excel_sheet
text
--> p1 text
<-- p2 text
FORM create_excel_sheet USING p_filename
p_tabname
w_data
CHANGING p_file_already_exists.
DATA:
l_cols TYPE i,
l_rows TYPE i,
l_name TYPE char16,
l_rc TYPE sy-subrc,
l_res TYPE abap_bool,
l_type TYPE c,
l_file TYPE string,
l_from TYPE ole2_object,
l_to TYPE ole2_object,
l_entcol TYPE ole2_object.
CREATE OBJECT w_excel 'Excel.Application'.
ole_error sy-subrc.
CALL METHOD OF w_excel 'Workbooks' = w_wbooks.
ole_error sy-subrc.
SET PROPERTY OF w_excel 'Visible' = 1.
ole_error sy-subrc.
l_file = p_filename.
CLEAR l_res.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = l_file
RECEIVING
result = l_res
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 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 l_res IS INITIAL.
CLEAR p_file_already_exists.
ELSE.
p_file_already_exists = 'X'.
ENDIF.
IF NOT p_file_already_exists IS INITIAL.
Open the existing file in case if it exists
CALL METHOD OF w_wbooks 'Open'
EXPORTING
#1 = p_filename.
ole_error sy-subrc.
CALL METHOD OF w_excel 'Sheets' = w_sheets.
ole_error sy-subrc.
CALL METHOD OF w_sheets 'Add'.
ole_error sy-subrc.
GET PROPERTY OF w_excel 'ActiveSheet' = w_wbook.
ole_error sy-subrc.
ELSE.
CALL METHOD OF w_wbooks 'Add'. " = w_wbook.
ole_error sy-subrc.
GET PROPERTY OF w_excel 'ActiveSheet' = w_wbook.
ole_error sy-subrc.
ENDIF.
IF NOT p_tabname IS INITIAL.
SET PROPERTY OF w_wbook 'Name' = p_tabname.
ole_error sy-subrc.
ENDIF.
CALL METHOD OF w_wbook 'Cells' = l_from
EXPORTING
#1 = c_bgrw
#2 = c_bgcl.
ole_error sy-subrc.
DESCRIBE FIELD w_data TYPE l_type COMPONENTS l_cols.
DESCRIBE TABLE it_line LINES l_rows.
CALL METHOD OF w_wbook 'Cells' = l_to
EXPORTING
#1 = l_rows
#2 = l_cols.
ole_error sy-subrc.
CALL METHOD OF w_wbook 'Range' = w_range
EXPORTING
#1 = l_from
#2 = l_to.
ole_error sy-subrc.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = it_line
CHANGING
rc = l_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
OTHERS = 3
IF sy-subrc <> 0
OR NOT l_rc IS INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING clipboard_export_error.
ENDIF.
CALL METHOD OF w_range 'Select'.
ole_error sy-subrc.
CALL METHOD OF w_wbook 'Paste'.
ole_error sy-subrc.
WHILE l_cols GT 0.
l_rows = 1.
CALL METHOD OF w_excel 'Columns' = w_cell
EXPORTING
#1 = l_cols.
ole_error sy-subrc.
CALL METHOD OF w_cell 'EntireColumn' = l_entcol.
ole_error sy-subrc.
l_cols = l_cols - 1.
CALL METHOD OF l_entcol 'Autofit'.
ole_error sy-subrc.
ENDWHILE.
ENDFORM. " create_excel_sheet
*& Form format_cells
text
-->P_FILENAME text
-->P_FILE_ALREADY_EXISTS text
FORM format_cells TABLES it_formatopt STRUCTURE zformatoptions
USING p_filename TYPE rlgrap-filename
p_file_already_exists TYPE c.
DATA:
l_row TYPE i,
l_col TYPE i,
l_entcol TYPE ole2_object,
l_cols TYPE ole2_object,
l_comment TYPE ole2_object.
LOOP AT it_formatopt.
CLEAR: l_row, l_col.
l_row = it_formatopt-row.
l_col = it_formatopt-col.
CALL METHOD OF w_wbook 'Cells' = w_cell
EXPORTING
#1 = l_row
#2 = l_col.
ole_error sy-subrc.
IF NOT it_formatopt-bold IS INITIAL.
CALL METHOD OF w_cell 'Font' = w_font.
ole_error sy-subrc.
SET PROPERTY OF w_font 'Bold' = 1.
ole_error sy-subrc.
CALL METHOD OF w_excel 'Columns' = l_cols
EXPORTING
#1 = l_col.
ole_error sy-subrc.
CALL METHOD OF l_cols 'EntireColumn' = l_entcol.
ole_error sy-subrc.
CALL METHOD OF l_entcol 'Autofit'.
ole_error sy-subrc.
ENDIF.
IF NOT it_formatopt-color IS INITIAL.
CALL METHOD OF w_cell 'Interior' = w_format.
ole_error sy-subrc.
SET PROPERTY OF w_format 'ColorIndex' = it_formatopt-color.
ole_error sy-subrc.
CALL METHOD OF w_excel 'Columns' = l_cols
EXPORTING
#1 = l_col.
ole_error sy-subrc.
CALL METHOD OF l_cols 'EntireColumn' = l_entcol.
ole_error sy-subrc.
CALL METHOD OF l_entcol 'Autofit'.
ole_error sy-subrc.
ENDIF.
IF NOT it_formatopt-vert IS INITIAL.
SET PROPERTY OF w_cell 'Orientation' = it_formatopt-vert.
ole_error sy-subrc.
CALL METHOD OF w_excel 'Columns' = l_cols
EXPORTING
#1 = l_col.
ole_error sy-subrc.
CALL METHOD OF l_cols 'EntireColumn' = l_entcol.
ole_error sy-subrc.
CALL METHOD OF l_entcol 'Autofit'.
ole_error sy-subrc.
ENDIF.
IF NOT it_formatopt-comments IS INITIAL.
CALL METHOD OF w_excel 'Range' = w_range
EXPORTING
#1 = l_row
#2 = l_col.
ole_error sy-subrc.
CALL METHOD OF w_range 'Select'.
ole_error sy-subrc.
CALL METHOD OF w_cell 'AddComment' = l_comment.
ole_error sy-subrc.
CALL METHOD OF l_comment 'Text'
EXPORTING
#1 = it_formatopt-comments.
ole_error sy-subrc.
ENDIF.
ENDLOOP.
PERFORM save_and_close USING p_filename
p_file_already_exists.
ENDFORM. " format_cells
*& Form save_and_close
text
-->P_P_FILENAME text
-->P_P_FILE_ALREADY_EXISTS text
FORM save_and_close USING p_filename
p_file_already_exists.
IF p_file_already_exists IS INITIAL.
CALL METHOD OF w_wbook 'Saveas'
EXPORTING
#1 = p_filename.
ole_error sy-subrc.
ELSE.
CALL METHOD OF w_excel 'ActiveWorkbook' = w_wbooks.
ole_error sy-subrc.
CALL METHOD OF w_wbooks 'Save'.
ole_error sy-subrc.
ENDIF.
CALL METHOD OF w_wbooks 'Close'.
ole_error sy-subrc.
ENDFORM. " save_and_close
**************Form Include Ends***************************
*********************Test Progam**************************
REPORT ztest_ole.
TABLES mara.
SELECT-OPTIONS:
s_matnr FOR mara-matnr.
PARAMETERS:
p_file TYPE rlgrap-filename,
p_tabnm TYPE char16.
DATA:
BEGIN OF it_mara OCCURS 1,
matnr TYPE mara-matnr, "Material No.
mtart TYPE mara-mtart, "Material Type
matkl TYPE mara-matkl, "Material Group
groes TYPE mara-groes, "Size/Dimension
END OF it_mara,
it_heading TYPE STANDARD TABLE OF line,
wa_heading TYPE line,
it_formatopt TYPE STANDARD TABLE OF zformatoptions,
wa_format TYPE zformatoptions,
l_col TYPE zformatoptions-col.
START-OF-SELECTION.
SELECT matnr
mtart
matkl
groes
FROM mara
UP TO 100 ROWS
INTO TABLE it_mara.
wa_heading-line = 'Material No.'. APPEND wa_heading TO it_heading.
wa_heading-line = 'Material Type'. APPEND wa_heading TO it_heading.
wa_heading-line = 'Material Group'. APPEND wa_heading TO it_heading.
wa_heading-line = 'Size/Dimension'. APPEND wa_heading TO it_heading.
DO 4 TIMES.
CLEAR wa_format.
wa_format-row = 1.
wa_format-col = l_col + 1.
l_col = l_col + 1.
wa_format-bold = 'X'.
wa_format-color = '6'.
wa_format-vert = 45.
wa_format-comments = 'This is a heading'.
APPEND wa_format TO it_formatopt.
ENDDO.
CALL FUNCTION 'ZTEST_OLE_SINGLE_TABLE'
EXPORTING
filename = p_file
tabname = p_tabnm
TABLES
t_data = it_mara
t_heading = it_heading
t_formatopt = it_formatopt
EXCEPTIONS
ole_error = 1
data_empty = 2
clipboard_export_error = 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.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_file CHANGING p_file.
*& Form get_file
text
<--P_P_FILE text
FORM get_file CHANGING p_file.
DATA:
l_file TYPE string,
l_path TYPE string,
l_fpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = l_file
path = l_path
fullpath = l_fpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 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.
p_file = l_fpath.
ENDFORM. " get_file
THANKS
MRUTYUN -
ALV Excel Download problem ( Special Character)
Hi,
I am unable to download completely in XLS format from ALV grid. When i tried in couple of ways there is a special character( " ) in one of the filed. Due to the same Excel download has some problem. I tested by removing those and it worked fine,
Please suggest me to solve the issue.
Thanks,
Bhanu Gattu,Data strings with special characters can not be downloaded into XLS format from ALV grid. In my case, I replaced the special character " with space and I could download the data into excel.
-
Have you experience a problem about losing your internet after downloading itunes? How to fix it?
- Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so.
Try the following to rule out a software problem
- Reset the iPod. Nothing will be lost
Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup
- Restore to factory settings/new iPod.
- Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
Apple Retail Store - Genius Bar
Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
Apple - iPod Repair price
A third-party place like the following will replace the jack for less. Google for more.
iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
Replace the jack yourself -
Problem in ALV to Excel Download
Good Morning Experts,
I am facing one issue related ALV to excel Download.
I Developed one custom report the output is correct displaying.
the output is like for example i am taking 3 columns (plant, material, amt).
plant material amt
1001 aaa 1000
1001 bbb 2000
while downloading to excel
it displaying like
plant
material
amt
1001
aaa
1000
1001
bbb
2000
I dont know why its coming like that.
this is my code
DEFINE field_cat.
wa_field-row_pos = &1.
wa_field-fieldname = &2.
wa_field-tabname = &3.
wa_field-seltext_m = &4.
wa_field-outputlen = &5.
wa_field-currency = &6.
wa_field-ref_fieldname = &7.
wa_field-ref_tabname = &8.
APPEND wa_field to it_field.
clear wa_field.
END-OF-DEFINITION.
field_cat '1' 'BUKRS' 'IT_FINAL' 'Company Code' '6' '' '' ''.
field_cat '2' 'BUTXT' 'IT_FINAL' 'Comp Descrip' '25' '' '' ''.
field_cat '3' 'LIFNR' 'IT_FINAL' 'Vendor No' '10' '' '' ''.
field_cat '4' 'NAME1' 'IT_FINAL' 'Vendor Name' '35' '' '' ''.
field_cat '5' 'STRAS' 'IT_FINAL' 'Vendor Addres' '35' '' '' ''.
field_cat '6' 'FDGRV' 'IT_FINAL' 'Nature Of Work' '30' '' '' ''.
field_cat '7' 'DMBTR' 'IT_FINAL' 'Net Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
field_cat '8' 'QBSHB' 'IT_FINAL' 'TDS Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
field_cat '9' 'TOTAL' 'IT_FINAL' 'Total Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
it_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IS_LAYOUT = it_layout
IT_FIELDCAT = it_field
I_SAVE = 'X'
TABLES
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
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. " DISPLAY_ALV
FORM TOP_OF_PAGE.
REFRESH it_head. CLEAR it_head.
wa_head-typ = 'H'.
wa_head-info = 'Vendorwise Expense Details'.
APPEND wa_head to it_head.
wa_head-typ = 'S'.
IF NOT s_MONAT-high is INITIAL.
CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low ' to ' p_gjahr '.' s_MONAT-high INTO wa_head-info.
ELSE.
CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low INTO wa_head-info.
ENDIF.
APPEND wa_head to it_head.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_head.
ENDFORM.
Regards,
Dhina..Hi,
You can also try in this way
in the output screen
click List (in app tool bar) -> Export -> Spreadsheet
and save at your desired location.
(It will be save in .mhtml format , just rightclick on it and you can open it with excel )
Then you will be able to view in your required format.
Regards,
koolspy. -
Hi,
I am trying to download ALV report to excel but the columns in the o/p is appearing in two rows.
THe ALV report has 82 columns in o/p.Is there any restriction on the no of columns that can be downloaded in excel.Please help.
Thanks,
Sutapa.Hi Sutapa,
Kindly go through this link below for ALV Excel Download:
Re: how to view alv grid output in excel format(not downloading to pc)
Hope it helps
Regrds
Mansi
Maybe you are looking for
-
I have 2 phones attached to my apple ID account and when I text message that person, I am getting a duplicate message sent back to me. How do I stop this from happening?
-
UCCX Outbound Campaign(Preview) Reports
Hi All. I am configuring outbound(preview) campaigns on UCCX 8.5SU3. Once the campain is done, is there any defult report in which I can see the status of each contact of the campaign such as successful, not dialed yet, invalid number etc? Many thank
-
"The iPod ... could not be updated because it could not be found" on Mac?
I just updated to the latest version of QuickTime and was notified that there was a new iPod update but when I try to update it I get the message: "The iPod "My Name's iPod" could not be updated because it could not be found." I tried to remove the i
-
Best way to create animation in Flash and import into Premier Elements?
Very short, 5-10 seconds, very simple animation. I would like to import it as my intro but I don't know what file format to export as from Flash, that would import well into PE? I am using Flash CS5 and PE 10. On a Mac 10.6.8... Thank you
-
Organizer is extremely slow opening in PSE6
I haven't used this app in a few months, and know there has been several windows updates, so I'm not sure when the problem would have started; assuming its do to an update. running vista 32bit, quad core proc with 2GB or ram I get the default selecti