Skip to Content
0
Former Member
May 19, 2010 at 02:25 PM

Extract Table using VB

63 Views

Option Compare Database

Option Explicit

Dim attachpath1, headers, attachpath2 As String

Dim sFileName As String

Dim R3, MyFunc, App, objFileSystemObject, filOutput, objmessage As Object

Dim nTotalRecords As Long

Dim QUERY_TABLE As Object

Dim DELIMITER As Object

Dim NO_DATA As Object

Dim ROWSKIPS As Object

Dim ROWCOUNT As Object

Dim OPTIONS As Object

Dim FIELDS As Object

Dim tDATA As Object

Dim ROW As Object

Dim Result As Boolean

Dim iRow, iColumn, iStart, iStartRow, iField, iLength As Integer

Dim var_return As String

Public Function RFC_READ_TABLE_MLEA()

'**********************************************

'Create Server object and Setup the connection

'**********************************************

Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")

attachpath1 = "C:\MLEA.rtf"

Set R3 = CreateObject("SAP.Functions")

R3.Connection.system = "***"

R3.Connection.client = "***"

R3.Connection.User = "my username"

R3.Connection.Password = "my password"

R3.Connection.language = "EN"

R3.Connection.applicationserver = "******"

If R3.Connection.logon(0, True) <> True Then

MsgBox "No connection to R3!"

var_return = " has Failed"

sendmessage (var_return)

Exit Function

End If

**Can anyone please advise why this would not work ?

I recieve the error dialog box "No connection to R3". Anyone know what I am missing ?