Skip to Content
0
Former Member
Mar 02, 2011 at 03:08 AM

Log onto SAP CRM system via VBA

62 Views

Hi all and apologies if I'm in the wrong forum. I've been using the function RFC_READ_TABLE to read data from R3 via an Access database for a while now. I now have to branch out and read data from CRM but I am not having much luck. The problem seems to be that I can't login to the CRM system the same way that I am currently logging into R3. Here is a snippet of what I am currently doing.

Function LogOnR3() As Boolean
 
Set R3 = CreateObject("SAP.Functions")
 
R3.Connection.ApplicationServer = UsrInfo.lServer
R3.Connection.System = UsrInfo.lSystem
R3.Connection.Client = UsrInfo.lClient
R3.Connection.User = UsrInfo.lUser
R3.Connection.Password = UsrInfo.lPassWord
R3.Connection.Language = UsrInfo.lLang
R3.LogLevel = 9
 
SysStr = SysCmd(acSysCmdSetStatus, "Logging on to SAP R/3...Functions")
If R3.Connection.Logon(0, UsrInfo.lSilent)  True Then
    MsgBox ("Could not log on")
    UsrInfo.lStatus = "Logged Off"
    SysStr = SysCmd(acSysCmdClearStatus)
    Exit Function
End If
 
 
LogOnR3 = True
UsrInfo.lStatus = "Logged On"
End Function

All of the UsrInfo variables are populated prior to this log on function. If I enter all the details for the R3 system then it works perfectly. If I enter all the details for the CRM system, it will not login unless I provide my R3 password. So it is logging on the the R3 system, even though I am providing the CRM system, server, client, etc and then I can't read any of the CRM tables. How do I login to CRM.

Essentially I am trying to read information from the tables CRMD_ORDERADM_H, CRMD_ORDERADM_I, IBIB, IBIN, etc but it seems that because I'm logged into the R3 system instead I can't read these tables. Does the function RFC_READ_TABLE even exist in CRM, I don't have the access to look it up?

Alternatively, is there tables in R3 that show all the details of a business transaction, ibase, etc, that I could use instead so I don't have to login to CRM. For example, I can read data from the view IAOM_CRM_AUFK but this does not provide me with all the information that I'm looking for. I have a very limited knowledge of CRM and SAP.

Any help would be greatly appreciated.