I would like to use PyRFC to do remote procedure call on SAP using the Python programming language.
conn = pyrfc.Connection(user='foouser', passwd='xxxx',
mshost='sap.example.com', sysid='TE1', client='220',
group='EXAMPLE',
)
But it fails like this:
RFC_COMMUNICATION_FAILURE (rc=1): key=RFC_COMMUNICATION_FAILURE, message=
ERROR service 'sapmsTE1' unknown
TIME Tue Dec 18 15:49:40 2018
RELEASE 753
COMPONENT NI (network interface)
VERSION 40
RC -3
MODULE /bas/753_REL/src/base/ni/niuxi.c
LINE 1833
DETAIL NiPGetServByName: 'sapmsTE1' not found
SYSTEM CALL getaddrinfo
COUNTER 1
[MSG: class=, type=, number=, v1-4:=;;;]
What's wrong?
I guess sapmsTE1
gets looked up in /etc/services
. But this file is the default (unmodified) file of my linux server.
I found the answer myself. You need to supply the parameter "msserv". AFAIK this is a constant value. This worked:
conn = pyrfc.Connection(user='foouser', passwd='xxxx',
mshost='sap.example.com', sysid='TE1', client='220',
msserv='3600',
group='EXAMPLE',
)