Skip to Content
0
Nov 11, 2014 at 12:19 PM

Why is code within FM giving me unicode error whereas same code in report does not?

16 Views

Hi gurus!!

I have the following code within a report -> Excel aplication is open; the first line is filled in and excel is saved.

I copy the same code in a function module and I call this function within a report. I receive this error:

UC_OBJECTS_NOT_CONVERTIBLE

Why is that so? What else should I to?

Thanks in advance.

w_line = 1.

CREATE OBJECT e_appl 'EXCEL.APPLICATION'.

SET PROPERTY OF e_appl 'VISIBLE' = 1.

CALL METHOD OF e_appl 'WORKBOOKS' = e_work.

CALL METHOD OF e_work 'Add' = e_work.

GET PROPERTY OF e_appl 'ActiveSheet' = e_activesheet.

SET PROPERTY OF e_activesheet 'Name' = 'Textos INDAR'.

I have the following code within a report -> Excel aplication is open; the first line is filled in and excel is saved.

I copy the same code in a function module and I call this function within a report. I receive this error:

UC_OBJECTS_NOT_CONVERTIBLE

Why is that so? What else should I to?

Thanks in advance.

CALL METHOD OF e_appl 'Cells' = e_cell

EXPORTING

#1 = 1

#2 = 1.

SET PROPERTY OF e_cell 'Value' = 'IDIOMA'.

GET PROPERTY OF e_cell 'Interior' = e_color.

SET PROPERTY OF e_color 'ColorIndex' = 35.

GET PROPERTY OF e_cell 'Font' = e_bold.

SET PROPERTY OF e_bold 'Bold' = 1.

"------------------------------------------------

CALL METHOD OF e_appl 'Cells' = e_cell

EXPORTING

#1 = 1

#2 = 2.

SET PROPERTY OF e_cell 'Value' = 'MATERIAL'.

GET PROPERTY OF e_cell 'Interior' = e_color.

SET PROPERTY OF e_color 'ColorIndex' = 35.

GET PROPERTY OF e_cell 'Font' = e_bold.

SET PROPERTY OF e_bold 'Bold' = 1.

"------------------------------------------------

CALL METHOD OF e_appl 'Cells' = e_cell

EXPORTING

#1 = 1

#2 = 3.

SET PROPERTY OF e_cell 'Value' = 'CENTRO'.

GET PROPERTY OF e_cell 'Interior' = e_color.

SET PROPERTY OF e_color 'ColorIndex' = 35.

GET PROPERTY OF e_cell 'Font' = e_bold.

SET PROPERTY OF e_bold 'Bold' = 1.

"------------------------------------------------

CALL METHOD OF e_appl 'Cells' = e_cell

EXPORTING

#1 = 1

#2 = 4.

SET PROPERTY OF e_cell 'Value' = 'TEXTO'.

GET PROPERTY OF e_cell 'Interior' = e_color.

SET PROPERTY OF e_color 'ColorIndex' = 35.

GET PROPERTY OF e_cell 'Font' = e_bold.

SET PROPERTY OF e_bold 'Bold' = 1.

p_file = 'X:\jarizkuren\probak.xls'.

CALL METHOD OF e_work 'SAVEAS'

EXPORTING #1 = p_file.

CALL METHOD OF e_work 'close'.

CALL METHOD OF e_appl 'QUIT'.

FREE OBJECT e_appl.