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 torontog1 on May 22 at 1:41 PM
Thanks!
Yes, i am able to login succesfully...otherwise the program would have emailed me at this point:
If R3.Connection.logon(0, True) <> True Then
MsgBox "No connection to R3!"
var_return = " has Failed"
sendmessage (var_return)

Error happens exactly here:
Set MyFunc = R3.Add("RFC_READ_TABLE")

If it helps, this file gets generated on my C drive: dev_rfc.trc

Contents of the file are:

**** ERROR file opened at 20120522 133624 Eastern Daylight Time, SAP-REL 720,0,39 RFC-VER 3 MT-SL
T:5236 Error in program 'MSACCESS': ======> User xxxxx has no RFC authorization for function group RFC1 .
T:5236 Error in program 'MSACCESS': <* RfcReceive [1] : returns 3:RFC_SYS_EXCEPTION
T:5236 Error in program 'MSACCESS': <* RfcCallReceive [1] : returns 3:RFC_SYS_EXCEPTION
T:5236 Error in program 'MSACCESS': <* RfcCallReceive [1] : returns 18:RFC_INVALID_HANDLE
T:5236 Error in program 'MSACCESS': <* RfcCall [1] : returns 18:RFC_INVALID_HANDLE
T:5236 Error in program 'MSACCESS': <* RfcCall [1] : returns 18:RFC_INVALID_HANDLE
T:5236 Error in program 'MSACCESS': <* RfcCallReceive [1] : returns 18:RFC_INVALID_HANDLE
T:5236 Error in program 'MSACCESS': genh:RFC_FIELDS: "Cannot load table RFC_FIELDS from backend.
"
T:5236 Error in program 'MSACCESS': <* RfcGetStructureInfoAsTable [1] : returns 1:RFC_FAILURE

How do i get this RFC Authorization ? Thank you again

---------------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
 
torontog1  
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Become a blogger at Toolbox.com and share your expertise with the community. Start today.

_.____.__

0 comments:

Post a Comment

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