cancel
Showing results for 
Search instead for 
Did you mean: 

SAP GUI Scripting API for 64 bit Office (VBA)

0 Kudos

We're trying to make a SAP Scripting add-in for 64bit Office but we've had no success so far.

Would anyone know if this is feasible? Any help is highly appreaciated.

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_schnell
Active Contributor
0 Kudos

Hello Caitlin,

sure, it can't work.

BNAME = your user name, BCUSER is a standard user
BCODE = your password, minisap is a the standard for BCUSER
LANGU = your language code, e.g. EN, DE is for Germany systems

Try it with

session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "caitlin" 'Here your user name
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "secret" 'Here your password
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN" 'Here your language code 

Best regards
Stefan

stefan_schnell
Active Contributor
0 Kudos

Hello Caitlin,

it is possible to use SAP GUI Scripting with 64-bit applications, also Microsoft Office VBA.

Here an example:

If I remember it right, older versions of the SAP GUI for Windows did not offer this possibility. Which version of SAP GUI for Windows do you use? If it is an older version, update to the actual release.

Best regards
Stefan

Hello Stefan!

We’re using SAP 7.5 patch level 2

Would you know the requirements of SAP Scripting for 64 bit Office? (Example. SAP Version, Patch Level)

Thank you

stefan_schnell
Active Contributor
0 Kudos

Hello Caitlin,

sure, let us know your requirements, on this way we can help you.

Best regards
Stefan

0 Kudos

Would this work with SAP 7.5 Patch level 2?

stefan_schnell
Active Contributor
0 Kudos

Hello Caitlin,
in a normal case I would say yes, but I don't know it definitely because I don't have this environment anymore to check it.

Best regards
Stefan

0 Kudos

In that case we've already tried. with no success. what version are you using?

with our ribbon add-in we are also getting several error messages

stefan_schnell
Active Contributor
0 Kudos

Hello Caitlin,
I tried it with SAP GUI for Windows 7.50 PL 7.

Best regards
Stefan

0 Kudos

We're currently getting this error

We can't identify the cause of the issue.

stefan_schnell
Active Contributor
0 Kudos

How do you get this error? Do you execute the script from above? Does the ST22 show any further information?

0 Kudos

When we logon on the sap gui window under excel. after entering our credentials we get this error.

We're not authorized to use st22

stefan_schnell
Active Contributor
0 Kudos

You mean you do that...

'-Begin-----------------------------------------------------------------

'-Directives------------------------------------------------------------
Option Explicit

'-Sub Main--------------------------------------------------------------
Sub Main()

  '-Variables-----------------------------------------------------------
  Dim SapGuiAuto As Object
  Dim SapApp As SAPFEWSELib.GuiApplication
  Dim connection As SAPFEWSELib.GuiConnection
  Dim session As SAPFEWSELib.GuiSession

  Set SapGuiAuto = GetObject("SAPGUI")
  If Not IsObject(SapGuiAuto) Then
    Exit Sub
  End If

  Set SapApp = SapGuiAuto.GetScriptingEngine
  If Not IsObject(SapApp) Then
    Exit Sub
  End If

  Set connection = SapApp.Children(2)
  If Not IsObject(connection) Then
    Exit Sub
  End If

  Set session = connection.Children(0)
  If Not IsObject(session) Then
    Exit Sub
  End If

  session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "001"
  session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "BCUSER"
  session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "minisap"
  session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "DE"
  session.findById("wnd[0]").sendVKey 0

End Sub

'-End-------------------------------------------------------------------

... and with the execution of sendVKey 0 you get an ABAP error but if you do the same steps manually it works with the same credentials?

0 Kudos

if these codes are in a excel sheet. vbscript wont working

  session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "BCUSER"
  session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "minisap"
  session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "DE" 

example:

how would we run this on vba?