Skip to Content
Technical Articles
Author's profile photo Stefan Schnell

Tip: How to use ActiveX RFC Controls without SAP GUI for Windows

Since a long time SAP offers the ActiveX RFC Controls – wrapper around the classic RFC library (LibRFC [ANSI] and LibRFCU [Unicode]).

You can use this ActiveX Controls without SAP GUI for Windows installation very easily.

Copy for ANSI the files:

  • wdobapi.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtaocx.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtfuncs.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtlog.ocx – from directory Common Files\SAP Shared
  • librfc32.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment
  • convlib.dll – from directory Common Files\SAP Shared with SAP GUI 7.40
  • sapfewut.dllfrom directory Common Files\SAP Shared with SAP GUI 7.40
  • sapfilecache.dllfrom directory Common Files\SAP Shared with SAP GUI 7.40
  • saplgmgr2.dllfrom directory Common Files\SAP Shared with SAP GUI 7.40
  • sapmime.dllfrom directory Common Files\SAP Shared with SAP GUI 7.40

Copy for Unicode the files:

  • wdobapiU.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtaocxU.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtfuncU.ocx – from directory SAP\FrontEnd\SAPgui
  • wdtlogU.ocx – from directory SAP\FrontEnd\SAPgui, with SAP GUI 7.40 from directory SAP\FrontEnd\SAPgui\Unicode
  • librfc32u.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment
  • icudt34.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.30
  • icudt50.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.40
  • icuin34.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.30
  • icuin50.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.40
  • icuuc34.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.30
  • icuuc50.dll – from directory system32 on 32-bit and from syswow64 on 64-bit Windows environment with SAP GUI 7.40
  • convlib.dll – from directory SAP\FrontEnd\SAPgui\Unicode Shared with SAP GUI 7.40
  • sapfewut.dllfrom directory SAP\FrontEnd\SAPgui\Unicode Shared with SAP GUI 7.40
  • sapfilecache.dllfrom directory SAP\FrontEnd\SAPgui\Unicode Shared with SAP GUI 7.40
  • saplgmgr2.dllfrom directory SAP\FrontEnd\SAPgui\Unicode Shared with SAP GUI 7.40
  • sapmime.dllfrom directory SAP\FrontEnd\SAPgui\Unicode Shared with SAP GUI 7.40

Also you need the Microsoft VC runtime libraries VC2012, this means VC 11, e.g. from here.

Store this libraries in different sub directories, e.g. ANSI and Unicode, and register the ocx libraries. Now you can use the SAP ActiveX RFC Controls e.g. in VBA or VBScript, without an installed SAP GUI for Windows.

Here a VBScript example:

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

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

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

      '-Variables-------------------------------------------------------
        Dim SAPFunc, Connection, SAPConnection, PingFunc, retPing
        Dim exceptPing

      '-Get SAP.Functions-----------------------------------------------
        Set SAPFunc = CreateObject("SAP.Functions.Unicode")

        If Not IsObject(SAPFunc) Then
          MsgBox "CreateObject(SAP.Functions.Unicode) failed", _
            vbOkOnly, "Error"
          Exit Sub
        End If

      '-Get SAP.LogonControl connection---------------------------------
        Set Connection = SAPFunc.Connection()

        If Not IsObject(Connection) Then
          MsgBox "SAPFunc.Connection failed", vbOkOnly, "Error"
          Exit Sub
        End If

      '-Set connection parameters---------------------------------------
        Connection.Client = "001"
        Connection.User = "BCUSER"
        Connection.Password = "minisap"
        Connection.Language = "EN"
        Connection.System = "NSP"
        Connection.HostName = "ABAP"
        Connection.SystemNumber = 0

      '-Connect SAP system----------------------------------------------
        SAPConnection = Connection.Logon(0, vbFalse)

      If SAPConnection <> 0 Then

        '-Call ABAP function module RFC_PING----------------------------
          Set PingFunc = SAPFunc.Add("RFC_PING")
          If IsObject(PingFunc) Then
            retPing = PingFunc.Call()
            If retPing = False Then
              exceptPing = PingFunc.Exception()
              MsgBox CStr(exceptPing), vbOkOnly, "Result"
            Else
              MsgBox CStr(retPing), vbOkOnly, "Result"
            End If
          End If

        '-Logoff--------------------------------------------------------
          Connection.Logoff()

      Else
        MsgBox "Connection.Logon failed", vbOkOnly, "Error"
      End If

    End Sub

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

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

 

