We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-scripting-l] Extract Data from SAP using VBScript

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from sapwes on May 22 at 2:45 PM
Horatio is correct. If they don't know what causing the issue immediately, have them do a ST01 auth trace on your user ID when you execute the code and get the error.

---------------Original Message---------------
From: torontog1
Sent: Sunday, May 20, 2012 9:09 PM
Subject: Extract Data from SAP using VBScript

Hi gurus,

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:\Extracts\MARA.rtf"

Set R3 = CreateObject("SAP.Functions")

R3.Connection.system = "PR1"
R3.Connection.SystemNumber = "01"
R3.Connection.client = "320"
R3.Connection.User = "REMOVED"
R3.Connection.Password = "REMOVED/"
R3.Connection.language = "EN"
R3.Connection.applicationserver = "10.237.32.42"

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!

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Toolbox.com and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
 
sapwes  
Jack
achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Toolbox.com for iPhone & Android: Ask Questions & Get Answers Anywhere. Download the Free App

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language