Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Srdjan
Product and Topic Expert
Product and Topic Expert
ABAP RFC connectivity from BTP to ABAP systems is supported by SAP Cloud Connector, for Java runtime only. This blog describes the RFC connectivity configuration for BTP Node.JS runtime, so that Node.JS BTP applications can consume ABAP RFCs, as described in Deployment options section of Powerful web applications with old and new ABAP systems and related blogs.

Our "hello world" example is BTP Node.JS buildpack, with Express server, SAP/node-rfc and SAP NW RFC SDK.

The example source code: SAP-samples/node-rfc-samples//integration/noderfc_btp can be deployed on BTP or tested locally inside SAP/fundamental-tools/docker/btp_cflinuxfs4.Dockerfile docker container.

ABAP RFC connectivity from Node.JS on Kyma works practically out of the box, using SAP/node-rfc and SAP NW RFC SDK inside docker container. Try SAP/fundamental-tools/docker/cflinuxfs4.Dockerfile for example.

SAP NW RFC SDK on BTP


ABAP RFC connectivity from Node.JS is provided by SAP/node-rfc open source, which provides interface to SAP proprietary SAP NW RFC SDK


SAP NW RFC SDK


SAP NW RFC SDK is not included in SAP/node-rfc because of licensing and SAP Support Portal is the only allowed public distribution channel for SAP NW RFC SDK.

Shared SO libraries are required in runtime and must be registered at operating system level, using LD_LIBRARY_PATH env variable on Linux systems for example. Include files and shared libraries are both required for SAP/node-rfc build and re-build. The node-rfc rebuild can be triggered during BTP deployment, just like for other native Node.JS modules.

Express and SAP/node-rfc are standard NPM packages and BTP deployment is straightforward.

Preparation


We use this btp_cflinuxfs4 docker container and standard buildpack structure, with application in app folder. To make SAP NW RFC SDK available for SAP/node-rfc in cloud application, it shall be copied to app root folder for example:


Buildpack


During deployment, native NPM modules like node-rfc may be or must be rebuilt. The re-build process requires SAP NW RFC SDK includes and binaries and SAPNWRFC_HOME_CLOUD environment vaiable shell therefore point to SAP NW RFC SDK root folder, just like SAPNWRFC_HOME in on-premise case.

For run-time enablement, the LD_LIBRARY_PATH env variable shall point to RFC SDK "lib" folder, like in manifest.yaml:
---
applications:
- name: rfcapp
stack: cflinuxfs4
env:
SAPNWRFC_HOME_CLOUD: /tmp/app/nwrfcsdk
LD_LIBRARY_PATH: /home/vcap/app/nwrfcsdk/lib

That's all, we are ready for testing.

Local test


$ cd buildpack/app
$ export SAPNWRFC_HOME=`pwd`/nwrfcsdk
$ export LD_LIBRARY_PATH=$SAPNWRFC_HOME/lib
$ npm install
$ node .

node .
HOME
/home/www-admin

SAPNWRFC_HOME
/home/www-admin/src/sap/node-rfc-samples/integration/noderfc_with_nwrfcsdk/buildpack/app/nwrfcsdk

SAPNWRFC_HOME files:
["include","lib","package.json"]

LD_LIBRARY_PATH


node-rfc
{
"platform": {
"name": "linux",
"arch": "x64",
"release": "6.4.16-linuxkit"
},
"env": {
"SAPNWRFC_HOME": "/home/www-admin/src/sap/node-rfc-samples/integration/noderfc_with_nwrfcsdk/buildpack/app/nwrfcsdk",
"RFC_INI": ""
},
"versions": {
"node": "18.18.2",
"acorn": "8.10.0",
"ada": "2.6.0",
"ares": "1.19.1",
"brotli": "1.0.9",
"cldr": "43.1",
"icu": "73.2",
"llhttp": "6.0.11",
"modules": "108",
"napi": "9",
"nghttp2": "1.57.0",
"nghttp3": "0.7.0",
"ngtcp2": "0.8.1",
"openssl": "3.0.10+quic",
"simdutf": "3.2.14",
"tz": "2023c",
"undici": "5.26.3",
"unicode": "15.0",
"uv": "1.44.2",
"uvwasi": "0.0.18",
"v8": "10.2.154.26-node.26",
"zlib": "1.2.13.1-motley"
},
"noderfc": {
"version": "3.3.0",
"nwrfcsdk": {
"major": 7500,
"minor": 0,
"patchLevel": 12
}
}
}

