Skip to Content
0
Former Member
May 08, 2010 at 04:56 AM

Connect SAP using EXCEl on win 97

43 Views

Dear gurus

i have made a bapi and im calling it from EXCEL.

below is the connection code.

Public Const CNT_STR_USR As String = "ABAP"
Public Const CNT_STR_PWD As String = "******"
Public Const CNT_STR_APPLN_SRVR As String = "***.***.**.**"
Public Const CNT_STR_SYSTEM As String = "R3P"
Public Const CNT_STR_SYS_NUM As String = "00"
Public Const CNT_STR_CLIENT As String = "800"
Public Const CNT_STR_LOGON_LANG As String = "EN"
Public Const CNT_STR_ROUTER As String = "/H/***.***.***.***/H/"
Public Const CNT_STR_LOG_FILE As String = "C:\Store_Activities.txt"
Public Const CNT_INT_LOG_LEVEL As Integer = 9

Sub button1_click()
Dim objCompanyCodes As Object

Set obSAPFnCntrl = CreateObject("SAP.Functions")
Set obSAPConn = obSAPFnCntrl.Connection

' Log the overall activity
obSAPFnCntrl.LogLevel = CNT_INT_LOG_LEVEL
obSAPFnCntrl.LogFileName = CNT_STR_LOG_FILE

 
'Set the properties for the connection control

With obSAPConn

.ApplicationServer = CNT_STR_APPLN_SRVR
.SystemNumber = CNT_STR_SYS_NUM
.Destination = "R3D"
.User = CNT_STR_USR
.Password = CNT_STR_PWD
.Language = CNT_STR_LOGON_LANG
.HostName = CNT_STR_APPLN_SRVR
.Client = CNT_STR_CLIENT
'.SAPRouter = CNT_STR_ROUTER

End With

'Logon to SAP in silent mode
If obSAPConn.Logon(0, True) = False Then
    MsgBox "R/3 connection failed"
    Exit Sub
End If

This code is working fine in windows XP under MSOFFICE 2007 but when i try to use on Win97 under office 97 i get this error

ACTIVEX CAN'T CREATE OBJECT

How to resolve this ?

Regards

Saad Nisar