Skip to Content
Author's profile photo Stefan Schnell

SAP GUI Scripting API now Accessible from x64 Application

Today I checked the possibilities of VS Code in the context of SAP GUI Scripting. I use the x64 version and after a while I noted that SAP GUI Scripting works without any problems. So I checked the access to the SAP GUI Scripting API from PowerShell x64, AutoIt x64 and VBScript x64 and in all cases it works perfect. I assumee that this possibility came with one of the newer patch levels of SAP GUI for Windows 7.40. So far it was necessary to use always x86 applications.

In the image below an example with PowerShell ISE x64.

In the image below the same PowerShell example with Visual Studio Code x64.

In the image below an example with AutoIt x64 and Scripting Tracker.

Good to know and a great thanks to the developer team.

Assigned tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Joachim Rees
      Joachim Rees

      Hey Stefan,

      I just noticed out of the 17 Blogs posted on tag "UI SAP GUI for Windows"  this year, 11 are from you!
      If we still had leaderboards you sure would make it to the top! 😉

      Thanks for sharing so much!
      Best
      Joachim

       

      Author's profile photo Stefan Schnell
      Stefan Schnell
      Blog Post Author

      Hello Joachim,

      thank you very much for your kindful words.

      Cheers
      Stefan

      Author's profile photo Hasmukh Ginoya
      Hasmukh Ginoya

      Hello Stefan,

      Thanks for giving support for x64 OS.

      Is this will work with Java Com Automation as well ?

      Which SAP GUI front end software i require and how can i download / get that ?

      I want to integrate SAP Gui scripting using Java and JNI wrapper. So Kindly provide me your valuable inputs.

      Author's profile photo Stefan Schnell
      Stefan Schnell
      Blog Post Author

      Hello Hasmukh,

      you need access to running object table (ROT) to get the SAPGUI object. If you can realize this with your x64 Java COM automation you should be able to use SAP GUI Scripting. And you need the SAP GUI for Windows, use an actual version 7.50 PL 9. You can download it from SAP support portal.

      Let us know your results.

      Best regards
      Stefan

       

      Author's profile photo Hasmukh Ginoya
      Hasmukh Ginoya

      Thanks for Reply,

      let's we will use it and verify that.

      Author's profile photo Владимир Малыгин
      Владимир Малыгин

      For anyone interested, I checked it on Java 64-bit and it works. I used JNA library to access Running Object Table (ROT). Here is an example of how you do it:

      https://github.com/java-native-access/jna/blob/master/contrib/platform/test/com/sun/jna/platform/win32/COM/RunningObjectTable_Test.java

      You can’t do it with JACOB, sadly, because it doesn’t provide you access to system’s ROT. It makes it’s own ROT which has nothing to do with the global one. And since you have to use SapROTWr.SapROTWrapper object which is strictly 32-bit, you can't make it 64-bit compatible.

      With JNA you also have to extend the COMLateBindingObject class. Your class then will use COMLateBindingObject protected methods to access SAPGUI Scripting native methods and properties:

      https://github.com/java-native-access/jna/blob/master/contrib/platform/src/com/sun/jna/platform/win32/COM/COMLateBindingObject.java

      Here is an example with MS Word from which you can extrapolate from as I did:

      https://github.com/java-native-access/jna/blob/master/contrib/msoffice/src/com/sun/jna/platform/win32/COM/office/MSOfficeDemo.java

      https://github.com/java-native-access/jna/blob/master/contrib/msoffice/src/com/sun/jna/platform/win32/COM/office/MSWord.java

      Author's profile photo Geoffery Blackwell
      Geoffery Blackwell

      I've started using JNA recently to work with applications like Excel and Word. But i'm not fully understanding your explanation on how to go about doing the Java ROT class creation. When i look at SapROTWr (CSapROTWrapper & ISapROTWrapper) in VS I find multiple gui's and interface references and am not clear on which of these values need to get pulled over.

      Are you able to provide the ROT you made in using JNA? Sadly there is not much out there on this type of project to go off of.

      Thanks for any guidance you can provide

       

       

      Author's profile photo Hasmukh Ginoya
      Hasmukh Ginoya

      Hi Stefan,

      We have JVM - 64 bit and we are accessing SAP GUI 750 PL 9. This case is running fine.

      But for previous version like SAP GUI 730 , we are not able to access using JVM-64 bit application.

       

      Is there any other option we can access with JVM for support previous version?

      Can you recommended other option as well ?

      Author's profile photo James Bowman
      James Bowman

      Hi Stefan,

       

      First up, echo'ing Joachim, your work on here is unreal! Thank you for all the effort you put in.

       

      For the x64 apps, I guess this update doesn't include Microsoft Office 2016?

       

      I saw the 32bit to 64bit workaround thread, the problem I face is approximately 30 users with no admin rights, so I'm wondering if the x64 doesn't apply to Office 2016, would there be another way to deploy the workaround to all users?

      Thanks,

       

      James

      Author's profile photo Stefan Schnell
      Stefan Schnell
      Blog Post Author

      Hello James,

      this works also with VBA from Microsoft Office x64. I tried it with Office 2013 x64 and it works in my case without any problems. I assume it should work in Office 2016 also,

      Cheers
      Stefan

      '-Begin-----------------------------------------------------------------
      
        '-Directives----------------------------------------------------------
        Option Explicit
      
        '-Main----------------------------------------------------------------
        Sub Main()
          
          Dim SapGuiAuto As Object
          Dim App As SAPFEWSELib.GuiApplication
          Dim connection As SAPFEWSELib.GuiConnection
          Dim session As SAPFEWSELib.GuiSession
          Dim Is64Bit As Boolean
          
          If App Is Nothing Then
            Set SapGuiAuto = GetObject("SAPGUI")
            Set App = SapGuiAuto.GetScriptingEngine
          End If
      
          If connection Is Nothing Then
            Set connection = App.Children(0)
          End If
      
          If session Is Nothing Then
            Set session = connection.Children(0)
          End If
          
          Debug.Print Application.OperatingSystem
          #If Win64 Then
            Is64Bit = True
          #End If
          Debug.Print Is64Bit
          Debug.Print session.Name
          
          
        End Sub
      
      '-End-------------------------------------------------------------------