cancel
Showing results for 
Search instead for 
Did you mean: 

OLE with MS Outlook 2003

markus_reich
Participant
0 Kudos
81

Hello,

I've written a function module in SAP which creates appointments and contacts in Outlook (therefor I use OLE automatization technologie)!

Now I wanted to call this module out of an outlook addin via RFC, but in this case no contacts/appointments where created, although no error occures?

Is generally possible to use R/3 OLE Automatization over RFC?

regards

Markus

Accepted Solutions (1)

Accepted Solutions (1)

former_member188685
Active Contributor
0 Kudos

Hi

Welcome to SDN,

I think You can Do OLE Automization over RFC.

it is possible.

But I never come across.

regards

vijay

Answers (3)

Answers (3)

markus_reich
Participant
0 Kudos

It's not possible

FredericGirod
Active Contributor
0 Kudos

Hi Markus,

I don't know well OLE, but, for OLE I thought that you need to have DLL from Microsoft Office. If your RFC contact direct the SAP server, and if this SAP server doesn't have SAPgui and DLL ... how will you use the OLE ?

Rgd

Frédéric

markus_reich
Participant
0 Kudos

The strange thing is, that at the beginning it seems to work, but now I can't bring it up to work again!

You can register DLL in TA sole, there I entered an entry for outlook.application, but the function module works also without this entry!

regards

Markus

markus_reich
Participant
0 Kudos

Here is the example Function module:

FUNCTION ZEGGER_GW_TEST.

INCLUDE: ole2incl. "OLE2 Automation

DATA: outlook TYPE ole2_object,

namespace TYPE ole2_object,

myfolder TYPE ole2_object,

myitem TYPE ole2_object.

  • Instanzieren Outlook

CREATE OBJECT outlook 'Outlook.Application'.

  • Namensraum

CALL METHOD OF outlook 'GetNamespace' = namespace

EXPORTING

#1 = 'MAPI'.

  • Standard Kontaktverzeichnis

CALL METHOD OF namespace 'GetDefaultFolder' = myfolder

EXPORTING

#1 = 10. "olFolderContacts

  • Kontakt anlegen

CALL METHOD OF outlook 'CreateItem' = myitem

EXPORTING

#1 = 2. "olContactItem

SET PROPERTY OF myitembp 'Categories' = 'SAP'.

SET PROPERTY OF myitem 'Title' = 'Firma'.

SET PROPERTY OF myitem 'CompanyName' = 'Test Outlook'.

SET PROPERTY OF myitem 'BusinessAddressCountry' = 'AT'.

SET PROPERTY OF myitem 'BusinessAddressStreet' = 'Test'.

CALL METHOD OF myitem 'Save'.

FREE myitem.

FREE myfolder.

FREE namespace.

FREE outlook.

ENDFUNCTION.

This module I try to call via RFC in VBA:

Sub Synchronize()

Dim functionCtrl As Object

Dim theFunc As Object

Dim sapConnection As Object

Dim returnFunc As Boolean

Dim die_exception As String

Set functionCtrl = CreateObject("SAP.Functions")

Set sapConnection = functionCtrl.Connection

sapConnection.Client = "client"

sapConnection.User = "user"

sapConnection.Password = "pass"

sapConnection.Language = "spras"

sapConnection.SystemNumber = SysNr

sapConnection.ApplicationServer = "server"

If sapConnection.Logon(0, True) = True Then

Set theFunc = functionCtrl.Add("ZEGGER_GW_TEST")

returnFunc = theFunc.Call

die_exception = theFunc.Exception

sapConnection.Logoff

End If

Set functionCtrl = Nothing

End Sub

Can anybody try this at its system landscape?

Thanx

Meex

Former Member
0 Kudos

Hi

I think it should be possible.

regards

Shailendra