Skip to Content

Remote Function Call to SAP System using Microsoft Excel

Remote Function Call to SAP System using Microsoft Excel

Remote Function Call to SAP System is quite important and useful feature when we require SAP data for a non SAP application. We have quite a few techniques to make RFC to SAP using connectors like JCo. This weblog explains how to make Remote Function Calls to SAP system with a much familiar Microsft Excel.

Add the necessary SAP ActiveX Components to Excel

The first important thing is to add the required SAP ActiveX Components to Microsoft Excel. These SAP ActiveX Components will be available if the SAP Front End is installed in your machine. You can find all the availabe SAP controls in the Controls ToolBox of Excel.


Here we are using the SAP BAPI ActiveX Component and SAP Table Factory ActiveX Component to access SAP and fetch some data to display in Excel. There are many other SAP ActiveX Components which will provide you a very rich functionality.

SAP BAPI ActiveX Component


SAP Table Factory ActiveX Component


The Design

For this test application a simple form as shown below is required. This application will fetch all the company codes from the SAP System.


The Source Code

Here the source code is broken as per their operation.


Connecting and Disconnecting to SAP System


Get Company codes form SAP Sytem using BAPI

Clear the List

The Result

Well the application did work nicely fetching all the required details from the R/3 System. I was able to get the record count, records and displayed it on the Excel sheet as shown below.



A nice way to make simple reporting with SAP RFC and Microsoft Excel.

You must be Logged on to comment or reply to a post.
  • Hi, i was looking to your Blog, because i have a problem to connect.

    I want to connect without getting the Log on screen, so i used the following code:

    Set objBAPICortrol = CreateObject("SAP.Functions")
    Set objConnection = objBAPICortrol.Connection

    With objConnection
      .ApplicationServer = ""
      .System = ""
      .SystemNumber = ""
      .User = ""
      .Password = ""
      .client = ""
      .Language = "D"

      .tracelevel = 6
      .usesaplogonini = False !!! Is this setting if Log on screen yes or no?
    End With

    If objConnection.logon(0, False)
    !!!The 2nd parameter set if log on screen yes or no???

    If i allow the log on screen and press ok, i can connect, if not i cant connect.

    Can you explain me how the parameter are used and how i can avoid using the log on screen?

    Thx a million
    Regards Michael

  • Dear Kathirvel,
    I was checking your weblog and found to be easy to understand.I am trying to insert a SAP BAPI ActiveX Component in my excel but it says cannot Insert object.
    I can see the SAP BAPI activex component in the controls.
    Will be helpful if you can guide me in acheiving this.

    K S