Skip to Content
avatar image
Former Member

ABAP function call through vba

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 02, 2012 at 08:34 AM

    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

    Add comment
    10|10000 characters needed characters exceeded