Addendum 2017/05/20:

With the SAP GUI for Windows 7.50 offers SAP new ActiveX libraries which bases on SAP NetWeaver RFC Library. Here the necessary files from an x64 Windows installation:

  • wdobapiU.ocx – from directory SAP\FrontEnd\SAPgui\Unicode
  • wdtaocxU.ocx – from directory SAP\FrontEnd\SAPgui\Unicode
  • wdtfuncU.ocx – from directory SAP\FrontEnd\SAPgui\Unicode
  • wdtlogU.ocx – from directory SAP\FrontEnd\SAPgui\Unicode
  • SAPRfcWrapperU.dll – from directory Program Files (x86)\Common Files\SAP Shared
  • sapnwrfc.dll – from c:\Windows\SysWOW64
  • icudt50.dll – from c:\Windows\SysWOW64
  • icuin50.dll – from c:\Windows\SysWOW64
  • icuuc50.dll – from c:\Windows\SysWOW64
  • convlib.dll – from directory SAP\FrontEnd\SAPgui\Unicode
  • sapfewut.dll – from directory SAP\FrontEnd\SAPgui\Unicode
  • sapfilecache.dll – from directory SAP\FrontEnd\SAPgui\Unicode
  • saplgmgr2.dll – from directory SAP\FrontEnd\SAPgui\Unicode
  • sapmime.dll – from directory SAP\FrontEnd\SAPgui\Unicode

Also you need the Microsoft VC runtime libraries VC2013, this means VC 12. Register the ocx libraries and the SAPRfcWrapper.dll library.

