cancel
Showing results for 
Search instead for 
Did you mean: 

Calling SAP function from Excel

Former Member
0 Kudos

Hi Gurus,

We are facing a  problem while trying to call a function module from Excel. We are pretty standard VBA code in our application however for one particular function module RSEC_CREATE_AUTHORIZATION_API, I am getting an error "Object Variable or With block variable not set " on the last line of the code copied below. Any inputs will be greatly appreciated as I have no clue about the problem with this particular function module. Thanks...

I have tested the FM in ABAP and it works as it  should.

Dim objBAPIControl As Object 'Function Control (Collection object)
Dim objAuthList As Object ' Function Object

'Create the Logon Control & Function Controls
Set objBAPIControl = CreateObject("SAP.Functions")
Set objAuthList = objBAPIControl.Add("RSEC_CREATE_AUTHORIZATION_API")

'Get a connection object
Set oConnection = objBAPIControl.Connection

'Try to connect to the R/3 System
If oConnection.Logon(1, False) = False Then
    MsgBox "R/3 connection failed"
    Exit Sub
End If

'Declare the structure parameters
Dim exportCollection As Object
Dim authValue As Object

Set exportCollection = objAuthList.Exports

Accepted Solutions (0)

Answers (1)

Answers (1)

michael_hobbins
Active Participant
0 Kudos

Hi Aninda:

  we have ERP 6.00 (no EHPs installed yet) and that FM doesn't exist. What version of ERP do you have? I tried your code with FM RSEC_GET_PROPERTIES and it works fine, so I understand the problem isn't your code but the FM which may not exist in your system.

Cheers,

Michael

Former Member
0 Kudos

Hi Michael,

Its a newer FM certainly, certainly and the I was actually excited to find a RFC enabled function module to do the job its suppossed to do. Its a BI specific function module and I am on BI7.3. However, I did find the function module in SE37 and could test it from there as well.

Thanks,

Aninda

michael_hobbins
Active Participant
0 Kudos

OK, sorry I can't help (we don't have BI), good luck

Michael