Skip to Content
Author's profile photo Philip Johnston

Using SAP .Net Connector to Call RFC

I have used the SAP .Net Connector on multiple projects in the past.  I will say that I am very impressed with it’s robust ability to handle large volumes of data.  I will insert a small video demo of how to create a very simple RFC call to an RFC function module.  The function I will call is in all SAP implementations and is already configured as an RFC.  The function module is called: FLIGHT_LIST.  The full source code for the web page is also included here. 

Output of running this example:


Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class FLIGHT_LIST1
    Inherits System.Web.UI.Page

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ‘Put user code to initialize the page here
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim conStr As String = “ASHOST=<your server> SYSNR=?? CLIENT=?? USER=???????? PASSWD=????????”

        Dim ERR_MSG As String
        Dim O_MSG As String
        Dim O_WDR_FLIGHTSTable As New WDR_FLIGHTSTable
        Dim RFC_FLIGHT_LIST As New FLIGHT_LIST(conStr)

            RFC_FLIGHT_LIST.Flight_List1(“FRANKFURT”, “NEW YORK”, “18000101”, “20120101”, O_MSG, O_WDR_FLIGHTSTable)
            If Not O_WDR_FLIGHTSTable Is Nothing And O_WDR_FLIGHTSTable.Count > 0 Then
                DataGrid1.DataSource = array_to_ds(O_WDR_FLIGHTSTable)
            End If
        Catch ex As Exception
            ERR_MSG = ex.Message
        End Try
    End Sub

    Public Function array_to_ds(ByVal array_in As Object) As DataSet
        Dim ds As New DataSet
        Dim xmlSerializer As XmlSerializer = New XmlSerializer(array_in.GetType)
        Dim writer As StringWriter = New StringWriter
        xmlSerializer.Serialize(writer, array_in)
        Dim reader As StringReader = New StringReader(writer.ToString)

        Return ds
    End Function

End Class

Assigned Tags

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

      Hi Philip,

      Can we use SAP.Net Connector and RFC technology to access data from SAP Esourcing system (version 9.0)? I have doubts as it is a Java based system.



      Author's profile photo Philip Johnston
      Philip Johnston
      Blog Post Author

      I would start your investigation as follows:  Since you have a Java based system, can you register the Jco RFC Provider Service?  Then create RFC modules in ERP and use a custome RFC Destination to point to your Java System.  So, while there may be other ways to do what you are asking, here is one possible option.  Read the following:

      Author's profile photo Former Member
      Former Member

      Thanks Philip for the reply. I was referring to SAP Sourcing as Java based system. The other system is a .Net application. Can we use the SAP.Net Connector for connecting SAP Sourcing (version 9.0) to a custom ASP.Net application?

      Author's profile photo Former Member
      Former Member


      Can you kindly tell me how we can integrate SharePoint 2013 into SAP ECC6.0 with .net?

      Author's profile photo Ulrich Schmidt
      Ulrich Schmidt

      Hi Fizza,

      instead of using the comments section of this blog, I sugest that you create your own dedicated thread for your question.

      Also the question is a bit "too general"... In your thread you should provide a few more details, e.g: what exactly are you trying to achieve, have you read the .NET Connector documentation yet, what have you tried so far and what errors did you get?

      Regards, Ulrich