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-dev] RFC Call VBA Excel AFVV Table Problems

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

Reply from sapwes on Aug 3 at 11:31 AM
Folks have alluded to this in previous posts. But, I'll be more specific. In SAP in Tcode SE37 pull up the code to function module RFC_READ_TABLE and set an external break point in the ABAP code at the first executable line (the authority check).
In my experience if I have set values with the wrong type or not supplied the correct count of inputs the break point won't activate becuase the BAPI parser dumps it prior to the actual call.
If on the other hand its an auth error or a bad SQL error I can follow the code via debug to see where the expected values go funky.

Wes

---------------Original Message---------------
From: pietro_cantoni
Sent: Friday, August 03, 2012 9:13 AM
Subject: RFC Call VBA Excel AFVV Table Problems

Hi to Everyone.
I'm trying to download to Excel some data from AFVV table usign RFC via VBA.
Hereafter my code.
Can you help me to catch the possible issues within my code?
Thanks in advance
Dim LogonControl
Dim conn
Dim funcControl
Dim TableFactoryCtrl
Dim RFC_READ_TABLE
Dim eQUERY_TAB
Dim TOPTIONS
Dim TDATA
Dim TFIELDS

Private Sub command1_CLICK()


Set LogonControl = CreateObject("SAP.LogonControl.1")
Set funcControl = CreateObject("SAP.Functions")
Set conn = LogonControl.NewConnection


conn.System = "010"
conn.Client = "02 - PAP - [R/3 PRODUCTION SYSTEM] - HP"
conn.Language = "IT"
conn.User = "user"
conn.Password = "pwd"
retcd = conn.LOGON(0, False)
If retcd <> True Then
MsgBox " Cannot log on! "
MsgBox retcd
Stop
Else
End If
funcControl.Connection = conn


command3_click

End Sub


Private Sub command3_click()
Const attachpath = "C:\Query.CSV"

Set objFileSystemObject = CreateObject("Scripting.FileSystemObject" ;)
Set filOutput = objFileSystemObject.CreateTextFile(attachpath, True)

Set RFC_READ_TABLE = funcControl.Add("RFC_READ_TABLE")
Set strExport1 = RFC_READ_TABLE.Exports("QUERY_TABLE")
Set strExport2 = RFC_READ_TABLE.Exports("DELIMITER")
Set tbloptions = RFC_READ_TABLE.Tables("OPTIONS")
Set tblData = RFC_READ_TABLE.Tables("DATA")
Set tblFields = RFC_READ_TABLE.Tables("FIELDS")


strExport1.Value = "AFVV"
strExport2.Value = ","

tbloptions.Rows.Add
tbloptions.Value(1, "TEXT") = "AUFPL EQ '0000168029'"

tblFields.AppendRow
tblFields(1, "FIELDNAME") = "AUFPL"

If RFC_READ_TABLE.Call = True Then
If tblData.RowCount > 0 Then
For intRow = 1 To tblData.RowCount
filOutput.WriteLine tblData(intRow, "WA")
Next
Else
MsgBox "No records returned"
End If
Else
MsgBox "ERROR CALLING SAP REMOTE FUNCTION CALL"
End If
End Sub

 
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
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