<?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>topic VBA Calling RFC in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137909#M113705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This question seems to come up again and again, but I did not find a solution that worked in previous threads.  I am calling an SAP RFC from a VBA macro and receiving the error "Structure member not found" when I pass the RFC its only parameter.  Below is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;VBA Code&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub CreateRecallCancel()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Dim Functions As Object&lt;/P&gt;&lt;P&gt;    Dim RemoteFunction As Object&lt;/P&gt;&lt;P&gt;    Dim FunctionParameter1 As Object&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'create components of the recall/cancel RFC&lt;/P&gt;&lt;P&gt;    Dim sRecallCancel As String&lt;/P&gt;&lt;P&gt;    Dim sMSGIND As String * 3&lt;/P&gt;&lt;P&gt;    Dim sCLAIMNUM As String * 24&lt;/P&gt;&lt;P&gt;    Dim sROC As String * 2&lt;/P&gt;&lt;P&gt;    Dim sCHECKNO As String * 9&lt;/P&gt;&lt;P&gt;    Dim sPOSNR As String * 12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    'log in to SAP and send the user a message if logon was unsuccessful&lt;/P&gt;&lt;P&gt;    Set Functions = CreateObject("SAP.Functions")&lt;/P&gt;&lt;P&gt;    If Functions.Connection.Logon(0, False) &amp;lt;&amp;gt; True Then&lt;/P&gt;&lt;P&gt;        MsgBox ("System could not log you on. Please check user name and password and try again.")&lt;/P&gt;&lt;P&gt;        Exit Sub&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'set remote function equal to the recall function&lt;/P&gt;&lt;P&gt;    Set RemoteFunction = Functions.Add("ZIS_CCS_RECALL")&lt;/P&gt;&lt;P&gt;    Set FunctionParameter1 = RemoteFunction.exports("I_RECALL")&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    sMSGIND = "1"&lt;/P&gt;&lt;P&gt;    sCLAIMNUM = "28X1445144"&lt;/P&gt;&lt;P&gt;    sROC = "16"&lt;/P&gt;&lt;P&gt;    sCHECKNO = ""&lt;/P&gt;&lt;P&gt;    sPOSNR = "400000206500"&lt;/P&gt;&lt;P&gt;    sRecallCancel = sMSGIND + sCLAIMNUM + sROC + sCHECKNO + sPOSNR&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    FunctionParameter1.Value = sMSGIND + sCLAIMNUM + sROC + sCHECKNO + sPOSNR&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'log off SAP&lt;/P&gt;&lt;P&gt;    Functions.Connection.Logoff&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;RFC Definition&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only parameter taken in by ZIS_CCS_RECALL is I_RECALL, whose structure is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field	    (Length)&lt;/P&gt;&lt;P&gt;MSGIND	    (3)&lt;/P&gt;&lt;P&gt;CLAIMNUM    (24)&lt;/P&gt;&lt;P&gt;ROC	    (2)&lt;/P&gt;&lt;P&gt;CHECKNO	    (9)&lt;/P&gt;&lt;P&gt;POSNR	    (12)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The definition of I_RECALL is a LIKE to another structure, so the previous solution of TYPE vs. LIKE does not apply to this error.  Please help.  Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2006 22:53:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-25T22:53:32Z</dc:date>
    <item>
      <title>VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137909#M113705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This question seems to come up again and again, but I did not find a solution that worked in previous threads.  I am calling an SAP RFC from a VBA macro and receiving the error "Structure member not found" when I pass the RFC its only parameter.  Below is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;VBA Code&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub CreateRecallCancel()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Dim Functions As Object&lt;/P&gt;&lt;P&gt;    Dim RemoteFunction As Object&lt;/P&gt;&lt;P&gt;    Dim FunctionParameter1 As Object&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'create components of the recall/cancel RFC&lt;/P&gt;&lt;P&gt;    Dim sRecallCancel As String&lt;/P&gt;&lt;P&gt;    Dim sMSGIND As String * 3&lt;/P&gt;&lt;P&gt;    Dim sCLAIMNUM As String * 24&lt;/P&gt;&lt;P&gt;    Dim sROC As String * 2&lt;/P&gt;&lt;P&gt;    Dim sCHECKNO As String * 9&lt;/P&gt;&lt;P&gt;    Dim sPOSNR As String * 12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    'log in to SAP and send the user a message if logon was unsuccessful&lt;/P&gt;&lt;P&gt;    Set Functions = CreateObject("SAP.Functions")&lt;/P&gt;&lt;P&gt;    If Functions.Connection.Logon(0, False) &amp;lt;&amp;gt; True Then&lt;/P&gt;&lt;P&gt;        MsgBox ("System could not log you on. Please check user name and password and try again.")&lt;/P&gt;&lt;P&gt;        Exit Sub&lt;/P&gt;&lt;P&gt;    End If&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'set remote function equal to the recall function&lt;/P&gt;&lt;P&gt;    Set RemoteFunction = Functions.Add("ZIS_CCS_RECALL")&lt;/P&gt;&lt;P&gt;    Set FunctionParameter1 = RemoteFunction.exports("I_RECALL")&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    sMSGIND = "1"&lt;/P&gt;&lt;P&gt;    sCLAIMNUM = "28X1445144"&lt;/P&gt;&lt;P&gt;    sROC = "16"&lt;/P&gt;&lt;P&gt;    sCHECKNO = ""&lt;/P&gt;&lt;P&gt;    sPOSNR = "400000206500"&lt;/P&gt;&lt;P&gt;    sRecallCancel = sMSGIND + sCLAIMNUM + sROC + sCHECKNO + sPOSNR&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    FunctionParameter1.Value = sMSGIND + sCLAIMNUM + sROC + sCHECKNO + sPOSNR&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    'log off SAP&lt;/P&gt;&lt;P&gt;    Functions.Connection.Logoff&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;RFC Definition&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only parameter taken in by ZIS_CCS_RECALL is I_RECALL, whose structure is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field	    (Length)&lt;/P&gt;&lt;P&gt;MSGIND	    (3)&lt;/P&gt;&lt;P&gt;CLAIMNUM    (24)&lt;/P&gt;&lt;P&gt;ROC	    (2)&lt;/P&gt;&lt;P&gt;CHECKNO	    (9)&lt;/P&gt;&lt;P&gt;POSNR	    (12)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The definition of I_RECALL is a LIKE to another structure, so the previous solution of TYPE vs. LIKE does not apply to this error.  Please help.  Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2006 22:53:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137909#M113705</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-25T22:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137910#M113706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please reference this link for how to call BAPI in VB:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/a4/ba89c5462e11d2952500a0c94260a5/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/a4/ba89c5462e11d2952500a0c94260a5/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI is a kind of RFC, so I think the method is similiar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will be helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 01:50:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137910#M113706</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T01:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137911#M113707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have gone through the whole process of navigating through DCOM setup to create component DLLs for my RFCs, but in the DCOM list of available RFCs for my SAP environment, it only shows SAP-standard BAPIs and other RFCs, but the custom RFCs that I have developed do not show up as available choices.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 15:36:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137911#M113707</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T15:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137912#M113708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   Custom Function module should be RFC enabled and&lt;/P&gt;&lt;P&gt;   released so that external system can access your &lt;/P&gt;&lt;P&gt;   custtom Fm.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 15:41:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137912#M113708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T15:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137913#M113709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The FMs are remote-enabled and are currently used by a .NET application, so I know they work.  They are just not showing up as available choices in the DCOM list, even though they are truly available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Jon Gilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 15:58:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137913#M113709</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T15:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137914#M113710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind, I have found them, I will send update upon completion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2006 16:21:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137914#M113710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-26T16:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137915#M113711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With regard to Zhenglin's link to DCOM information:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to create a component DLL for the custom RFCs I want to call, but when I click on "Build Component DLL" in the DCOM Object Builder, I get errors.  The most recent is &amp;lt;b&amp;gt;"CCP2Upload2.mak(6) : fatal error U1052: file 'mkenv.inc' not found  Stop."&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have Visual C++ 6.0 installed.  Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2006 00:10:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137915#M113711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-27T00:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Calling RFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137916#M113712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi man, i trying call Z td code from VBA, any idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Public Sub rfc_call_transaction()
    Dim Functions As Object
    Dim RfcCallTransaction As Object
    Dim Messages As Object
    Dim BdcTable As Object
    
    ' Create the Function control (that is, the high-level Functions collection):
    Set Functions = CreateObject("SAP.Functions")
    
    ' Set the rest of Connection object values:
    Functions.Connection.System = ""
    Functions.Connection.client = "100"
    Functions.Connection.user = ""
    Functions.Connection.password = ""
    Functions.Connection.language = "EN"
    
    If Functions.Connection.Logon(0, False) &amp;lt;&amp;gt; True Then
       Exit Sub
    End If
    
    ' Retrieve the Function object (the Connection object must be set up before Function objects can be created):

    Set RfcCallTransaction = Functions.Add("RFC_CALL_TRANSACTION")
    
    ' Set the export parameters (here, get all customers whose names start with J):
    RfcCallTransaction.exports("TRANCODE") = "ZDHWLOAD"
    RfcCallTransaction.exports("UPDMODE") = "S"

    
    If RfcCallTransaction.Call = True Then
        Set Messages = RfcCallTransaction.imports("MESSG")
        MsgBox Messages.Value("MSGTX")

    Else
        MsgBox " Call Failed! error: " + GetCustomers.Exception
        Functions.Connection.Logoff
    End If

Functions.Connection.Logoff

End Sub&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2006 23:59:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/vba-calling-rfc/m-p/1137916#M113712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-24T23:59:39Z</dc:date>
    </item>
  </channel>
</rss>

