abapsaprfcpyrfc

Correct message server port (msserv)?


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)


Solution

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