Skip to Content
Technical Articles

Execute 64-bit Application with the SAP GUI for Windows

More and more 64-bit programs are used in the 64-bit Windows environment. 32-bit programs, sometimes marked with the extension x86, becomes successively less. So I asked myself the question: What is with the SAP GUI for Windows, which is a 32-bit application, is it also possible to start x64 applications?

To execute applications on the front-end server via ABAP we use in a normal case the method Execute of the class cl_gui_frontend_services. This method uses the native API function ShellExecute from Windows. This API function can also start x64 programs from a 32-bit process, as you can read here. So it should not a problem to start x64 applications from x86 SAP GUI for Windows, and thats how it is.

For testing, I have started the notepad editor as shown in the following code snippet:

*-Begin-----------------------------------------------------------------
  Program zExecuteTest.

  Data:
    lr_fe_serv Type Ref To CL_GUI_FRONTEND_SERVICES
    .

  Create Object lr_fe_serv.

  Check lr_fe_serv->Get_Platform( ) = 14.

  lr_fe_serv->Execute(
    Exporting
      "Sysnative folder is only available on x64 Windows and only
      "visible and accessible from x86 software
      Application = '%windir%\Sysnative\notepad.exe'

      "In the directory System32 you find all x64 applications
      "Application = '%windir%\System32\notepad.exe'

      "In the directory SysWOW64 you find all x86 applications
      "Application = '%windir%\SysWOW64\notepad.exe'
    Exceptions
      CNTL_ERROR             = 1
      ERROR_NO_GUI           = 2
      BAD_PARAMETER          = 3
      FILE_NOT_FOUND         = 4
      PATH_NOT_FOUND         = 5
      FILE_EXTENSION_UNKNOWN = 6
      ERROR_EXECUTE_FAILED   = 7
      SYNCHRONOUS_FAILED     = 8
      NOT_SUPPORTED_BY_GUI   = 9
      Others                 = 10
  ).
  If sy-subrc <> 0.

  EndIf.

*-End-------------------------------------------------------------------

By the way, this example shows how the virtual system directory Sysnative can be used to access Windows’s own 64-bit applications. On this way automatic redirection is bypassed. A try to execute a program directly from the System32 directory, as seen in the comment line above does not work, because you are automatically redirected to SysWOW64 and the 32-bit pendant is used. So the using of x64 software, in the context of the SAP GUI for Windows, can easily done.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.