Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using SAP_CONVERT_TO_XLS_FORMAT.

0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

Hello Aish,

I think thier is no expections in the Fm module u need create the expection for that

Thank You,

santhosh

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

hi Nikita Jain,

It able to generated excel but it missing columns.. kind of truncated as my report it have numeroussssss columnsssss.