- Created by Sebastian Kiesel, last modified on Jan 11, 2023
Symptom
Logon with ECTR fails with error "Connect to SAP gateway failed"
[11:37:26.935] OMF-Q Caused by: RfcException raised by system [XXX|systemname]: [11:37:26.935] OMF-Q message: 'sapgui' start failed. [11:37:26.935] OMF-Q return code: RFC_SYS_EXCEPTION (3) [11:37:26.935] OMF-Q error group: 104 [11:37:26.935] OMF-Q key: RFC_ERROR_SYSTEM_FAILURE [11:37:26.935] OMF-Q message class: 00 [11:37:26.935] OMF-Q message type: X [11:37:26.935] OMF-Q message number: 341 [11:37:26.935] OMF-Q message parameter 0: RFC_ATTACH_GUI_FAILED [11:37:26.935] OMF-Q at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:2041) [11:37:26.935] OMF-Q at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:2032) [11:37:26.935] OMF-Q ... 21 more [11:37:26.935] OMF-Q Caused by: com.sap.conn.rfc.exceptions.RfcGetException: 'sapgui' start failed. [11:37:26.935] OMF-Q at com.sap.conn.rfc.engine.RfcImp.ab_rfcerror(RfcImp.java:1176) [11:37:26.935] OMF-Q at com.sap.conn.rfc.engine.RfcGet.ab_rfcget(RfcGet.java:120) [11:37:26.935] OMF-Q at com.sap.conn.rfc.engine.RfcRcv.ab_rfcreceive(RfcRcv.java:36) [11:37:26.936] OMF-Q at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:1983) [11:37:26.936] OMF-Q ... 22 more
German Log:
[08:34:08.461] Threa Caused by: RfcException raised by system [XXX|systemname|36]: [08:34:08.461] Threa message: Start von 'sapgui' fehlgeschlagen. [08:34:08.461] Threa return code: RFC_SYS_EXCEPTION (3) [08:34:08.461] Threa error group: 104 [08:34:08.461] Threa key: RFC_ERROR_SYSTEM_FAILURE [08:34:08.461] Threa message class: 00 [08:34:08.461] Threa message type: X [08:34:08.461] Threa message number: 341 [08:34:08.461] Threa message parameter 0: RFC_ATTACH_GUI_FAILED [08:34:08.461] Threa at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:2078) [08:34:08.461] Threa at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1973) [08:34:08.461] Threa ... 20 more [08:34:08.461] Threa Caused by: com.sap.conn.rfc.exceptions.RfcGetException: Start von 'sapgui' fehlgeschlagen. [08:34:08.461] Threa at com.sap.conn.rfc.engine.RfcImp.ab_rfcerror(RfcImp.java:1176) [08:34:08.461] Threa at com.sap.conn.rfc.engine.RfcGet.ab_rfcget(RfcGet.java:120) [08:34:08.461] Threa at com.sap.conn.rfc.engine.RfcRcv.ab_rfcreceive(RfcRcv.java:36) [08:34:08.461] Threa at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:2020) [08:34:08.461] Threa ... 21 more
Reason
Analyze the issue
This sequence diagram shows how a SAP GUI is opened from ECTR (with JCo older than 3.0.16):
This sequence diagram shows how a SAP GUI is opened from ECTR (since JCo 3.0.16):
Possible Reason 1
Firewall issue on server side
Possible Reason 2
As of SAP GUI 7.20, 7.30 and 7.40, there is a security check before starting the SAP GUI. If the you click on 'Deny' or if in the SAP GUI security settings the option is set to 'Deny', you will get the same dump
Possible Reason 3
When the sapgui.exe delegates, it always starts SAP Logon, no matter whether SAP Logon Pad is already running or not.
Possible Reason 4 (JCo older than 3.0.16)
RFC connection fails in NAT environment.
Possible Reason 5
An registry setting at the frontend blocks the SAP GUI.
Possible Reason 6
No SAP GUI installed at all on frontend PC.
Possible Reason 7
No SAP GUI resources available any more on frontend PC.
Lot of parallel threads in ECTR can call SAPGui transactions e.g. when opening the structure tab of a document.
[15:06:55.113] FJ-08 Calling: /DSCSAG/DOC_GET_LATEST_STR4.[apilog @ stateless.txt#115] (using SAPGui)... [15:06:55.113] FJ-03 Calling: /DSCSAG/DOC_GET_LATEST_STR4.[apilog @ stateless.txt#114] (using SAPGui)... [15:06:55.113] FJ-05 Calling: /DSCSAG/FOL3_CLASS_READ.[apilog @ stateless.txt#113] (using SAPGui)... [15:06:55.113] FJ-02 Calling: /DSCSAG/DOC_WHEREUSED_ALLVERS2.[apilog @ stateless.txt#112] (using SAPGui)... [15:06:55.113] FJ-04 Calling: /DSCSAG/OBJ_GET_MULTIDETAIL2.[apilog @ stateless.txt#116] (using SAPGui)...
Solution
Generate JCO Log Files
Change these settings in …\customize\config\SAPlogon.txt of ECTR:
# Enable/disable CPIC trace (-1 [use environment setting], 0 no trace, 1,2,3 trace level)
sap.transaction.cpicTrace = -1
# Enable/disable RFC trace (0 or 1)
# This would create trace files jco_rfc*.trc in the ECTR log directory which you could send to support.
sap.transaction.jcoTrace = 1
# Define trace level for JCo (see https://wiki.scn.sap.com/wiki/display/SI/Java+Connectivity)
# Use level 5 to send log files to support if nothing else requested.
# This would create a trace file JCO*.trc in the ECTR log directory which you could send to support.
jco.trace_level = 5
jco.trace_path = .
Generate Backend Log Files
- ABAP-Server: SM50 (Work Process) - Activate the WP-Trace for all DIA Processes (Component M, A, Y, D) and set the Dispatcher-Trace to 2
- SMGW (Gateway Monitor) --> Goto --> Trace --> Gateway --> Increase Level
Switch on SAP GUI Log Files
- In SAP Logon open the dialog "Optionen" -> "Modus Trace" -> "RFC (rfc*.trc)"
Solution 1: Search for firewall issues in Gateway Trace files
Check for Traces in SM21 Dumps in ST22 or Traces in transaction SMGW. This can give you hints how to change the firewall settings.
Solution 2: Fix local SAP GUI issues
- Check the SAP GUI security setting using "Options" - "Settings" - "Security Settings". Ensure all Actions are ALLOWED or Disable the Security Settings
- Apply the latest SAP GUI patch
- Run a workstation Front End check. Start Menu -> Run NwCheckWorkstation.exe. If any errors are reported at the end of the installation check, reinstall the GUI with the Addons.
Solution 3: Fix sapgui.exe delegate issues
Please check this SAP note 844095 and the other occurrences of the registry key "StartSaplogon". Maybe you have to change the value for that key "StartSaplogon".
Note that on 64bit operating systems keys under HKEY_LOCAL_MACHINE have to be created in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP\SAPGUI.
Solution 4: Fix NAT issues (JCo older than 3.0.16)
Check own network address in SMGW:
Read note 211365 - RfcAttach Fehler beim DNS oder muliple hostnames
- abap/hostname_for_sapgui = <full qualified hostname dns>
- gw/alternative_hostnames = <full qualified hostname dns>
If this not helps, read note 1760329:
- Maintain the NAT IP as an alternative IP address for the servers in the transaction SMLG within the corresponding logon group as per the recommendation of note: 364552 Loadbalancing does not find application server
- and additionally maintain the NAT IP within the instance profile of the corresponding instance with the parameter gw/alternative_hostnames. See note: 148832 IP address conversion with a firewall
- To solve problems related to RFC load balancing in a NAT environment please follow the recommendations of the notes:
- 1418278 RFC load distribution does not work via NAT
- 593058 New RFC load balancing procedure
For JCo higher than 3.0.16 this issue should not exist any more - See note 2361127, symptom #4.
Solution 5: Fix local registry issues
Check this registry key on frontend computer: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP\SAPGUI. Set it to StartSaplogon DWord Value 0.
Solution 6: Install the latest SAP GUI
Load latest SAP GUI from https://launchpad.support.sap.com/#/softwarecenter and install it.
Solution 7: Use RFC calls instead of GUI calls
Use "sap.logon.SapGui* = 0" in saplogon.txt. ( 0- NoGUI, 2-GUI) for all systems.
Solution 8: Deactivating the reverse name lookup
See note 1055602 and 987317 and try to workaround the timeout - error by deactivating the reverse name lookup:
rdisp/reverse_name_lookup=0 gw/resolve_phys_addr=0
See also: