How to determine the correct port for the msserv connection parameter?
According to the docs of RfcOpenConnection :
msserv is only needed, if the service of the message server is not defined as sapms in /etc/services.
In my case I run a standard linux distribution with unmodified /etc/services
file.
This means I need the matching value for msserv
.
On one system I was lucky I tried 3600
and it worked.
But on a second system this failed.
I can connect to the system via SAP-GUI.
How to determine the needed value for msserv
?
This is follow-up of this question: PyRFC: Connect via mshost (not ashost)
You need to ask the SAP system administrator for telling you the message server service port number. It is specified when installing the SAP system or can be changed and configured later by the system administrator.
If you already have access to the system via SAP GUI and you also have the required authorizations, you can also lookup this in the Message Server Monitor (transaction SMMS in the header area or via menu Goto -> Parameters -> Display) - or you can look into the message server trace file dev_ms
via transaction ST11, if you have this authorization.
See https://help.sap.com/viewer/ports for a list of port numbers used by SAP software.
The SAP message server service port number was limited to the range 3600-3699 only with old SAP system releases. Nowadays, the SAP message server service port number can be configured freely to any port number (of course not conflicting with other port numbers used by SAP software).
If you do not specify the msserv
logon parameter, the various SAP Connectors will automatically construct the message server service name via template sapms<SID>
(e.g. sapmsTE1
)and then resolve this symbolic service name to the TCP port number afterwards (usually achieved by looking this up from the local file etc/services
).
By the way, parameter msserv
may contain the port number or the symbolic service name. This is the same as with parameter gwserv
for the SAP gateway service.
@dirk-trilsbeek is correct. You can find all ports that SAP products use here: https://cp.hana.ondemand.com/dps/d/preview/47673f06bd494db680ff6150c0b08108/2.0/en-US/frameset.htm
Depending on how the application server is installed your port will fall in the 32xx, 33xx or 36xx range, where xx is the instance number that you can find in SAPGui. I do not know an easy way to find the actual port used, but with this information you only need to check 3 to make it work for your RFC calls.