Skip to Content
0
Former Member
Jan 12, 2010 at 06:43 AM

gs_documents using OLE not getting populated in ECC6

65 Views

HI,

We are doing upgrade from 4.7 to ECC6. While testing one of the program which uses OLE and downloads few details to MSWORD, we noticed that few of the variables of type OBJ_RECORD are not getting populated in the program. So few of the details are missing in MSWORD. We compared the program in old and new version and found that there are no differences in the code.

Pasted below is one piece of code in which the variable is not getting populated.

TYPE-POOL OLE2 .

TYPES:

OLE2_OBJECT LIKE OBJ_RECORD.

DATA: gs_word TYPE ole2_object, "OLE object handle

gs_documents TYPE ole2_object, "Documents

gs_tables TYPE ole2_object, "Tables

gs_range TYPE ole2_object, "Range handle for various ranges

gs_table TYPE ole2_object, "One table

gs_table_border TYPE ole2_object, "Table border

gs_cell TYPE ole2_object, "One cell of the table

CREATE OBJECT gs_word 'WORD.APPLICATION' . " We get the values in the structure gs_word after the execution of this statement.

*--Setting object's visibility property

SET PROPERTY OF gs_word 'Visible' = '1' .

*--Opening a new document

GET PROPERTY OF gs_word 'Documents' = gs_documents . " Though sy-subrc returns 0, gs_documents will not get populated.

CALL METHOD OF gs_documents 'Add' .

GET PROPERTY OF gs_table 'Borders' = gs_table_border .

SET PROPERTY OF gs_table_border 'Enable' = '1' . "With border " Returns sy-subrc Eq 3 and gs_table_border will be empty

CALL METHOD OF gs_table 'Cell' = gs_cell " gs_table will be blank so is gs_cell.

EXPORTING

#1 = '1' "first row

#2 = ld_counter. "column

*--Getting the range handle to write the text

GET PROPERTY OF gs_cell 'Range' = gs_range . "returns sy-subrc eq 2.

As i m new to ABAP OLE, i m not able to figure out the error. Can sombody help me solve this.

Regards,

Soumya