Extract Data from SAP using VBScript

VBScript Debugging


I am trying to extract data out of SAP using VBScript. I remember this worked earlier, but ever since we upgraded to VB7, I am getting an error. Can you please look into this?



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

Dim nTotalRecords As Long

' Define the objects to hold IMPORT parameters



Dim NO_DATA As Object

Dim ROWSKIPS As Object

Dim ROWCOUNT As Object


' Define the objects to hold the EXPORT parameters



' Define the objects to hold the TABLES parameters

' Where clause

Dim OPTIONS As Object

' Fill with fields to return. After function call will hold

' detailed information about the columns of data (start position

' of each field, length, etc.

Dim FIELDS As Object

' Holds the data returned by the function

Dim tDATA As Object


' Use to write out results

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_MARA()   '********************************************** 'Create Server object and Setup the connection '********************************************** Set objFileSystemObject = CreateObject("Scripting.FileSystemObject"  attachpath1 = "C:ExtractsMARA.rtf"   Set R3 = CreateObject("SAP.Functions")   R3.Connection.system = "xxx" R3.Connection.SystemNumber = "xxx" R3.Connection.client = "xxx" R3.Connection.User = "xxx" R3.Connection.Password = "XXX" R3.Connection.language = "EN" R3.Connection.applicationserver = "XXX"   If R3.Connection.logon(0, True) <> True Then MsgBox "No connection to R3!" var_return = " has Failed" sendmessage (var_return)   Exit Function End If   '***************************************************** 'Call RFC function RFC_READ_TABLE '*****************************************************     Set MyFunc = R3.Add("RFC_READ_TABLE")     ERROR RECEIVED IS: Run-time error '-2147352568' Bad variant type Thank you

Software/Hardware used:
sap, vbscript

Answer Wiki

Thanks. We'll let you know when a new response is added.

All defined variables should not have the “As Object” (for VBScript you do not need to either declare them or identify the data type).

You can leave the ‘Dim [variable]’, but you must delete the data type.

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: