<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Excel (64-Bit) VBA code to connect to SAP to execute a remote function call (RFC) in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/12576520#M4716052</link>
    <description>&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;I also already replied to your other question about the "class not registered" error. So yes, I would definitely recommend using the .NET Connector for your project: &lt;A href="https://support.sap.com/nco" target="test_blank"&gt;https://support.sap.com/nco&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It has several advantages:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;current .NET technology (while the OCX controls are already +20 years old)&lt;/LI&gt;&lt;LI&gt;no need to mess with COM registration and a dozen .ocx files and dependent .dlls&lt;/LI&gt;&lt;LI&gt;no extra work involved when dealing with Unicode (NCo handles codepage conversions automatically)&lt;/LI&gt;&lt;LI&gt;there is definitely a 64bit version available on the download site&lt;/LI&gt;&lt;LI&gt;easier to get started with, because there is lots of documentation and samples&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Best Regards, Ulrich&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 10:55:27 GMT</pubDate>
    <dc:creator>Ulrich_Schmidt1</dc:creator>
    <dc:date>2022-10-18T10:55:27Z</dc:date>
    <item>
      <title>Excel (64-Bit) VBA code to connect to SAP to execute a remote function call (RFC)</title>
      <link>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaq-p/12576519</link>
      <description>&lt;P&gt;So I'm trying to access SAP inside excel to execute a remote function call.&lt;/P&gt;
  &lt;BR /&gt;My machine runs 64-bit excel and from my research, most returns seem to be describing 32-bit library code. I'm looking for those excel users who may have experience in this matter.
  &lt;BR /&gt;I have found the four *.ocx control files and added them as references but are they 32-bit or 64-bit? (How can you tell?)
  &lt;BR /&gt;
  &lt;BR /&gt;I'm trying code bits on the web but I can't seem to get anything to work. So yeah, if there's a user who is actively engaged in RFCs on a 64-bit machine, I'd love to hear from you. 
  &lt;IMG alt=":)" style="box-sizing: border-box; border-style: none; max-width: none; height: 22px; vertical-align: text-bottom; width: 22px; background: url(&amp;quot;styles/default/xenforo/smilies/emojione/sprite_sheet_emojione.png&amp;quot;) 0px 0px / 100% no-repeat rgb(254, 254, 254); color: rgb(20, 20, 20); font-family: &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, sans-serif;" /&gt;
  &lt;BR /&gt;
  &lt;BR /&gt;
  &lt;U&gt;ocx libraries (32-bit? 64-bit?)&lt;/U&gt;
  &lt;BR /&gt;c:\program files (x86)\sap\frontend\sapgui\wdtaocx.ocx (SAP Table Factory)
  &lt;BR /&gt;c:\program files (x86)\sap\frontend\sapgui\wdobapi.ocx (SAP BAPI Control)
  &lt;BR /&gt;C:\Program Files (x86)\Common Files\SAP Shared\wdtlog.ocx (SAP Logon Control)
  &lt;BR /&gt;c:\program files (x86)\sap\frontend\sapgui\wdtfuncs.ocx (SAP Remote Function Call Control)</description>
      <pubDate>Sun, 14 Aug 2022 09:28:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaq-p/12576519</guid>
      <dc:creator>former_member817179</dc:creator>
      <dc:date>2022-08-14T09:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Excel (64-Bit) VBA code to connect to SAP to execute a remote function call (RFC)</title>
      <link>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/12576520#M4716052</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;I also already replied to your other question about the "class not registered" error. So yes, I would definitely recommend using the .NET Connector for your project: &lt;A href="https://support.sap.com/nco" target="test_blank"&gt;https://support.sap.com/nco&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It has several advantages:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;current .NET technology (while the OCX controls are already +20 years old)&lt;/LI&gt;&lt;LI&gt;no need to mess with COM registration and a dozen .ocx files and dependent .dlls&lt;/LI&gt;&lt;LI&gt;no extra work involved when dealing with Unicode (NCo handles codepage conversions automatically)&lt;/LI&gt;&lt;LI&gt;there is definitely a 64bit version available on the download site&lt;/LI&gt;&lt;LI&gt;easier to get started with, because there is lots of documentation and samples&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Best Regards, Ulrich&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 10:55:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/12576520#M4716052</guid>
      <dc:creator>Ulrich_Schmidt1</dc:creator>
      <dc:date>2022-10-18T10:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Excel (64-Bit) VBA code to connect to SAP to execute a remote function call (RFC)</title>
      <link>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/12576521#M4716053</link>
      <description>&lt;P&gt;We have quite a few workbook templates that use VBA to interface with SAP RFCs, and really didn't want to have to rewrite all of the code. We;re now transitioning from Excel 32 bit to 64 bit, and have also struggled with this issue and finally achieved success.&lt;/P&gt;&lt;P&gt;Answering the question in the original post, the ocx files found in folder &lt;EM&gt;C:\program files (x86)\sap\frontend\sapgui &lt;/EM&gt;are 32 bit.  To get the 64 bit ocx files you need to install SAP GUI 7.70 or higher and be sure to click the installation check box for the optional "64Bit RFC Controls".  When complete you should see a set of identically named ocx files in folder &lt;EM&gt;C:\program files\sap\frontend\sapgui&lt;/EM&gt;&lt;EM&gt;.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2235723-image.png" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;You may also want to explicitly add these in the VBA &lt;EM&gt;"Tools &amp;gt; References"&lt;/EM&gt;  list.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2235724-image.png" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Next, we come to the issue of executing the SAP logon from within VBA and whether or not you make use of SNC Single Sign On.  If not, then you just need to be sure to provide all required logon parameters (Client, Language, User, Password, System, Host Name).  In our case, we do use Single Sign On, so we withhold (Password), and in some cases also (System &amp;amp; Host Name) which then allows the user to select a system from a pop-up.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2235725-image.png" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;However, if you do want Single Sign On, then you need one additional DLL file.&lt;BR /&gt;You can find the appropriate DLL for your system in SAP Note 2115486.&lt;BR /&gt;In your Environment Variables you may have 1,2, or all 3 of the following (SNC_LIB, SNC_LIB_32, SNC_LIB_64).&lt;BR /&gt;If you don't have SNC_LIB_64 then add it and point it to your new 64 bit DLL.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2235727-image.png" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Finally, here is some test code:&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Sub Non_Unicode_Logon()
