Skip to Content

RFC bindings for Node.js

Recently, on a journey through the internet I discovered Node.js which looked to me like a suitable tool for various integration scenarios. In short, Node.js is an asynchronous, event-driven application server based on Google’s V8 JavaScript engine.

Unlike web servers like Apache, lighttpd etc. it doesn’t spawn a process or thread for every incoming connection, but handles everything within a single process. This is achieved by using asynchronous I/O operations which won’t block the engine’s execution. Instead, after calling a asynchronous function, execution of program code will instantaneously be continued and a callback handler will be executed upon completion of the I/O operation.

Node.js features a full-fledged HTTP server out of the box – and that is just the beginning. Like any other multi purpose programming language, it offers access to network sockets, file system, tty devices, process management and so on. Additionally there’s an endless collection of modules which is being provided by a broad community. Amongst other things, there are modules for database connectivity, SMTP server and message bus implementations.

Just out of curiosity I have implemented bindings for the SAP NetWeaver RFC SDK for use with Node.js. The usage resembles Piers Harding’s implementation for PHP but differs concerning the callback mechanism:

var sapnwrfc = require('sapnwrfc');

var connectionParams = {
  ashost: '',
  sysid: 'NPL',
  sysnr: '42',
  user: 'DEVELOPER',
  Passwd: 'password',
  client: '001',
  lang: 'E'

var con = new sapnwrfc.Connection;

con.Open(connectionParams, function(err) {
  if (err) {
  var funcParams = {
    IMPORTSTRUCT: { RFCFLOAT: 3.14159, RFCINT1: 123, RFCTIME: '094500', RFCCHAR4: 'NODE' }

  var func = con.Lookup("STFC_STRUCTURE");
  func.Invoke(funcParams, function(err, result) {
    if (err) {


The source code has been made available via GitHub but you are also encouraged to install it easily via npm (node package manager). Please read the README on GitHub for further instructions because you will have to download the RFC SDK beforehand.

You must be Logged on to comment or reply to a post.