Extract Data from SAP using VBScript

5 pts.
Tags:
SAP
VBScript
VBScript Debugging
Hi,

 

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?

 

code:

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

Dim nTotalRecords As Long

' Define the objects to hold IMPORT parameters

Dim QUERY_TABLE As Object

Dim DELIMITER As Object

Dim NO_DATA As Object

Dim ROWSKIPS As Object

Dim ROWCOUNT As Object

 

' Define the objects to hold the EXPORT parameters

' None for RFC_TABLE_READ

 

' 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.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following