cancel
Showing results for 
Search instead for 
Did you mean: 

vb RFC output

Former Member
0 Kudos

Hi,

I have successfully exececute sap rfc from vb and reterive data. But i could not display the download data in table ???

any help

Private Sub Command1_Click()

Dim SAPFunction As Object ' functions

Dim FM As Object ' our function module

Dim Struct As Object ' R/3 structure

Dim s$ ' any string

' check status

If Status <> "Logon" Then

MsgBox "Please perform Logon first"

Exit Sub

End If

' create FM object

Set SAPFunction = CreateObject("SAP.Functions")

If SAPFunction Is Nothing Then

MsgBox "Creating Functions object failed"

Exit Sub

End If

Set SAPFunction.Connection = Connection

' create function module objects

Set FM = SAPFunction.Add("RFC_READ_TABLE")

If FM Is Nothing Then

MsgBox "Creating function module object failed"

Exit Sub

End If

' assign input

FM.Exports("QUERY_TABLE") = "ZRT_UPLOAD"

' perform call

If Not FM.Call Then

MsgBox "Function call failed"

Exit Sub

End If

'process output

Set objStruct = FM.tables("DATA")

msg text(fm.tables.("data").rowcount())

' report success

MsgBox "Function module processed successfully"

End Sub

Private Sub SAPLogonControl1_Click()

' make new commection

Set Connection = SAPLogonControl1.NewConnection

' logon to R/3

If Connection.Logon(0, False) Then

MsgBox "Connect successful"

Status = "Logon"

Else

MsgBox "Connect failed"

End If

End Sub

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Yogesh,

how are you doing ?

>> Dim FM As Object ' our function module

>>' perform call

>>If Not FM.Call Then

>>MsgBox "Function call failed"

>>Exit Sub

>>End If

>>'process output

>>Set objStruct = FM.tables("DATA")

>>msg text(fm.tables.("data").rowcount())

if this is in VB.NET, you should get a syntax error when you access the object using 'fm' rather than 'FM'. VBScript would assume vb is a new object and throw a runtime error when you access fm.tables

with respect,

amit