Hi,
I am using excel with VB -
'Example calling BAPI RFC_GET_TABLE_ENTRIES
Option Explicit
Public Functions As SAPFunctionsOCX.SAPFunctions
Private LogonControl As SAPLogonCtrl.SAPLogonControl
Private objConnection As SAPLogonCtrl.Connection
Dim Func As SAPFunctionsOCX.Function
Public eNUMBER_OF_ENTRIES As SAPFunctionsOCX.Parameter
Public tENTRIES As SAPTableFactoryCtrl.Table
Public TableFactory As SAPTableFactory
Private LogCount As Integer
Public shScript, shLog As Worksheet
Sub TableEntriesRFC()
Dim i As Integer
Dim retcd As Boolean
Dim SilentLogon As Boolean
Set shScript = Worksheets("Script")
ResetLog
Set LogonControl = CreateObject("SAP.LogonControl.1")
Set Functions = CreateObject("SAP.Functions")
Set TableFactory = CreateObject("SAP.TableFactory.1")
Set objConnection = LogonControl.NewConnection
SilentLogon = False
'Set the hourglass pointer
'Application.Cursor = xlWait
AddLog "Logon", "Logging into SAP...", vbBlack
' Logging into SAP
If objConnection.Logon(0, SilentLogon) Then
'Logon was successful
AddLog "Logon", "Successfully logged into SAP", vbBlack
'Create an object to call the RFC FM
Functions.Connection = objConnection
AddLog "RFC", "Preparing the interface", vbBlack
'Actual FM is added here
Set Func = Functions.Add("RFC_GET_TABLE_ENTRIES")
'Populate the importing parameters
Func.Exports("TABLE_NAME").Value = Range("TableName").Value
'Declare the exporting parameters and tables
Set eNUMBER_OF_ENTRIES = Func.Imports("NUMBER_OF_ENTRIES")
Set tENTRIES = Func.Tables("ENTRIES")
'Executing the FM
AddLog "RFC", "Executing call", vbBlack
Func.Call
AddLog "RFC", "Number of entries: " + CStr(eNUMBER_OF_ENTRIES), vbBlack
'Extract the results to Excels to D10 and down
For i = 1 To tENTRIES.RowCount
Cells(9 + i, 4).Value = tENTRIES(i, 1)
Next
Else
'Execute this block if logon fails
Dim msg As String
msg = "Failed to login to SAP. Verify credentials or access."
AddLog "Logon", msg, vbRed
Application.Cursor = xlDefault
MsgBox msg
GoTo Cleanup
End If
I am getting -
RFC_ERROR_COMMUNICATION
Message
LOCATION CPIC (TCP/IP) on local host with Unicode
ERROR partner 'xx.xx.xx.xx:3300' not reached
TIME Tue Aug 20 09:45:42 2019
RELEASE 749
COMPONENT NI (network interface)
VERSION 40
RC -10
MODULE D:/depot/bas/749_REL/src/base/ni/nixxi.cpp
LINE 3428
DETAIL NiPConnect2: xx.xx.xx.xx:3300
SYSTEM CALL connect
ERRNO 10060
ERRNO TEXT WSAETIMEDOUT: Connection timed out
COUNTER 18
I had tried
1. To add the entry in the host file
2. add...mask
3. I have the sap router selected - so it should not be a problem - since when it chooses brings the router too -
what could be happening?
thank you
Request clarification before answering.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.