BTP Deployment


When all works fine, let deploy
$ cd buildpack
$ cf push
Pushing app rfcapp to ...
Uploading files...
Instances starting....
Instances starting...

name: rfcapp
requested state: started
routes: rfcapp.cfapps.eu10.hana.ondemand.com
last uploaded: Thu 26 Oct 15:46:54 CEST 2023
stack: cflinuxfs4
buildpacks:
name version detect output buildpack name
https://github.com/cloudfoundry/nodejs-buildpack#v1.8.18 1.8.18 nodejs nodejs

type: web
sidecars:
instances: 1/1
memory usage: 128M
start command: npm run start:btp
state since cpu memory disk logging details
#0 running 2023-10-26T13:47:09Z 0.0% 54.9M of 128M 231.8M of 1G 0/s of unlimited

The app test route https://rfcapp.cfapps.eu10.hana.ondemand.com/ shows the same result as on premise test:
HOME /home/vcap/app SAPNWRFC_HOME /home/vcap/app/node_modules/nwrfcsdk
SAPNWRFC_HOME files: ["include","lib","package.json"]
LD_LIBRARY_PATH /home/vcap/app/node_modules/nwrfcsdk/lib
node-rfc { "platform": { "name": "linux", "arch": "x64", "release": "6.2.0-33-generic" }, "env": { "SAPNWRFC_HOME": "/home/vcap/app/node_modules/nwrfcsdk", "RFC_INI": "" }, "versions": { "node": "18.18.2", "acorn": "8.10.0", "ada": "2.6.0", "ares": "1.19.1", "brotli": "1.0.9", "cldr": "43.1", "icu": "73.2", "llhttp": "6.0.11", "modules": "108", "napi": "9", "nghttp2": "1.57.0", "nghttp3": "0.7.0", "ngtcp2": "0.8.1", "openssl": "3.0.10+quic", "simdutf": "3.2.14", "tz": "2023c", "undici": "5.26.3", "unicode": "15.0", "uv": "1.44.2", "uvwasi": "0.0.18", "v8": "10.2.154.26-node.26", "zlib": "1.2.13.1-motley" }, "noderfc": { "version": "3.3.0", "nwrfcsdk": { "major": 7500, "minor": 0, "patchLevel": 12 } } }

Connectivity


With RFC connectivity enabled in Node.JS on BTP, WS-RFC connection parameters and SAP Business Connector or Cloud Connector can be used for RFC connections to ABAP systems.

 
7 Comments
shais
Participant
0 Kudos
Thanks for technical details.

What is the use case for this connectivity?

When should we call ABAP code from Node.JS via RFC?
Srdjan
Product and Topic Expert
Product and Topic Expert
Apart from rapid delivery of cloud apps for prototyping, as described here, it can be used for data migrations between older and newer SAP systems or other scenarios in which performance is important
Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
Basically, one can say: the main use cases are

  • the Node.JS application can re-use (complex) business functionality implemented in ABAP, which then does not need to be re-implemented in Node.JS

  • the Node.JS application needs to read or write data from/to the central on-premises ABAP system

rbhuva
Participant
0 Kudos
Hello,

Interesting blog.

Would it be possible to call an on-premise SAP ABAP system via SAP cloud connector?

Thanks,

Rajdeep Bhuva
Srdjan
Product and Topic Expert
Product and Topic Expert
Hello rajdeepbhuva ,

currently only for prototyping and some more info are here

https://influence.sap.com/sap/ino/#/idea/262169

If you are interested in automatic updates, you can vote, comment, or simply press the "Follow" button

Regards,

Srdjan
DanielKawkab
Explorer
0 Kudos

Hello Srdjan,
we are trying to migrate a Java application we used on BTP Neo to BTP Cloud Foundry. For this we wanted to migrate the application from Java to Node.js and use node-rfc to do so.

What I did until now is to clone your repository, add the SDK and the sapnwrfc.ini and deploy it to SAP BTP Cloud Foundry. 

Unfortunately it doesn't work out too well for me:
Bildschirm­foto 2024-02-13 um 15.33.09.png

It seems as the ASHOST can't be resolved, which makes sense to me since we don't specify any BTP connectivity tunnel configuration anywhere in the application. Should the application resolve this automatically somehow?

Thank you in advance!

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert

Hello Daniel, 

there is no Cloud Connector support for node-rfc offered. This cannot work. 

Best regards,
Markus