Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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)

        Try
            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)
                DataGrid1.DataBind()
            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)

        ds.ReadXml(reader)
        Return ds
    End Function

End Class

5 Comments