'-Variables-------------------------------------------------------
  Dim SAPFunc, Connection, SAPConnection, PingFunc, retPing
  Dim exceptPing
'-Get SAP.Functions-----------------------------------------------
  Set SAPFunc = CreateObject("SAP.Functions")
  If Not IsObject(SAPFunc) Then
     MsgBox "CreateObject(SAP.Functions) 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 = "301"
  Connection.Language = "EN"
  Connection.User = "Your_Name"
 'Comment Out for SNC Single Sign On
    Connection.Password = "Your_SAP_Password"
    Connection.System = "PRD"
    Connection.HostName = "xyzprd"
    Connection.SystemNumber = 0
'-Connect to SAP system----------------------------------------------
  SAPConnection = Connection.Logon(0, vbFalse)
  If SAPConnection = Flase Then
     MsgBox "Connection.Logon failed", vbOKOnly, "Error"
     Exit Sub
  Else
'----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
  End If
'-Logoff--------------------------------------------------------
  SAPConnection = Connection.Logoff()
End Sub&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jan 2024 19:54:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/12576521#M4716053</guid>
      <dc:creator>mike_rupp</dc:creator>
      <dc:date>2024-01-14T19:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Excel (64-Bit) VBA code to connect to SAP to execute a remote function call (RFC)</title>
      <link>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/13583842#M4814753</link>
      <description>Mike, please excuse the delay in responding to what is a very thorough response (much appreciated). I looked high and low for programming documentation for VBA RFC calls. For example, say I want to write to a particular field under a particular T-code (table?) - where would I go to find out how to do that?</description>
      <pubDate>Sun, 28 Jan 2024 17:26:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/excel-64-bit-vba-code-to-connect-to-sap-to-execute-a-remote-function-call/qaa-p/13583842#M4814753</guid>
      <dc:creator>John_H</dc:creator>
      <dc:date>2024-01-28T17:26:47Z</dc:date>
    </item>
  </channel>
</rss>