Assigned Tags

      24 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Stefan,

      How does one convert this same script to python and from python reference the OCX and DLL files?

      Thanks,

      Mason

       

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

      Hello Mason,

      thanks for your reply. I don't know if someone converted this script to Python. ActiveX interface and Classic RFC Library are deprecated components, so it is not advised to use it now.

      Cheers
      Stefan

      Author's profile photo Former Member
      Former Member

      Hello Stefan,
      we have the same solution running on an old Windows2003 server. It's time to move it to an Windows 2012R2.
      I try to follow your recommendations, but I cannot register dll and ocx files. Do I have to get all the files from a SAPGUI 7.50 for X64 as the server is X64?

      Thank you for your reply.

      Vincent

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

      Hello Vincent,

      thanks for your reply.

      It is possible to run the described configuration on an x64 system, I do it by myself. All you must do is to open an x86 console window - C:\Windows\SysWOW64\cmd.exe - as administrator, this is very important. Register now the libraries and all should work well.

      Let us know your result.

      Cheers
      Stefan

      Author's profile photo Paul Gendreau
      Paul Gendreau

      Do you recommend adopting SAPRfcWrapperU.dll for my VB.NET application rather than SAP Connector for MS .NET (NCO) ?  I have the implementation of SAP Connector for MS .NET (NCO) working, but am unsure whether I should have chosen to use the 7.50 OCX.   It appears that SAP Connector for MS .NET (NCO) works with just 2 DLL, does not require COM registration, and my application is now independent of any installed SAP GUI version, which I like very much.

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

      Hello Paul,

      in my opinion is in your case a good solution to use NCo. You name good reasons. I think the OCX libaries are interesting to adopt existing projects or if you work in restrictives environments, where only SAP GUI for Windows is available and the programmer don't have any chance to use other possibilities.

      Best regards
      Stefan

      Author's profile photo Former Member
      Former Member

      Hi Stefan!

      Thanks for the post, it is very useful!

      I am trying to learn more about Automatic Logon. (on SAP GUI 740)

      I implemented your code for RFC_READ_TABLE (as a Python script) and it works. I run the code, I get the SAP Logon pop-up filled with Client, User, Password and Language. I only have to press 'OK ' and my query runs.

      As I understand setting Connection.Logon(0, vbFalse) to vbTrue does not pop-up the SAP Logon window and I assumed that it means the script would log in automatically, but in our case the later query fails with error: 1001, 'No connection to SAP system available.'. I am guessing the login simply does not occur, since I am not clicking on any 'OK' button.

      On the 'Advanced' tab of the SAP Logon window I noticed the 'Automatic Logon' option. I have it checked, but still the script cannot automatically log in on the next try. I am assuming something like Connection.AutoLogon must also be set to True, which I have tried without any effect.

      I am trying to figure out if I am looking in the wrong place or whether my colleague is right, who mentioned that a few releases ago the Auto Logon was disabled (not sure if in the SAP GUI or server, I don't know where this can be configured by our IT).

      If you could share a few ideas regarding Auto Logon that would be great!

      Have a schönes Tag!

      Fred

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

      Hello Fred,

      thanks for your reply.

      The flag at Connection.Logon is a silent flag, vbFalse = 0 means a dialog is shown and vbTrue = -1 (this is a little bit tricky) means a dialog is not shown. With a silent logon is equal to vbTrue you can connect a system without any dialog. I checked this with SAP GUI for Windows 7.50 SP 1, where Badari Nath and his colleagues set the ActiveX components on a new platform, and it works without any problems on a back end system with SAP_BASIS 7.02 Level 006.

      I don't know an option on the back end to disable auto logon, but I assume it is not correct, because in this case no RFC connection could connect an SAP system without dialog.

      Best regards
      Stefan

      Author's profile photo Former Member
      Former Member

      Hi Stefan

      Thanks for the information, I find it very useful. Could you please help me with this issue? I cannot figure out a solution.

      I’m new to SAP and I’m doing my very first scripts to work in SAP trough VBA. I’ve done some scripts wich I execute from Excel. Those scripts get into SAP, perform some actions and download information into an Excel file. Everything is done via SAP GUI for Windows and I’m constantly getting errors due to the Active Window ID. If the user is working in any other application like Outlook the script likely will throw an error like “ID not found”. Surfing the web looking for solutions I came to this article and I have a couple of questions given my few knowledge of SAP.

      1. Is it possible to use activeX RFC Controls to work with SAP even if the user has a session already opened in SAP GUI? I mean, to use this features and get all the job done on the backstage and avoid all those errors which occur while interacting with SAP GUI.
      2. If above is not possible, is there a better way to avoid using the ActiveWindow ID? what I have so far is something like this:
      Dim SapGuiAuto, SAPApp, SAPCon, session As Object
      
      Set SapGuiAuto = GetObject("SAPGUI")
      Set SAPApp = SapGuiAuto.GetScriptingEngine
      Set SAPCon = SAPApp.Children(0)
      Set session = SAPCon.Children(0)
      
      session.findById("wnd[0]").maximize  '' This is exactly what I want to avoid
      session.findById("wnd[0]/tbar[0]/okcd").Text = "/nudm_specialist"
      session.findById("wnd[0]").sendVKey 0
      
      ...

      In other piece of code I have the following:

      Dim popup As String
      
      ''Next sentence will get the Active Window ID in order to close all those popups that SAP GUI throws when working on it
      
      popup = session.ActiveWindow.GuiFocus.ID
      If popup = "/app/con[0]/ses[0]/wnd[2]/usr/txtMESSTXT1" Then
      session.findById("wnd[2]").Close
      End If
      

       

      I have to repeat the code from above several times to get all the possible popups (not always displayed) and I know is bad coding but I have not been able to get a better solution. Most of errors the user gets while running the script is precisely in this sentence:

      popup = session.ActiveWindow.GuiFocus.ID

      or in this other one:

      session.findById(“wnd[2]”).Close

      getting the “Control could not be found by ID” error.

      I think this is due to the several Windows the user has opened, as Outlook, Skype or a Web Browser. I cannot tell the user to stop working on its computer and if the user has already open many Windows of SAP GUI the script will likely collapse in any time.

       

      I hope you can help me whit this, I’ve been breaking my head for weeks whit this issue. Thank you so much.

      PS. Please forgive my bad English

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

       

      Hello Osvaldo,

      thanks for your reply and welcome in the SAP Community.

       

      First of all: Do not be discouraged, the beginning is always troublesome. In a week you are good, in two weeks you are better, in four weeks you are even better, but in hundred weeks you will realize that there are always things you do not know.

       

      It seems that something needs to be clarified. An RFC connection with an SAP backend and a connection via SAP GUI Scripting are independently. The ActiveX libraries are wrapper around the SAP NetWeaver RFC library sapnwrfc.dll which offers the possibility ot connect an SAP backend via RFC. This has nothing to do with SAP GUI Scripting. For the communication with an SAP system via RFC you need remote function call ready enabled function modules (RFM) on the backend. So your question one can be answered:

      Is it possible to use activeX RFC Controls to work with SAP even if the user has a session already opened in SAP GUI? Yes
      I mean, to use this features and get all the job done on the backstage and avoid all those errors which occur while interacting with SAP GUI. These are totally different ways to work with an SAP system. SAP GUI Scripting simulates user activities on UI during ActiveX controls communicate via RFC.

      To your second question: As far as I understand you correct you want to close a dialog window, which exists in a context of SAP GUI. You can find different solutions to do that for VBA here. All you need is the title of the window.

      Let us know your results.

      Cheers
      Stefan

       

      P.S. American is also not my native toungue, and I believe also from the most users here. Your American is pretty good.

       

      Author's profile photo Former Member
      Former Member

       

      Hi Stefan, thanks so much for your explanation and good wishes.

       

      I tried the solutions provided in the link you posted and they work perfectly, though I'm still getting the error due to the users activity while running the macro. I surfed the web looking for answers and came to this thread. I'm interested in the same subject than the author of the question because I think it would be great to get a well defined library to work with the SAP GUI. I tried the SAPFEWSELib as the author did and got exactly the same error that he mentions. That's a pity, because SAPFEWSELib actually includes a lot of procedures and objects that seem to be so useful and I suspect that library might be the solution to my main issue: being able to run the macro without telling the user to stop working.

       

      On the other hand I'm afraid I won't be able to implement the ActiveX libraries because I don't really understand the way they work, I have a lot to study in the meantime.

       

      Thanks again for your help, I really find your articles and answers very instructive.

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

      Hello Osvaldo,

      thanks for your reply.

      I am not really sure that I understand your problem correctly. SAP GUI Scripting works for a lot of use cases very very good. I use it since years with success with many different scripting and compiler languages.

      One of the questions of the thread you linked trough is:
      "I don't like the SapGuiAuto As Object as it doesn't really say what it is..."
      SapGuiAuto offers ISapGuiAuto interface of the module saplogon.exe, but it seems not possible to get the type library of it. So it is one way to accept that SapGuiAuto is an untyped object.

      Don't be afraid, ActiveX is a systemwide interface to libraries. The interface includes a description of the parameters of the methods and attributes. It is a great idea and very easy to use. All you need is practice. Try it, try it, try it. Each of us has begun like you.
      In Germany we say: "Es ist noch kein Meister vom Himmel gefallen." In American: "It is not yet a master fallen from heaven." Which means everybody needs practice and for that you need time.

      Cheers
      Stefan

      Author's profile photo Former Member
      Former Member

       

      Hi Stefan,

      Thanks for your answer.

      My problem is that I have to get some text from a field in the UDM_Specialist. I can only access to that field after typing the costumer ID, pressing some buttons and closing a variable number of warning/message windows. Perhaps I should try to change my programming approach. I have worked with Scripts from VBA to SAP and they have worked perfectly, this is my first problem with scripts. Here is my full code:

      Sub Download_Comments()
          '==========================================================================='
          '==========================================================================='
          'Variables Declared                                                      '
          
          Dim SapGuiAuto, SAPApp, SAPCon, session As Object
          Dim objExcel
          Dim idh, astid As String
          Dim myRow As Long
          Dim i, renglon As Integer
          Dim myRange, celda As Range
      
          Set SapGuiAuto = GetObject("SAPGUI")
          Set SAPApp = SapGuiAuto.GetScriptingEngine
          Set SAPCon = SAPApp.Children(0)
          Set session = SAPCon.Children(0)
          Set objExcel = GetObject(, "Excel.Application")
              
          '==========================================================================='
          
          'MAIN CODE HERE
          
          'Here I define the range containing the Costumers ID's
          renglon = Cells(Rows.Count, "B").End(xlUp).Row
          Range("B2:B" & renglon).Select
          Set myRange = Selection.SpecialCells(xlCellTypeVisible)
          If renglon = 2 Then
              Set myRange = Range("B2")
          End If
          
          'Interacting with SAP
          session.findById("wnd[0]").maximize
          session.findById("wnd[0]/tbar[0]/okcd").Text = "/nudm_specialist"
          session.findById("wnd[0]").sendVKey 0
          
          For Each celda In myRange
              myRow = celda.Row
              idh = celda.Value
              session.findById("wnd[0]/usr/cntlGO_BUTTON_CONT/shellcont/shell").pressContextButton "CONT"
              'Get the window to type the customer ID
              session.findById("wnd[0]/usr/cntlGO_BUTTON_CONT/shellcont/shell").selectContextMenuItem "OBPAR"
              'Type the customer ID and the country
              session.findById("wnd[1]/usr/ctxtUDM_S_BUSINESS_PARTNER-BUSINESS_PARTNER").Text = idh
              session.findById("wnd[1]/usr/ctxtUDM_S_BUSINESS_PARTNER-COLL_SEGMENT").Text = "LA_" & Sociedad
              session.findById("wnd[1]/tbar[0]/btn[0]").press
              '' Here I begin to test the windows that may appear
              '' Assigned to another responsible Window
              astid = session.ActiveWindow.GuiFocus.ID
              If astid = "/app/con[0]/ses[0]/wnd[2]/usr/txtMESSTXT1" Then
                  session.findById("wnd[2]").Close
              End If
              astid = vbNullString
              '' Over one hundred invoices Window
              astid = session.ActiveWindow.GuiFocus.ID
              If astid = "/app/con[0]/ses[0]/wnd[2]/usr/txtMESSTXT1" Then
                  session.findById("wnd[2]").Close
              End If
              astid = vbNullString
              '' Second over one hundred invoices Window
              astid = session.ActiveWindow.GuiFocus.ID
              If Left(astid, 25) = "/app/con[0]/ses[0]/wnd[2]" Then
                  session.findById("wnd[2]").Close
              End If
              astid = vbNullString
              'After closing those windows now I can see the information
              session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT").Select
              '' Here I need to select first row, if there aren't any rows It would throw an error
              On Error Resume Next
              session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_GRID_CONT/shellcont/shell").selectedRows = "0"
              If Err.Number <> 0 Then '' Get out if there aren't any rows
                  session.findById("wnd[0]/tbar[0]/btn[15]").press
                  session.findById("wnd[1]/tbar[0]/btn[7]").press
                  Err.Number = 0
              Else                    '' If there is at least one row this will copy the text of the field
                  session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_BUTTON_CONT/shellcont/shell").pressButton "CCT_DISPLAY"
                  objExcel.Cells(myRow, 33).Value = session.findById("wnd[1]/usr/cntlCCT_NOTE_CONT/shellcont/shell").Text
                  session.findById("wnd[1]").Close
                  session.findById("wnd[0]/tbar[0]/btn[3]").press
                  session.findById("wnd[1]/tbar[0]/btn[7]").press
              End If
          Next celda
              
          '==========================================================================='
          '==========================================================================='
      End Sub

      I don't really like that code because I feel that I don't have under control anything that's happening on the background. Perhaps I have to change my programming approach.

      thanks again for your good wishes, they mean a lot! specially in these days of frustration

      I like that idiom (phrase? expression?) of you. Here in México we have a similar one in meaning: "Más sabe el diablo por ser viejo que por ser diablo" which in American would be something like this: "The Devil knows more because he is old than because he is the Devil" and that means that the more old you get or the more you practice something, the more experienced you are.

      Have a nice day.

       

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

      Hello Osvaldo,

      thank you very much for your reply and for your sageness.

      Sorry, I can’t try your code, I don’t have any data.

      Here a suggestion, try instead this

      On Error Resume Next
        session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_GRID_CONT/shellcont/shell").selectedRows = "0"
      If Err.Number <> 0 Then '' Get out if there aren't any rows
        session.findById("wnd[0]/tbar[0]/btn[15]").press
        session.findById("wnd[1]/tbar[0]/btn[7]").press
        Err.Number = 0
      Else
        session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_BUTTON_CONT/shellcont/shell").pressButton "CCT_DISPLAY"
        objExcel.Cells(myRow, 33).Value = session.findById("wnd[1]/usr/cntlCCT_NOTE_CONT/shellcont/shell").Text
        session.findById("wnd[1]").Close
        session.findById("wnd[0]/tbar[0]/btn[3]").press
        session.findById("wnd[1]/tbar[0]/btn[7]").press
      End If

      this

      Rows = session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_GRID_CONT/shellcont/shell").RowCount
      If Rows = 0
        session.findById("wnd[0]/tbar[0]/btn[15]").press
        session.findById("wnd[1]/tbar[0]/btn[7]").press  
      Else
        session.findById("wnd[0]/usr/subCARRIER:SAPLFDM_COLL_BASIS_FE:0100/tabsTABSTRIP/tabpTAB_CCT/ssubOVERVIEW_SUBAREA:SAPLFDM_COLL_CCT_FE:1010/cntlCCT_BUTTON_CONT/shellcont/shell").pressButton "CCT_DISPLAY"
        objExcel.Cells(myRow, 33).Value = session.findById("wnd[1]/usr/cntlCCT_NOTE_CONT/shellcont/shell").Text
        session.findById("wnd[1]").Close
        session.findById("wnd[0]/tbar[0]/btn[3]").press
        session.findById("wnd[1]/tbar[0]/btn[7]").press
      End If
      

      As far as I can see looks your code good.

      Best regards
      Stefan

      Author's profile photo Former Member
      Former Member

      Hi Stefan,

      Sorry for the delay, I've been busy and couldn't reply

       

      Thanks for the suggestion, it works perfectly!

       

      I hope you have a nice day, thank you so much for your time and for sharing your knowledge, that means a lot. I'll keep an eye on your posts, I'm learning a lot.

      Author's profile photo Timon Rolf
      Timon Rolf

       

      Hello Stefan,

       

      can you give any help on how to pass a table when calling a BAPI?

      I know how to pass one parameter, but I aim to pass a Structure and Table as well.

       

      Thanks in advance!

      Author's profile photo Demarest David
      Demarest David

      Hi Guys,

      i've recently change my laptop for a 64bits machine.

      I've SapGUI 7.5 and i've  regsitered unicode ocx but unfortunately, i encountered always the same issue when i try to connect from Excel or Access. "ActiveX can"t create object" at this lign

      Set SapConn = CreateObject("SAP.Functions.Unicode"), it works with my old laptop 🙁

      thanks for your help

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

      Hello Demarest,

      do you use the x64 version of Microsoft Office? If yes, you can't use the ActiveX libraries in this context, these libraries are x86.

      Best regards
      Stefan

      Author's profile photo Demarest David
      Demarest David

      Hi Stefan,

      Thanks for your quick reply

      i have found a workaround with some new registry entries (DllSurrogate). i can now connect and retrieve data but i'm facing a new issue during an upload. I try to upload idoc.

      i've a message "Bad variant type" at his line, it works before with 32bits version. D you have an idea ?

      Public Function CreateR3Structure(objConn As Object, strRefStruct As String, strParmName As String) As Object
      Dim objTable As Object
      Dim lngResult As Long

      'Initialize bdctable
      Set objTable = CreateObject("SAP.TableFactory.Unicode.1")
      Set CreateR3Structure = objTable.NewStructure
      'For export bdctable
      lngResult = CreateR3Structure.CreateFromR3Repository(objConn.Connection, strRefStruct, strParmName)
      Set objTable = Nothing

      End Function

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

      Hello Demarest,

      thanks for your reply.

      I know the DllSurrogate solution, nearly four years ago I presented it here.

      I assume that the R3Connection parameter of the CreateFromR3Repository method expects an x86 IDispatch (Long - 4 Bytes), but you send an x64 IDispatch (LongPtr - 8 Bytes). You can find more information about different types here. It seems better to don't use the unspecified Object type and to use SAPLogonCtrl.Connection type instead.

      Let us know your results.

      Best regards
      Stefan

      Author's profile photo Dan Zegelien
      Dan Zegelien

      Hi all, hoping for some quick help.  I'm using ActiveX RFC connection to my SAP ECC5 to return characters in English, Spanish, French, Italian, Portuguese  and Czech. I haven't touched the code in a couple of years, but now some of the Czech characters are not coming out correctly.   I'm using SAPFunctionsOCX, and codepage 4110, as I always have.

      The SAP system has had very little changes in the last 2 years.   What has changed is that I'm working on a Windows7 machine, but I also tried on an old XP machine and the Czech characters are still not coming out right.

      Any ideas here?  I'm thinking there's a dll or ocx that has changed, but I don't even know where to start looking.....

      Author's profile photo Christian Taconet Martin
      Christian Taconet Martin

      Thank you Stefan for this information.

      Do you think it would be possible to use this Tip to use ActiveX Controls Classic RFC from a SAP GUI 7.40 on a computer with SAP GUI 7.60?

      Thank you very much

      Christian Taconet

      Author's profile photo Ray Chen
      Ray Chen

      Hi Stefan:

      your article is very for me awesome every time.

      Now , I have a decoder problem on below here.

      Set SAPFunc = CreateObject("SAP.Functions.Unicode")

      SAPConnection = Connection.Logon(0, True)

      If we use front situation , let user keyin login info in chinese environment.

      but the pop gui windows , we look error code in every word. how can solve it? thanks.

       

      Author's profile photo Alberto Bava
      Alberto Bava

      Hi Stefan,
      could you describe how to do it with the latest version of sap gui (7.70)?

      Many thanks