Giter VIP home page Giter VIP logo

node-rfc's Introduction

node-rfc v2

Breaking changes at 2.0

Asynchronous, non-blocking SAP NetWeawer RFC SDK client bindings for Node.js, providing convenient ABAP business logic consumption from NodeJS.

NPM

license N-API v6 Badge release downloads dpw REUSE status

Key features

  • (new) RFM call templates: rfmcall
  • Based on N-API standard
  • Stateless and stateful connections (multiple function calls in the same ABAP session (same context))
  • Async/await, promise and callback API
  • ECMAScript, TypeScript
  • Sequential and parallel calls, using one or more clients
  • Automatic conversion between NodeJS and ABAP datatypes
  • Direct and managed connections (connection pool)
  • Throughput monitoring: number of calls, bytes sent/received, application/total time; SAP NWRFC SDK >= 7.53 required

Content

Supported platforms

Other platforms and frameworks:

Prerequisites

All platforms

  • SAP NW RFC SDK C++ binaries must be downloaded (SAP partner or customer account required) and locally installed (installation instructions. More information on SAP NW RFC SDK section on SAP Support Portal. Using the latest version is reccomended as SAP NW RFC SDK is fully backwards compatible, supporting all NetWeaver systems, from today S4, down to R/3 release 4.6C.

  • Build toolchain requires CMake

  • Build from source on macOS and older Linux systems, may require uchar.h file, attached to SAP OSS Note 2573953, to be copied to SAP NW RFC SDK include directory: documentation

Windows

macOS

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off

Installation

More info: Installation

❗ The npm installation and build from source, work only with NodeJS versions with minimum N-API 6: NodeJS/N-API version matrix. Usage works with all NodeJS versions supported by node-rfc.

After the SAP NW RFC SDK is installed on your system, the node-rfc can be installed from npm:

npm install node-rfc

Alternatively, when the node-rfc package is not provided for your platform for example, you can build the package from source:

git clone --single-branch https://github.com/SAP/node-rfc.git
cd node-rfc
npm install
npm run addon # rebuild native addon
npm run ts    # rebuild typescript wrapper

Getting started

More info: Usage and API

In order to call remote enabled ABAP function module, we need to create a node-rfc client instance with valid logon credentials, connect to SAP ABAP NetWeaver system and then invoke a remote enabled ABAP function module from nodejs. The client instance can be used for one or more subsequent RFC calls, see unit tests for more examples. Callback API example below shows basic principles.

"use strict";

const Client = require("node-rfc").Client;

const abapSystem = {
    user: "demo",
    passwd: "welcome",
    ashost: "10.68.104.164",
    sysnr: "00",
    client: "620",
    lang: "EN",
};

// create new client
const client = new Client(abapSystem);

// open connection
client.connect(function (err) {
    // check for login/connection errors
    if (err) return console.error("could not connect to server", err);

    // invoke ABAP function module, passing structure and table parameters

    // ABAP structure
    const structure = {
        RFCINT4: 345,
        RFCFLOAT: 1.23456789,
        RFCCHAR4: "ABCD",
        RFCDATE: "20180625", // ABAP date format
        // or RFCDATE: new Date('2018-06-25'), // as JavaScript Date object, with clientOption "date"
    };
    // ABAP table
    let table = [structure];

    client.invoke(
        "STFC_STRUCTURE",
        { IMPORTSTRUCT: structure, RFCTABLE: table },
        function (err, res) {
            if (err)
                return console.error("Error invoking STFC_STRUCTURE:", err);
            console.log("STFC_STRUCTURE call result:", res);
        }
    );
});

Finally, the connection is closed automatically when the instance is deleted by the garbage collector or by explicitly calling the client.close() method of the direct client, or client.release() or pool.release() for the managed client.

More resource and info about ABAP Connectors and RFC Communication

Highly reccomended series of three insightful articles about RFC communication and SAP NW RFC Library, published in the SAP Professional Journal (SPJ):

and more:

Known Issues

How to obtain support

If you encounter an issue or have a feature request, you can create a ticket.

Check out the SCN Forum (search for "node-rfc") and stackoverflow (use the tag "node-rfc"), to discuss code-related problems and questions.

Contributing

We appreciate contributions from the community to node-rfc! See CONTRIBUTING.md for more details on our philosophy around extending this module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.