community.sap_libs icon indicating copy to clipboard operation
community.sap_libs copied to clipboard

How to replace pyrfc requirement ??

Open joanba68 opened this issue 1 year ago • 12 comments

Summary

Just got information ( https://github.com/SAP/PyRFC/issues/372 ) that pyrfc requirement won't have new releases as current people is focusing on another priorities. We have some developments based on this collection and we need to understand what will be the roadmap. Any replacement of pyrfc ? Is there any other alternative from ansible to run SAP related tasks ?

Issue Type

Feature Idea

Component Name

pyrfc

Additional Information


Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

joanba68 avatar Aug 26 '24 14:08 joanba68

The SAP LinuxLab Open-Source Initiative governance board will discuss this at our next meeting.


Speaking personally...

There are no roadmaps created within this initiative for dependencies from SAP, and no planned contingencies for dependencies that have suddenly been discontinued by SAP (in this case, @bsrdjan was the sole developer). There are no other alternatives to PyRFC, it was the only Python binding for NWRFC SDK C.

This sudden discontinuation has also impacted the bindings for Node.js node-rfc and Go gorfc. Other legacy bindings for Ruby and Perl etc are long dead.

This sudden discontinuation will also impact other upper-level projects such as sapcli.

The PyRFC project would be near impossible for any non-SAP employee to takeover, as the changes to each Patch of the NWRFC SDK C code are documented at a high-level only (e.g. SAP Note 3481057 - SAP NetWeaver RFC SDK 7.50 -- Patch Level 14) and the documentation itself was always non-standard by not being on help.sap.com, see SAP Support Portal - Products - Connectors - SAP NetWeaver Remote Function Call (RFC) Software Development Kit (SDK).

A developer who is familiar with ABAP, C and Python would be required.

The last version of PyRFC is version 3.3.1 released in Jan-2024, compatible with NWRFC SDK Patch 12 released in Aug-2023.

Alternatives with limited functionality would be:

  • use HTTP Connection, called from builtin Ansible Module uri
  • use startrfc binary from the NWRFC SDK, called from builtin Ansible Module shell. See below

Hard decisions lie ahead. @rainerleber FYI

startrfc binary example

sap_system_hostname=""
sap_system_id=""
sap_system_instance_number=""
sap_system_client_number=""
sap_user=""
sap_password=""

# Transaction SU01
# ABAP Program SAPLSUID_MAINTENANCE, using SAP Fields as BNAME and USERALIAS
# Function Module for ABAP Program SUID_IDENTITY_MAINT, using path with Parameter Name as I_USERNAME

# Login using RFC (-3 arg)
# NOTE -i for RFC Connection input file is deprecated
startrfc \
-3 \
-h $sap_system_hostname \
-d $sap_system_id \
-s $sap_system_instance_number \
-u $sap_user \
-p $sap_password \
-c $sap_system_client_number \
-l EN \
-t \
\
-F SUID_IDENTITY_MAINT \
-E I_USERNAME=testuser1

Edit: Reference links

Patch 12 has been removed from SAP Software Download Center. See:

Maintenance Software Component - SAP NW RFC SDK

https://me.sap.com/softwarecenter/template/products/_APP=00200682500000001943&_EVENT=DISPHIER&HEADER=Y&FUNCTIONBAR=N&EVENT=TREE&NE=NAVIGATE&ENR=01200314690100002214&V=MAINT&TA=ACTUAL&PAGE=SEARCH&sap-language=en-GB

Maintenance Software Component (Archive View) - SAP NW RFC SDK

https://me.sap.com/softwarecenter/template/products/_APP=00200682500000001943&_EVENT=DISPHIER&HEADER=Y&FUNCTIONBAR=N&EVENT=TREE&NE=NAVIGATE&ENR=01200314690100002214&V=MAINT&TA=ARCHIVE&PAGE=SEARCH&sap-language=en-GB

sean-freeman avatar Sep 30 '24 10:09 sean-freeman

As the former pyrfc talented maintainer @bsrdjan mentioned (https://github.com/SAP/PyRFC/issues/372#issuecomment-2483383627), yanked PyPI releases can still be installed by specifying the exact release version. For example, pip install pyrfc fails, but you could pip install pyrfc==3.3.1. I don't see a way for you to still support a range of versions of pyrfc though when they're all yanked.

amarvin avatar Dec 02 '24 16:12 amarvin

In my modest opinion, if SAP cannot provide support, best option is to simply code the NW RFC SDK in c, like years ago. In fact in our servers gcc compilers are available. We can always call binaries from shell in ansible.

joanba68 avatar Dec 02 '24 16:12 joanba68

@joanba68 Within our context in the automation community, specifically Ansible, where your thought process leads.... is some Ansible Module that:

  • dynamically compiles pre-written C code to create an approximate of the sample startrfc / rfcexec but with more capabilities
  • inject inputs to this compiled C binary, from the Python level, which itself receives inputs from the Ansible level

I do not see that happening, least of all because we don't have someone who actively codes in C. The above logic isn't the best either, when compared to PyRFC that was a binding from Python > C directly, and supported by SAP.

If you want to create a project under SLL-OSI with C for creating an expansion of startrfc / rfcexec sample (provided within the NWRFC SDK) - it would be welcomed.

If you want to fork PyRFC under SLL-OSI GH Org, that could also be discussed. But not sure why we'd do that as there is a call for maintainers in the SAP GH Org.

sean-freeman avatar Dec 09 '24 15:12 sean-freeman

I think is really easy to simply code the RFC call to STC01 trans. in C, I've done it many times in the past and it's directly supported by SAP. Also easy to simply call a shell in ansible and run the program. Keep it simple...

joanba68 avatar Dec 11 '24 08:12 joanba68

PyRFC is dead, reference to latest comment https://github.com/SAP-archive/PyRFC/issues/372#issuecomment-2541490558 and pasted below for ease.....

Content copied from original GH Issue in SAP-archive GH Org

For others future reference.....

  • SAP CAP Plugin for ABAP RFC @sap/cds-rfc: Docs, Source Code

  • SAP NODE RFC Library @sap-rfc/node-rfc-library accessed via SAP Repository-Based Shipment Channel under Licences tab and item link:

    • NPM Registry private endpoint provided in format https://xxxxxxxxxxxx.npmsrv.cdn.repositories.cloud.sap
      • [NOTE: remove .cdn substring in endpoint listed by SAP, otherwise 401 error with message "Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"]
    • (not to be confused with node-rfc library adjacent project to PyRFC)

In theory, the @sap-rfc/node-rfc-library could then be called directly from PythonMonkey by altering the code sample in @sap/cds-rfc/lib/rfc.js


@SebastianWolf-SAP Please confirm below with the SAP Open Source Program Office. Thank you for your time.

  • SAP CAP Plugin for ABAP RFC @sap/cds-rfc (https://www.npmjs.com/package/@sap/cds-rfc) LICENSE file, provides code under the standard SAP Developer License Agreement.

No further discussion, calls underlying node-rfc-library.

  • SAP NODE RFC Library @sap-rfc/node-rfc-library
    • Open Source Notices URL on Repository-Based Shipment Channel provides PDF with the standard 2-Clause BSD License
    • package.json file, metadata key:value refers to "license": "ISC" (i.e. ISC License); metadata is non-binding and superceded by LICENSE file
    • LICENSE file, provides code under the standard 2-Clause BSD License

This was reviewed in @sap-rfc/node-rfc-library version 1.1.1. As BSD is a permissive licence, this permits commerical usage, modification, and distribution - inclusive of copying the code downloaded from the SAP Repository-Based Shipment Channel](https://ui.repositories.cloud.sap/) into other open-source projects.

sean-freeman avatar Dec 13 '24 14:12 sean-freeman

There are no other alternatives to PyRFC, it was the only Python binding for NWRFC SDK C.

There is alternate of course. There is http wrapper for all remote enabled RFC ABAP calls. And this has been implemented in sap.sap_operations ansible collection for more than a year now. See for instance modules https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_system_info_module.html#ansible-collections-sap-sap-operations-abap-system-info-module https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_transport_create_module.html#ansible-collections-sap-sap-operations-abap-transport-create-module https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_transport_import_module.html#ansible-collections-sap-sap-operations-abap-transport-import-module https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_transport_info_module.html#ansible-collections-sap-sap-operations-abap-transport-info-module https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_transports_info_module.html#ansible-collections-sap-sap-operations-abap-transports-info-module

All of these modules can use http to connect to RFC wrapper service (has to be activated on SAP ABAP side) and do exactly the same what can be done with pyRFC (even with less dependencies, as pyRFC is not required and requests python lib is required for ansible anyway)

Here is documentation for all the parameters that are needed to connect to HTTP RFC wrapper: https://docs.galaxy.saponrhel.org/collections/sap/sap_operations/abap_system_info_module.html#parameter-http_connection

In a nutshell - pyRFC is nice, but http wrapper is actually better, as it requires less dependencies, more secure (due to well known https) and does not depend library that is not supported any more. There are ansible modules in sap.sap_operations collection that do not rely on pyRFC.

PS If anyone wants to create ansible module to call ANY remote enabled RFC, you are welcome to sap.sap_operations collection https://galaxy.ansible.com/ui/repo/published/sap/sap_operations/

It is really easy to do, see for instance code here: https://github.com/redhat-sap/rh_operations/blob/ddd75e983bd2dc512731e130b50ecb35af5d8a57/plugins/modules/abap_transport_create.py#L124 https://github.com/redhat-sap/rh_operations/blob/ddd75e983bd2dc512731e130b50ecb35af5d8a57/plugins/modules/abap_system_info.py#L474

kksat avatar Aug 02 '25 20:08 kksat

@kksat Is the "HTTP wrapper" you are referring to the SOAP RFC HTTP handler? It is now disabled in all RISE environments as a mandatory prerequisite. See SAP Note: https://me.sap.com/notes/3250501/E

It seems SAP just killed all the easy integration options. I wonder if they will provide any alternative solutions. I guess the only way forward will be to accept Cloud ALM and the other “SAP-native” solutions. :-(

(or create copy of the SOAP http handler on an alternative URL. But I'm sure they will soon remove the code too :-( )

redge76 avatar Sep 22 '25 13:09 redge76

@redge76 @amarvin @spammik Please see my comment above and pasted in the origin GH Issue for PyRFC. It is possible to continue usage with a supportable/secure method, but requires re-development and testing effort. Breakdown of theory is below....

  • Ansible Collection
    • Ansible Module (Python, /modules)

To my knowledge, this would be a FOAK for any Ansible project to import PythonMonkey. Uncharted territory. But SAP will continue to release the Node.js Module @sap-rfc/node-rfc-library .

sean-freeman avatar Sep 22 '25 15:09 sean-freeman

@redge76 @amarvin @spammik Please see my comment above and pasted in the origin GH Issue for PyRFC. It is possible to continue usage with a supportable/secure method, but requires re-development and testing effort. Breakdown of theory is below....

  • Ansible Collection

    • Ansible Module (Python, /modules)

To my knowledge, this would be a FOAK for any Ansible project to import PythonMonkey. Uncharted territory. But SAP will continue to release the Node.js Module @sap-rfc/node-rfc-library .

Thanks for the detailed breakdown. Unfortunately, at this moment it looks like the only realistic way to bridge Python with RFC would indeed be through PythonMonkey and the Node RFC library or switching to Javascript – but there’s a major blocker:

Even though I have an S-USER and access to RBSC, I don’t see SAP NODE RFC available under licenses in our company account. That probably means our contract doesn’t include entitlement to this package. In practice, that makes the approach unusable for many teams, because every customer/developer would need RBSC entitlement to even download the module.

Compared to the original PyRFC (which was open and downloadable for everyone with the SDK), this new setup introduces a licensing barrier and effectively kills the usability in community/open-source scenarios. Unless SAP changes the distribution model or provides a public way to obtain the library, the solution loses a lot of its practical value.

spammik avatar Sep 22 '25 16:09 spammik

@spammik Suggest you re-read what I requested clarification on. The library behind RBSC, is an open-source license and could be copied/re-distributed.

sean-freeman avatar Sep 22 '25 17:09 sean-freeman

@spammik Suggest you re-read what I requested clarification on. The library behind RBSC, is an open-source license and could be copied/re-distributed.

Got it, I re-read your comment and now I understand what you meant – the BSD license technically allows redistribution once someone has access to the package. I’m wondering – who is supposed to actually redistribute it in practice? You personally?

spammik avatar Sep 22 '25 19:09 spammik