Skip to Content
0
Former Member
Mar 25, 2008 at 08:08 AM

Unicode error while upgrading from 4.6 to ECC 6.0

28 Views

Dear All,

I am getting unicode errror while upgrading from 4.6 to ECC 6.0, when iam trying to open downloaded file in excel.

In debugging, error occurs while executing statment "CALL METHOD OF obj_ex_sheet " in the code given below:

----


  • FORM open_downloaded_file_in_excel *

----


FORM open_downloaded_file_in_excel.

DATA:

lv_ole_books TYPE ole2_object,

lv_ole_sheets TYPE ole2_object,

lv_subrc LIKE sy-subrc,

lv_title(70) TYPE c,

lv_text1(70) TYPE c,

lv_text2(70) TYPE c.

  • start excel

CREATE OBJECT obj_ex_sheet 'EXCEL.SHEET'.

IF sy-subrc NE 0.

lv_subrc = sy-subrc.

FREE OBJECT obj_ex_sheet.

PERFORM error_handling_ms_excel USING lv_subrc.

ENDIF.

CALL METHOD OF obj_ex_sheet 'Application' = obj_ex_app.

IF sy-subrc NE 0.

lv_subrc = sy-subrc.

FREE OBJECT obj_ex_app.

FREE OBJECT obj_ex_sheet.

PERFORM error_handling_ms_excel USING lv_subrc.

ENDIF.

SET PROPERTY OF obj_ex_app 'Visible' = 1.

  • open data file: main file

CALL METHOD OF obj_ex_app 'Workbooks' = lv_ole_books.

CALL METHOD OF lv_ole_books 'Open' = obj_ex_wbook

EXPORTING #1 = gv_filename

#2 = 2

#3 = 0

#4 = 1

#5 = 0

#6 = 0

#7 = 1.

IF sy-subrc NE 0.

lv_subrc = sy-subrc.

FREE OBJECT obj_ex_wbook.

FREE OBJECT obj_ex_app.

FREE OBJECT obj_ex_sheet.

PERFORM error_handling_ms_excel USING lv_subrc.

ENDIF.

FREE OBJECT lv_ole_books.

CALL METHOD OF obj_ex_wbook 'Worksheets' = lv_ole_sheets.

CALL METHOD OF lv_ole_sheets 'Item' = obj_ex_wsheet

EXPORTING #1 = 1.

FREE OBJECT lv_ole_sheets.

GET PROPERTY OF obj_ex_wsheet 'UsedRange' = obj_ex_usedrange.

CALL METHOD OF obj_ex_usedrange 'AutoFormat'

EXPORTING #1 = 18.

SET PROPERTY OF obj_ex_wsheet 'Name' = sy-tcode.

FREE OBJECT obj_ex_usedrange.

PERFORM free_ole_objects.

CALL FUNCTION 'FLUSH'

EXCEPTIONS

OTHERS = 0.

ENDFORM.

regards,

Divya