10-16-2008 9:20 AM
hi,
I have problem on my report where I would like to export my IT_Result to Excel.
I am using SAP_CONVERT_TO_XLS_FORMAT function module but it return a shortdump and the error code is "RAISE CNTL_SYSTEM_ERROR".
Would be appreciate if any guys able to help me out
Aish
10-16-2008 9:24 AM
Hello Aish,
I think thier is no expections in the Fm module u need create the expection for that
Thank You,
santhosh
10-16-2008 9:29 AM
Hi Aish,
Try using this FM:
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = pathname
TABLES
data_tab = it_result
fieldnames = t_header
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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
This I think will solve your problem..as it has minimum number of parameters/..
If you will say, I will give the code for the fieldname header too.
Regards,
Nikita
10-16-2008 9:41 AM
Hi,
use following FM
..here need to pass internal table like i_output in following code..and column of excel sheet will arrange data as per the fields of internal table.
FORM get_download_data USING p_pfile .
DATA:
lw_file TYPE string .
" File Path
lw_file = p_pfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = lw_file
filetype = 'DBF'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = 'X'
COL_SELECT_MASK = p_col_sel
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = '0'
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = i_output
fieldnames = i_final
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
10-16-2008 10:08 AM
hi Nikita Jain,
It able to generated excel but it missing columns.. kind of truncated as my report it have numeroussssss columnsssss.