cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP function call through vba

Former Member
0 Kudos

Hi

I am a vba/ .net developer. An ABAP programmer created an ABAP function and I´d like to call it through VBA code.

To access it in SAP GUI, the user access the transaction /N/TENR/MM0035

However, when I access it in a VBA code I get an error

...

Set oCtrl = CreateObject("sap.Functions")

Set oLogon = CreateObject("sap.logoncontrol.1")

Set oCtrl.Connection = oLogon.newconnection

oCtrl.Connection.Logon

Set obj = oCtrl.Add("/n/TENR/MM0035")

I get an erro at last line code: Error 1001: SAP Remote Function Call

It seems it cound not find the function. When I change the function name to BAPI_MATERIAL_AVAILABILITY, for instance, it works.

Can anybody help

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi pklj_2000,

you can try the following:


. . .
Set oCtrl = CreateObject("sap.Functions")
Set oLogon = CreateObject("sap.logoncontrol.1")
Set oCtrl.Connection = oLogon.newconnection
oCtrl.Connection.Logon
'Set obj = oCtrl.Add("/n/TENR/MM0035")
session.findById("wnd[0]/tbar[0]/okcd").text = "/n/TENR/MM0035"
session.findById("wnd[0]").sendVKey 0
. . .

Regards,

ScriptMan