Application Development and Automation 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: 
Read only

function module

Former Member
0 Likes
354

Moderator message: please use a meaningful subject in future

Hi....

I have a code which i want to transfer it into a function module.But its generation some error.I am proving you with the code.

Can you help me out how to make the FM out of it.

It will be very helpful to me.

CODE:

type-pools ole2 .

  • word declarations

data: application type ole2_object.

data: word type ole2_object.

data: documents type ole2_object.

data: newdoc type ole2_object.

data: actdoc type ole2_object.

data: selection type ole2_object.

data: inlineshapes type ole2_object.

CREATE OBJECT word 'WORD.APPLICATION' .

IF sy-subrc NE 0 .

MESSAGE s000(su) WITH 'Error while creating OLE object!'.

LEAVE PROGRAM .

ENDIF .

GET PROPERTY OF word 'documents' = documents.

CALL METHOD OF documents 'Add' = newdoc.

  • EXPORTING

  • #1 = 0.

call method of newdoc 'Activate'.

*--Getting active document handle

GET PROPERTY OF word 'activedocument' = actdoc .

*--Getting applications handle

GET PROPERTY OF word 'Selection' = selection.

*--setting object's visibility property

SET PROPERTY OF word 'visible' = '1' .

GET PROPERTY OF selection 'InlineShapes' = inlineshapes.

  • insert the picture in default (top left) position

data: h_logo type ole2_object.

data: h_ins_logo type ole2_object.

data: h_logo_left type ole2_object.

data: h_pos_logo type ole2_object.

CALL METHOD OF inlineshapes 'AddPicture' = h_ins_logo

EXPORTING

#1 = 'C:\pic.gif'.

Kind Regards,

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
324

It would be helpful if you provided us with details of the error as well!

Also, please use tags around code fragments to keep the formatting.

matt

Read only

Former Member
0 Likes
324

Hi Matt,

The error is showing 'word' cannot be changed.I dnt understand that.

Kind Regards,