Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm not able to use Load balancer port numbers in the PyRFC config. #202

Closed
Gopinath-gs opened this issue Oct 15, 2020 · 6 comments
Closed

Comments

@Gopinath-gs
Copy link

I tried to connect SAP server using below config. The connection fails with error "partner not reached"
As port is not open for 3300, Connection fails. Thats ok.

I understand that PyRFC tries to connect with sysnr suffix based port number. The question and the issue is Why config -E is not used?

/usr/local/sap/nwrfcsdk/bin/startrfc -h servername.com -s 00 -u data_usr -p pwd -c 100 -i -E 3601

Error:
ERROR partner 'servername.com:3300' not reached
TIME Fri Oct 16 11:55:43 2020
RELEASE 753
COMPONENT NI (network interface)
VERSION 40
RC -10
MODULE /bas/753_REL/src/base/ni/nibuf.cpp
LINE 4568
DETAIL NiBufIConnect: connection pending after 60000ms
SYSTEM CALL connect
ERRNO 115
ERRNO TEXT Operation now in progress
COUNTER 2

@Ulrich-Schmidt
Copy link

Ulrich-Schmidt commented Oct 16, 2020

I think you misunderstood the meaning of the parameter -E: it is used for setting the input parameters of the function module EDI_DATA_INCOMING/EDI_STATUS_INCOMING. These function modules have two parameters PATH and PORT, but this PORT is an ALE/EDI port and not a network port
In any case, PORT is only an input parameter of the function module that is called after the connection is opened -- it is not used for opening the connection.

Try one of the following:

  • open /etc/services in a text editor and change the entry for "sapgw00" from 3300 to 3601
  • modify the source code of startrfc so that instead of a parameter -s it accepts one for the network port, which then would have to be passed as connection parameter "gwserv" in the connParams[] array (line 166)

However: are you really sure that 3601 is the correct RFC port for your SAP system?? Usually the 36XX ports are not gateway ports (used for RFC protocol), but dispatcher ports (used for DIAG protocol, e.g. for SAPGui connections).
If 3601 is the dispatcher port, then I would expect the gateway port to be 3301, so all you would need to do is supply "-s 01" in your connect parameters.

Best Regards, Ulrich

@Ulrich-Schmidt
Copy link

Ulrich-Schmidt commented Oct 17, 2020

Ah, wait a moment, 36XX is the message server port, not the dispatcher... My bad... So it looks like you are trying group logon?
Then instead of the parameters -h and -s (which get mapped to RFC parameters "ashost" and "sysnr"), you need to modify startrfc.cpp to accept parameters that get mapped to the RFC parameters "mshost", "sysid" and "group". In /etc/services you will need an entry that maps service name "sapmsABC" to 3601 (if "ABC" is the sysid of your SAP system).

Alternatively, if you can't modify /etc/services, you can replace the parameter "sysid" with "msserv" and pass 3601 directly.

A third alternative: I just looked at the code of startrfc and noticed, that it supports the parameter -D, which allows referencing an entry in the sapnwrfc.ini file. So the following would work without any code modifications:

  1. Create a file sapnwrfc.ini in the current working directory where you start startrfc and fill it as follows:
    DEST=ABC
    MSHOST=servername.com
    MSSERV=3601
    GROUP=PUBLIC
    CLIENT=100

  2. Now you can start startrfc with the following parameters:
    startrfc -u data_usr -p pwd -D ABC -l EN [+ further parameters for setting the inputs of FM EDI_xx_INCOMING, depending on the EDI customizing of your SAP system]

However, all this has nothing to do with PyRFC. I am not familiar, but I am pretty sure PyRFC also has parameters that allow group logon. (Check the docs of PyRFC for how these look like.)

Best Regards, Ulrich

@Gopinath-gs
Copy link
Author

I'm sorry for the late response. I'm looking into the replies now. I comeback to you soon.

@Gopinath-gs
Copy link
Author

Gopinath-gs commented Oct 22, 2020

Hi Ulrich
Thank you for your reply.

I tried your 3rd option. I got below error message. I tried to check the connection with startrfc -u username -p pwd -D configfile -i
Error: Parameter ASHOST, GWHOST, MSHOST or PORT is missing.

I'm going to try other options.

@Ulrich-Schmidt
Copy link

Hi Gopinath,

this is wrong:
startrfc -u username -p pwd -D configfile -i
The parameter -D does not specify the name of the file, but the destination inside the file. The file is found by the NW RFC Lib automatically, if it is in the current working directory. Do it exactly as I described: file has to be named sapnwrfc.ini, first line in the file needs to be
DEST=ABC
and the parameter -D ABC needs to be passed to startrfc.

@Gopinath-gs
Copy link
Author

I think PyRFC accepted the parameters. I'm able to test the connection.
Appreciate for your help- Ulrich

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants