Skip to Content

Connect to SAP gateway failed to RFC

When I use the following code to connect tot SAP to make a RFC:

Set R3 = CreateObject("SAP.Functions")
R3.Connection.SYSTEM = "P01" 'System
R3.Connection.Client = "010" ' Client
'R3.Connection.User = "" 'username
'R3.Connection.Password = "" 'Password
R3.Connection.Language = "EN" 'Language
Application.StatusBar = "Logging into SAP..."
R3.Connection.Logon (1) 'Manual login
Application.StatusBar = "Logged in!"

I get this error:

SAP_CMINIT3: rc=20 > Connect to SAP gateway failed


SAP_CMINIT3 : rc=20 > Connect to SAP gateway failed
Connect_PM GWHOST=, GWSERV=sapgw02s, SYSNR=02

LOCATION CPIC (TCP/IP) on local host
ERROR partner '' not reached
TIME Thu Mar 21 09:12:48 2019
RELEASE 720 COMPONENT NI (network interface)
MODULE nixxi.cpp
LINE 3286
DETAIL NiPConnect2:
ERRNO 10060
ERRNO TEXT WSAETIMEDOUT: Connection timed out

I've read every possible SAP community post en stackoverflow post about this issue but none of the solutions helped me.

I've checked the service file and every gateway is mentioned that I should need:
sapgw00~99 3300 ~99/tcp # SAP System Gateway Port

I have also added the secured ones i need

sapgw02s 48029/tcp # SAP System Gateway Port
sapgw22s 4822/tcp # SAP System Gateway Port (because the error message sometimes changes to 22 instead of 02)

When I select a different system, PW1 our BW Production system I'm able to login.

A colleague in different country is able to connect to P01 with this code. But as far as he remembers he didn't need to make any changed to his pc to make it work.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers