Problem in Excel Download
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,
Mathangi
HI
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
Similar Messages
-
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 -
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 -
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 . -
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
LeeHi 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 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.
-
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 -
I have an early 2011 MacBook Pro which has been running slow for a while. After looking at responses to similar problems I have downloaded and run EtreCheck. Please can someone help me with what it all means.
Thanks in advance.
EtreCheck version: 1.9.15 (52)
Report generated 19 September 2014 08:07:14 GMT+8
Hardware Information: ?
MacBook Pro (13-inch, Early 2011) (Verified)
MacBook Pro - model: MacBookPro8,1
1 2.3 GHz Intel Core i5 CPU: 2 cores
4 GB RAM
Video Information: ?
Intel HD Graphics 3000 - VRAM: 384 MB
Color LCD 1280 x 800
System Software: ?
OS X 10.9.4 (13E28) - Uptime: 0 days 0:4:29
Disk Information: ?
Hitachi HTS545032B9A302 disk0 : (320.07 GB)
S.M.A.R.T. Status: Verified
EFI (disk0s1) <not mounted>: 209.7 MB
Macintosh HD (disk0s2) / [Startup]: 319.21 GB (147 GB free)
Recovery HD (disk0s3) <not mounted>: 650 MB
MATSHITADVD-R UJ-898
USB Information: ?
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. BRCM2070 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Inc. Apple Internal Keyboard / Trackpad
Apple Computer, Inc. IR Receiver
Thunderbolt Information: ?
Apple Inc. thunderbolt_bus
Gatekeeper: ?
Mac App Store and identified developers
Kernel Extensions: ?
[not loaded] com.seagate.driver.PowSecDriverCore (5.2.4 - SDK 10.4) Support
[not loaded] com.seagate.driver.PowSecLeafDriver_10_4 (5.2.4 - SDK 10.4) Support
[not loaded] com.seagate.driver.PowSecLeafDriver_10_5 (5.2.4 - SDK 10.5) Support
[not loaded] com.seagate.driver.SeagateDriveIcons (5.2.4 - SDK 10.4) Support
[loaded] com.sophos.kext.sav (9.1.55 - SDK 10.7) Support
[loaded] com.sophos.nke.swi (9.1.50 - SDK 10.8) Support
Launch Daemons: ?
[loaded] com.adobe.fpsaud.plist Support
[loaded] com.microsoft.office.licensing.helper.plist Support
[running] com.sophos.autoupdate.plist Support
[running] com.sophos.configuration.plist Support
[running] com.sophos.intercheck.plist Support
[running] com.sophos.notification.plist Support
[running] com.sophos.scan.plist Support
[running] com.sophos.sxld.plist Support
[running] com.sophos.webd.plist Support
[running] com.trusteer.rooks.rooksd.plist Support
Launch Agents: ?
[loaded] com.divx.dms.agent.plist Support
[loaded] com.divx.update.agent.plist Support
[running] com.sophos.uiserver.plist Support
[running] com.trusteer.rapport.rapportd.plist Support
User Launch Agents: ?
[loaded] com.adobe.ARM.[...].plist Support
[running] com.amazon.music.plist Support
[loaded] com.google.keystone.agent.plist Support
[not loaded] jp.co.canon.Inkjet_Extended_Survey_Agent.plist Support
User Login Items: ?
iTunesHelper
TomTomHOMERunner
AdobeResourceSynchronizer
Dropbox
Internet Plug-ins: ?
FlashPlayer-10.6: Version: 15.0.0.152 - SDK 10.6 Support
DivX Web Player: Version: 3.2.1.977 - SDK 10.6 Support
AdobePDFViewerNPAPI: Version: 11.0.09 - SDK 10.6 Support
AdobePDFViewer: Version: 11.0.09 - SDK 10.6 Support
Flash Player: Version: 15.0.0.152 - SDK 10.6 Support
EPPEX Plugin: Version: 10.0 Support
Default Browser: Version: 537 - SDK 10.9
OVSHelper: Version: 1.1 Support
QuickTime Plugin: Version: 7.7.3
SharePointBrowserPlugin: Version: 14.4.4 - SDK 10.6 Support
iPhotoPhotocast: Version: 7.0 - SDK 10.7
Safari Extensions: ?
Ultimate
Audio Plug-ins: ?
BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
AirPlay: Version: 2.0 - SDK 10.9
AppleAVBAudio: Version: 203.2 - SDK 10.9
iSightAudio: Version: 7.7.3 - SDK 10.9
iTunes Plug-ins: ?
Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
3rd Party Preference Panes: ?
Flash Player Support
Perian Support
Trusteer Endpoint Protection Support
Time Machine: ?
Skip System Files: NO
Auto backup: YES
Volumes being backed up:
Macintosh HD: Disk size: 297.29 GB Disk used: 160.38 GB
Destinations:
Data [Network] (Last used)
Total size: 2 TB
Total number of backups: 99
Oldest backup: 2012-04-20 17:05:32 +0000
Last backup: 2014-09-18 23:49:25 +0000
Size of backup disk: Excellent
Backup size 2 TB > (Disk size 297.29 GB X 3)
Time Machine details may not be accurate.
All volumes being backed up may not be listed.
Top Processes by CPU: ?
6% InterCheck
5% iCalExternalSync
3% WindowServer
2% CalendarAgent
2% SystemUIServer
Top Processes by Memory: ?
152 MB SophosScanD
147 MB InterCheck
106 MB SophosAntiVirus
66 MB Dropbox
57 MB com.apple.iTunesLibraryService
Virtual Memory Information: ?
161 MB Free RAM
1.55 GB Active RAM
1.41 GB Inactive RAM
902 MB Wired RAM
611 MB Page-ins
0 B Page-outsUninstall Trusteer software
http://www.trusteer.com/support/uninstalling-rapport-mac-os-x
Remove Sophos
https://discussions.apple.com/message/21069437#21069437 -
Problem with Application-download to FP2000-controller
Hello
i have a problem with the download to the fieldpoint module.
My software configuartion:
- LV 7.1
- LV DSC 7.1
- LV RealTime 7.1
- FieldPoint 4.1 & LVRT for FP-20xx
at the beginnings the system works fine. but after an operating system reinstall from win2k to winxp it would not work.
the error message which i get called: "download failed VI_IsInitialized.vi"
and in an other window: Shared library vistopped cannot started at the RT-device
thank you for time I look forward to your reply.
Markus Hediger
ps: sorry for my bad englishHi All,
I am using SAP LOGON 710 version . And also I tried to convert txt to Excel file .While converting also it is not giving the sysmbol of ( " ) .
thanks for your reply.
Regards,
Srikanth P. -
Excel download feature in Web Dynpro Abap using OAOR document
Hi Friends,
I am facing an issue in implementing excel download feature in Web Dynpro.
Problem: I have stored an excel document in OAOR. I am displaying data on screen using ALV display in WDA.
I will provide a button to download excel in toolbar of ALV. When user clicks on this button i need to pick the document from OAOR and fill that with my screen values and download it to users desktop.
Please help me in this. Problem is when i am calling these classes c_oi_container_control_creator=>get_container_control and cl_gui_custom_container from my View's method they are returning error.
Thanks & Regards,
SaudHI,
You cannot use GUI classes and methods in web dynpro . That will dump.
Instead you can use file down load UI element or..
If you have the content in xstring format use ATTACH_FILE_TO_RESPONSE method of CL_WD_RUNTIME_SERVICES class.
Regards,
Madhu -
Dump while running a program with OLE Excel download facility in ITS
Hi,
Because of some complex requirment, I had created a report program which will download the data to an Excel sheet using SAP OLE Automation Controller. For this report i had created a tcode too.
The report which i developed is perfectly working fine in SAPGUI. But if i access the same report throught SAP ITS serice. I am getting a dump. Please find below the dump details. I am not able to figure it out why the dump is not coming in SAPGUI.
Runtime Errors MESSAGE_TYPE_X
Date and Time 09.03.2010 05:35:41
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
|
Error analysis
Short text of error message:
Control Framework : Error processing control
Long text of error message:
Diagnosis
An error occurred when the system tried to process the commands
from the Automation Queue on the presentation server.
There are several possible reasons for this:
- The installation of the SAP GUI on the presentation server is
faulty or obsolete.
- There is an error in the application program
- There is an error in the SAPGUI or an integrated control
Procedure
1. Make sure that you have imported the appropriate Support
Package, the current kernel, and GUI patch for the release of your
system
2. Check whether the error occurs locally on one or a few PCs, or
generally on all PCs. Note whether the error only occurs for some
users, for example because of a specific Customizing setting.
If it only occurs locally, this suggests an installation problem
with the PC. Check the installation; if necessary, reinstall the
software. In the dump, search for the SY-MSGLI field, since it may
point to the cause of the error.
3. Activate the Automation Trace (in accordance with SAP Note
158985).
4.Start the transaction and continue until the screen immediately
before the dump.
5. From the System -> Utilities menu, choose Autom. Queue,
Synchronous Processing.
The status bar of the GUI displays the text:
"Automation synchron flush mode on"
6. If you now proceed with the application, the short dump will
display the ABAP call that caused the error; the Automation Trace
will contain the error on the presentation server.
7. If necessary, load the short dump and trace files on to
sapservX, so that SAP can analyze them.
Technical information about the message:
Message class....... "CNDP"
Number.............. 006
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"SAPLOLEA" or "LOLEAU02"
"AC_SYSTEM_FLUSH"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
User and Transaction
Client.............. 120
User................ "XXXXXX"
Language Key........ "E"
Transaction......... "ZGA_BEACON_SOX_RPT "
Transactions ID..... "4B95E2560EB62F9AE10000000A241C33"
Program............. "SAPLOLEA"
Screen.............. "ZGA_REP_BEACON_SOX_REPORT 9000"
Screen Line......... 0
Information on Caller ofr "HTTP" Connection:
Plug-in Type.......... "HTTP"
Caller IP............. "10.36.28.52"
Caller Port........... 8000
Universal Resource Id. "/sap/bc/gui/sap/its/webgui/~flNUQVRFPTIzNzIxLjAxNC4wNC4
wNA=="Hi All,
FYI.....
As I said because of my complex requirement, i am using OLE excel download facilities to download the data. ITS wont support this OLE download facility. This can be done only through local SAP GUI.
The reason for this is that, when i am using this download facility through SAP GUI, OLE object thats used in my report program will directly talk to the Local OLE excel objects (i.e. the local installed Excell application) and download the data. But if it's through ITS, my program wont be able to communicate with the local excel OLE objects because of this i am getting a DUMP.
Thank You all for the support. All the best in future.
Regards
Maneesh Chandran
Maybe you are looking for
-
Reg: Data getting repeated in the table and displayed in the Smartorm.
Hello Experts, Requirement is to display header data from kna1table and item data from two tables faglflexa and bsid. Layout is something like this. Name and Address is capture from KNA1. Item Details from faglflexa and BSID based on one condition, U
-
Need FM/Class for Direct deletion of Development Class/Package in ABAP
Hi experts, I had stored all the unwanted objects in a development class/ package which I intended to delete later. I want this deletion to be done automatically. Is there a function module or class that can help me do this? Thanks in advance, Adithy
-
New fields for Attributes Data Tab in Org Model
Hi, Guru's I want to add/remove a new fields for Org model --->Attributes data tab Diivision Currency region dist.chnl like that I want to add another new XXXX and respected values How it would be done. Regards CR Gupta
-
Non-unicode can only have 32-bit kernel?
In a non-unicode system (NW04s), run disp+work -version, it does tell it is 64 or 32. I remember I saw somewhere that non-unicode goes only with 32-bit. Who can clarify? I'll thank you with points.
-
Canon printer and Snow Leopard
I recently upgraded to Snow Leopard and have now spent up to 8 hours trying to get my Canon MX 340 working again. I checked the printer log and it said that the printmanagerfailed, I found a topic here about the same problem and it stated to go into