Giter VIP home page Giter VIP logo

node-rfc's Introduction

node-rfc

Asynchronous, non-blocking SAP NetWeaver RFC SDK client and server bindings for Node.js. Direct consumption of ABAP business logic from Node.js and extending ABAP eco-system with Node.js capabilities, with automatic ABAP <-> Node.js data conversions.

node-rfc release Node.js engines N-API version deno version supported dpm REUSE status CII Best Practices

Call for Maintainers

This project is currently looking for new maintainers. Please see this issue for details.

Key features

  • Based on N-API standard
  • Client and Server bindings
  • Stateless and stateful connections (multiple function calls in the same ABAP session (same context))
  • Async and callback API
  • ECMAScript, TypeScript
  • Sequential and parallel calls, using one or more clients
  • Automatic conversion between Node.js 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
  • Usage examples & code-snippets: SAP-samples/node-rfc-samples

Content

Supported platforms

Other platforms and frameworks:

Requirements

node-gyp

Build toolchain is based on node-gyp and Python. For further details check: node-gyp#Installation

SAP NW RFC SDK 7.50 PL12

Docker

Docker container examples for Linux, Intel and ARM based Darwin: SAP/fundamental-tools/docker. SAP NWRFC SDK libraries are not included.

Linux

Windows

macOS

  • Remote paths must be set in SAP NWRFC SDK for macOS: documentation

  • When the node-rfc is started for the first time, the popups come-up for each NWRFC SDK library, to confirm it should be opened. If SDK is installed in admin folder, the node-rfc app shall be that first time started with admin privileges, eg. sudo -E

Download and Installation

More info: Installation

โ— The build from source requires Node.js release with minimum N-API version given in package.json property "napi_versions": Node-API version matrix.

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, the package shall be built from source. This installation method is highly recommended on Linux platforms:

git clone 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

See Usage and API, also SAP NWRFC SDK 7.50 Programming Guide

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. Async example below shows basic principles and you can check the documentationand unit tests for more examles.

Add your ABAP system destintion to sapnwrfc.ini file in your working directory:

DEST=MME
USER=demo
PASSWD=welcome
ASHOST=myhost
SYSNR=00
CLIENT=620
LANG=EN

Connection parameters are documented in sapnwrfc.ini file, located in the SAP NWRFC SDK demo folder. Check also section 4.1.2 Using sapnwrfc.ini of SAP NWRFC SDK 7.50 Programming Guide

Call the ABAP RFM. When in doubt about RFM parameters' structure try abap call CLI tool of SAP/fundamental-tools

Direct client

const noderfc = require("node-rfc");

const client = new noderfc.Client({ dest: "MME" });

(async () => {
    try {
        // unlike the connection acquired from pool,
        // the direct client connection is initially closed
        await client.open();

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

        // ABAP structure
        const abap_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 abap_table = [abap_structure];

        const result = await client.call("STFC_STRUCTURE", {
            IMPORTSTRUCT: abap_structure,
            RFCTABLE: abap_table,
        });

        // check the result
        console.log(result);
    } catch (err) {
        // connection and invocation errors
        console.error(err);
    }
})();

Managed client

const noderfc = require("node-rfc");

const pool = new noderfc.Pool({ connectionParameters: { dest: "MME" } });

(async () => {
    try {
        // get a client connection instance
        const client = await pool.acquire();

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

        // ABAP structure
        const abap_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 abap_table = [abap_structure];

        const result = await client.call("STFC_STRUCTURE", {
            IMPORTSTRUCT: abap_structure,
            RFCTABLE: abap_table,
        });

        // check the result
        console.log(result);
    } catch (err) {
        // connection and invocation errors
        console.error(err);
    }
})();

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:

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.

Code of Conduct

See Code of Conduct

node-rfc's People

Contributors

alexlambertz avatar brunopenso avatar bsrdjan avatar clausreinke avatar denistis avatar dependabot[bot] avatar fredimartins avatar fujifish avatar io-pa avatar n8-i avatar nonoll avatar sebastianwolf-sap avatar spencer-uk avatar uxkjaer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-rfc's Issues

Error - rfc.Client is not a function

I am receiving the following error trying to create the client. Not sure what I have defined incorrectly.

Thanks for your help

Code

....
// Define the SAP Configuration
var SAPconfig = {
user: 'xxx',
passwd: 'xxx',
ashost: 'xxx',
sysnr: '010',
client: '11'
};

var rfc = require('node-rfc');
var client = new rfc.Client(SAPconfig, true);
console.log('** RFC Client Lib Version: ' + client.getVersion());

Console Log

var client = new rfc.Client(SAPconfig, true);
^

TypeError: rfc.Client is not a function
at Object. (c:\Boelter Applications\BoelterIntegrationServer\server.js:57:14)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.runMain as _onTimeout
at Timer.listOnTimeout (timers.js:93:15)

RFC_SERIALIZATION_FAILURE in case of nested input structures

Hi,

I have a custom BAPI that serves as an interface for a call of standard SAP object (method) cmd_ei_api=>maintain_bapi. The maintain_bapi method has an input parameter IS_MASTER_DATA TYPE CMDS_EI_MAIN. The type is very deep one with many levels of nested structures. When I call my custom BAPI from nodejs app I'm experiencing performance issue (it takes 7 minutes to execute in contrast to few seconds when I run the same BAPI via SAP GUI) and also sometimes an error RC12 RFC_SERIALIZATION_FAILURE occurs.
What can be done to solve RFC_SERIALIZATION_FAILURE error and performance issue?

thanks

Getting "No_Data_Found" Error with correct parameters.

Hi,
I am trying to fetch data from st03 via fm "SWNC_COLLECTOR_GET_AGGREGATES".
I can use it in the system but when I try it in node-rfc with same parameters passed, It gives me No_Data_Found error.

image

I have tried to pass date so many different types, no result at all. I can use test fm and a few others fm's like TH_WPINFO etc. I am only struggling with this fm.

npm install node-rfc doesn't work

Hi there,

i was trying to install node-rfc but I get this errors:
ode-pre-gyp ERR! Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.11/rfc-v0.1.11-node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
make: Entering directory /var/www/PRG/playground/authentication/node-rfc/build' CXX(target) Release/obj.target/rfc/src/rfc.o In file included from ../src/rfc.cc:16:0: ../src/Client.h:23:22: fatal error: sapnwrfc.h: No such file or directory #include <sapnwrfc.h> ^ compilation terminated. make: *** [Release/obj.target/rfc/src/rfc.o] Error 1 make: Leaving directory /var/www/PRG/playground/authentication/node-rfc/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-042stab124.2
gyp ERR! command "/opt/node/bin/node" "/opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node" "--module_name=rfc" "--module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc"
gyp ERR! cwd /var/www/PRG/playground/authentication/node-rfc
gyp ERR! node -v v8.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/opt/node/bin/node /opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node --module_name=rfc --module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc' (1)
node-pre-gyp ERR! stack at ChildProcess. (/var/www/PRG/playground/authentication/node-rfc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:927:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.13.0-042stab124.2
node-pre-gyp ERR! command "/opt/node/bin/node" "/var/www/PRG/playground/authentication/node_modules/node-rfc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/PRG/playground/authentication/node-rfc
node-pre-gyp ERR! node -v v8.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute '/opt/node/bin/node /opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node --module_name=rfc --module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc' (1)
npm WARN enoent ENOENT: no such file or directory, open '/var/www/PRG/playground/authentication/package.json'
npm WARN authentication No description
npm WARN authentication No repository field.
npm WARN authentication No README data
npm WARN authentication No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-25T13_53_07_192Z-debug.log

Has someone an idea?

Thanks a lot in advance!

Error - Unable to find module

Hello, need your help in resolving an error that I encountered after installing node-rfc.
Environment: Windows 7 X64
Node version : 6.7.0
Installed SAPNWRFC at C:\NWRFC and also set up the PATH environment variable to point to C:\NWRFC\lib
I was able to install node-rfc in my current working directory using the command npm install node-rfc.
I checked if the installation went through successfully using the following commands.
node
var r = require('node-rfc')
But it gives me the following error:

Error: The specified module could not be found.
\?\C:\Users\Vinc\Documents\Matrix\node_modules\node-rfc\build\rfc\rfc.node
at Error (native)
at Object.Module._extensions..node (module.js:583:18)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Vinc\Documents\Matrix\node_modules\node
-rfc\index.js:6:11)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)

The file

\?\C:\Users\Vinc\Documents\Matrix\node_modules\node-rfc\build\rfc\rfc.node

is present in the local directory where node-rfc was installed.
I am not sure if the prefix \?\ refers to the global directory for npm packages. I tried to install node-rfc globally: npm install node-rfc -g -s but got an error that the node-module could not be found. Thanks for your time.

build failed for Node.js 7

There is no precompiled binding rfc.node for node V51, so npm tried to build it from source. But it seems can not found the source files: rfc.cc ,error.cc, rfcio.cc, Client.cc.
I had set the environment SAPNWRFC_HOME = D:\Program Files\nwrfcsdk

node-pre-gyp ERR! Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.11/rfc-v0.1.11-node-v51-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp)

D:\Code\demo\Node\sap\node_modules\node-rfc>if not defined npm_config_node_gyp (node "C:\Users\bj95\AppData\Roaming\nvm\v7.10.0\node_modules\npm\bin\
node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node "" clean )

D:\Code\demo\Node\sap\node_modules\node-rfc>if not defined npm_config_node_gyp (node "C:\Users\bj95\AppData\Roaming\nvm\v7.10.0\node_modules\npm\bin\
node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=D:\Code\demo\Node\sap\node_modules\node-rfc\build\r
fc\rfc.node --module_name=rfc --module_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc --python=C:\Python27amd64\python.exe --msvs_version
=2015 )  else (node "" configure --fallback-to-build --module=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc\rfc.node --module_name=rfc --modu
le_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc --python=C:\Python27amd64\python.exe --msvs_version=2015 )

D:\Code\demo\Node\sap\node_modules\node-rfc>if not defined npm_config_node_gyp (node "C:\Users\bj95\AppData\Roaming\nvm\v7.10.0\node_modules\npm\bin\
node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build --module=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc\r
fc.node --module_name=rfc --module_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc )  else (node "" build --fallback-to-build --module=D:\
Code\demo\Node\sap\node_modules\node-rfc\build\rfc\rfc.node --module_name=rfc --module_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  rfc.cc
  error.cc
  rfcio.cc
  Client.cc
d:\code\demo\node\sap\node_modules\node-rfc\src\rfcio.h(21): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directory (c
ompiling source file ..\src\Client.cc) [D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc.vcxproj]
d:\code\demo\node\sap\node_modules\node-rfc\src\rfcio.h(21): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directory (c
ompiling source file ..\src\rfcio.cc) [D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc.vcxproj]
  win_delay_load_hook.cc
d:\code\demo\node\sap\node_modules\node-rfc\src\Client.h(23): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directory (
compiling source file ..\src\rfc.cc) [D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc.vcxproj]
d:\code\demo\node\sap\node_modules\node-rfc\src\error.h(20): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directory (c
ompiling source file ..\src\error.cc) [D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\bj95\AppData\Roaming\nvm\v7.10.0\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\bj95\\AppData\\Roaming\\nvm\\v7.10.0\\node_modules\\npm\\node_modules\\node-gyp\\b
in\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\Code\\demo\\Node\\sap\\node_modules\\node-rfc\\build\\rfc\\rfc.node" "--module_name=rfc"
 "--module_path=D:\\Code\\demo\\Node\\sap\\node_modules\\node-rfc\\build\\rfc"
gyp ERR! cwd D:\Code\demo\Node\sap\node_modules\node-rfc
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=D:\Code\demo\Node\sap\node_modules\node-rfc\build\r
fc\rfc.node --module_name=rfc --module_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Code\demo\Node\sap\node_modules\node-rfc\node_modules\node-pre-gyp\lib\util\compile.js:83
:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:899:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Code\\demo\\Node\\sap\\node_modules\\node-rfc\\node_modules\\node-pre-gyp\\bin\\
node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\Code\demo\Node\sap\node_modules\node-rfc
node-pre-gyp ERR! node -v v7.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc\rfc.node --module_name=rfc -
-module_path=D:\Code\demo\Node\sap\node_modules\node-rfc\build\rfc' (1)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-rfc"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-rfc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-rfc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-rfc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\bj95\AppData\Roaming\npm-cache\_logs\2017-05-27T07_00_19_163Z-debug.log

Node.js 4.1?

I found your node module which seems very useful for us. Thanks for creating a Node.js binding!

I just want to ask if there are plans in the near future to support Node.js 4.1?

Unable to install node-rfc on Ubuntu 16.04

austin@analytics:~/node-rfc$ npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

[email protected] install /home/austin/node-rfc
node-gyp rebuild

make: Entering directory '/home/austin/node-rfc/build'
CXX(target) Release/obj.target/rfc-v6.9.1/src/rfc.o
In file included from ../src/rfc.cc:19:0:
../src/Client.h:23:22: fatal error: sapnwrfc.h: No such file or directory
compilation terminated.
rfc-v6.9.1.target.mk:109: recipe for target 'Release/obj.target/rfc-v6.9.1/src/rfc.o' failed
make: *** [Release/obj.target/rfc-v6.9.1/src/rfc.o] Error 1
make: Leaving directory '/home/austin/node-rfc/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-31-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/austin/node-rfc
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-rfc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-rfc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-rfc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/austin/node-rfc/npm-debug.log
austin@analytics:~/node-rfc$ node

install failure()

hello ,
I faced issue about โ€œFailed at the [email protected] preinstall script 'npm install node-pre-gyp'.โ€
and the full infomation like following :

npm ERR! [email protected] preinstall: `npm install node-pre-gyp`
npm ERR! Exit status 4294963214
npm ERR!
npm ERR! Failed at the [email protected] preinstall script 'npm install node-pre-gyp'.

then I found "node-pre-gyp: python (v2.7 recommended, v3.x.x is not supported)"
my python version was v3.5 ,
Isthat affect error? or others ?

Platform not supported linux x64

I installed node-rfc via "npm install", and via "git clone ..." with both ways the wrong result are the same when I run the first simple test:

node
var r = require('node-rfc');
Platform not supported linux x64
undefined

I have Ubuntu 14.04 LTS
node 5.3.0
npm 3.3.12

I have installed PyRFC and it run fine..

Regards,

Undefined variable module_name in binding.gyp while trying to load binding.gyp

Hello,

I have an issue when I need to compile with the command (node-gyp configure --msvs_version=2013). I have cloned the project from the readme and it does work.

When I ran the command: node-gyp configure --msvs_version=2013, the proces thorw this log:

gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/nodejs',
gyp verb cli '/usr/bin/node-gyp',
gyp verb cli 'configure',
gyp verb cli 'build',
gyp verb cli '-v' ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which succeeded python2 /usr/bin/python2
gyp verb check python version /usr/bin/python2 -c "import platform; print(platform.python_version());" returned: "2.7.12\n"
gyp verb get node dir no --target version specified, falling back to host node version: 6.7.0
gyp verb command install [ '6.7.0' ]
gyp verb install input version string "6.7.0"
gyp verb install installing version: 6.7.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 6.7.0
gyp verb build dir attempting to create "build" dir: /home/administrador/node-rfc/build
gyp verb build dir "build" dir needed to be created? null
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /home/administrador/node-rfc/build/config.gypi
gyp verb config.gypi checking for gypi file: /home/administrador/node-rfc/config.gypi
gyp verb common.gypi checking for gypi file: /home/administrador/node-rfc/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/administrador/node-rfc/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.node-gyp/6.7.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/6.7.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/6.7.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/administrador/node-rfc',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-112-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "configure" "build" "-v"
gyp ERR! cwd /home/administrador/node-rfc
gyp ERR! node -v v6.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Can anybody help me?
Thank you.

call of BAPI BAPI_MATERIAL_GETLIST not working

Hello,

I'm using a BAPI BAPI_MATERIAL_GETLIST as shown in below code. When I'm using the same parameters for the same BAPI in SAP GUI I get correct data (2 records in table MATNRLIST). However, BAPI call via node-RFC seems not working (10 records in MATNRLIST returned). So it looks like MAXROWS param doesn't work.

Can someone look at this?

thanks

"use strict";
var rfc = require('node-rfc');
var abapSystem = {
    user: '',
    passwd: '',
    ashost: '',
    sysnr: '',
    client: ''
};
var client = new rfc.Client(abapSystem);
var MAXROWS = "2";
var MATNRSELECTION_str = {
		SIGN: 		"I", 
		OPTION: 	"CP", 
		MATNR_LOW: 	"AB*"
	};	
var MATNRSELECTION_tab = [MATNRSELECTION_str];
	
client.connect(function(err) {
    if (err) {
        return console.error('could not connect to server', err);
    }	
    client.invoke('BAPI_MATERIAL_GETLIST', {
			MAXROWS: MAXROWS,
			MATNRSELECTION: MATNRSELECTION_tab
        },
        function(err, res) {
            if (err) {
                return console.error('Error invoking BAPI_MATERIAL_GETLIST:', err);
            }
		console.log('Result BAPI_MATERIAL_GETLIST:', res);
        });	
});

Build process failing

after following the clone and build method I am getting an error

c:\os\node-rfc>npm install

[email protected] preinstall c:\os\node-rfc
npm install node-pre-gyp

[email protected] install c:\os\node-rfc
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.11/rfc-v0.1.11-node-v57-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
c:\os\node-rfc\build\rfc.vcxproj(20,3): error MSB4019: The imported project "c:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (c:\os\node-rfc\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "c:\os\node-rfc\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=c:\os\node-rfc\build\rfc\rfc.node" "--module_name=rfc" "--module_path=c:\os\node-rfc\build\rfc"
gyp ERR! cwd c:\os\node-rfc
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe c:\os\node-rfc\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=c:\os\node-rfc\build\rfc\rfc.node --module_name=rfc --module_path=c:\os\node-rfc\build\rfc' (1)
node-pre-gyp ERR! stack at ChildProcess. (c:\os\node-rfc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:927:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "c:\os\node-rfc\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd c:\os\node-rfc
node-pre-gyp ERR! node -v v8.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe c:\os\node-rfc\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=c:\os\node-rfc\build\rfc\rfc.node --module_name=rfc --module_path=c:\os\node-rfc\build\rfc' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\wilchemh\AppData\Roaming\npm-cache_logs\2017-08-16T17_57_33_080Z-debug.log

Unable to install node-rfc

Hello. I'm running into many errors trying to install node-rfc on my PC. Here's my setup:

OS: Windows 10
IIS: IIS 7 Express (32-bit) NOTE: I could not find a 64-bit version of IIS 7 Express
Node: 8.9.4 (32-bit)

Also, the SAP NW RFC SDK is on my PC and the paths to c:\nwrfcsdk and c:\nwrfcsdk\lib are both in the PATH environment variable.

When I run npm install node-rfc I'm getting the following warnings & errors.

Thanks in advance!

> [email protected] preinstall C:\NodeJSProjects\mim\node_modules\node-rfc
> npm install node-pre-gyp

+ [email protected]
added 113 packages in 6.259s

> [email protected] install C:\NodeJSProjects\mim\node_modules\node-rfc
> node-pre-gyp install --fallback-to-build

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  rfc.cc
  error.cc
  rfcio.cc
  Client.cc
  win_delay_load_hook.cc
..\src\Client.cc(364): warning C4305: 'argument': truncation from 'v8::Local<v8::Boolean> (__cdecl *)(v8::Isolate *)' to 'bool' [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
..\src\rfcio.cc(170): warning C4244: 'argument': conversion from 'int64_t' to 'const RFC_INT', possible loss of data [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
..\src\rfcio.cc(173): warning C4244: 'argument': conversion from 'int64_t' to 'const RFC_INT1', possible loss of data [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
..\src\rfcio.cc(176): warning C4244: 'argument': conversion from 'int64_t' to 'const RFC_INT2', possible loss of data [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1189,5): warning MSB8012: TargetPath(..\win32_x86\rfc.node) does not match the Linker's OutputFile property value (C:\NodeJSProjects\mim\node_modules\node-rfc\build\win32_x86\rfc.node). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
     Creating library win32_x86\rfc.lib and object win32_x86\rfc.exp
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetFieldDescByName@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcAppendNewRow@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetString@24 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetParameterDescByName@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetTime@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetFloat@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetNum@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetNum@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcUTF8ToSAPUC@24 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetParameterCount@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetFloat@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetFieldCount@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSAPUCToUTF8@24 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetXString@24 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetStructure@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetChars@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetInt@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetInt@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetInt2@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetInt2@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetXString@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetDate@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetStringLength@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetTable@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetChars@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetString@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetRowCount@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetCurrentRow@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetInt1@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetFieldDescByIndex@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetBytes@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcMoveTo@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetDate@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetInt1@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetBytes@20 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcSetTime@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
rfcio.obj : error LNK2001: unresolved external symbol _RfcGetParameterDescByIndex@16 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcGetFunctionDesc@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcInvoke@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcGetConnectionAttributes@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcCloseConnection@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcOpenConnection@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcPing@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcCreateFunction@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcGetVersion@12 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Client.obj : error LNK2001: unresolved external symbol _RfcDestroyFunction@8 [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
win32_x86\rfc.node : fatal error LNK1120: 46 unresolved externals [C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc.vcxproj]
Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc\rfc.node --module_name=rfc --module_path=C:\NodeJSProjects\mim\node_modules\node-rfc\build\rfc' (1)

Overflow?

Hello Srdjan,

When I extract BSEG-PSWBT and BSEG-DMBTR from document
image
with RFC_READ_TABLE in my result I have truncated (overflown?) figures:

Headers: PSWBT,DMBTR
[ [ 'PSWBT', 'DMBTR' ],
  [ '4184374221.00', '4184374221.00' ],
  [ '8995269802.00', '8995269802.00' ],
  [ '1071702116.00', '1071702116.00' ],
  [ '40501469.00', '40501469.00' ],
  [ '*291847608.00', '*291847608.00' ] ]

Could you please advise on this?
Thank you,
Alexei

Add v59 win32 to the release?

node-pre-gyp ERR! Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.14/rfc-v0.1.14-node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI, unknown) (falling back to source compile with node-gyp)

Using v9.10.1

It tried compiling it from source but failed, is that normal for unsupported versions?

EDIT: Oops, should have read the description. Anyway, the fallback to build doesn't work with it.

npm install fails on Windows

I tried the 0.1.14 release on Windows with Node.js 8.9.4, but it fails with

Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.14/rfc-v0.1.14-node-v57-win32-x64.tar.gz

Is it possible to provide the v57 files for Windows as well?

node-rfc fails with node v8.11.2 (the current STABLE version)

The following error is displayed with a clean install:


module.js:681
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Projects\jco\node_modules\node-rfc\build\rfc\rfc.node
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Projects\jco\node_modules\node-rfc\index.js:6:11)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)

The binary file, namely C:\Projects\jco\node_modules\node-rfc\build\rfc\rfc.node exists in the specified directory, so that's not the problem.

Performance issue calling inside async method

Hi,

I'm having a hard time on this piece.
pause(x), is a simple function that returns a promise that will be resolved after x miliseconds.

Checking the executeClient time in the console, you will see that the pause time (5000ms in this example) is included, which doesn't make sense. The solution I found was to use setImmediate when calling resolve on executeClient.
I'm testing on node v8.11.2.
I belive this has to do with the way node-rfc treats the callback function.

process.env.PATH = process.env.PATH + ";" + __dirname + "\\nwrfcsdk-win\\lib";
var rfc = require('node-rfc');

var glClient = new rfc.Client({
	"user": "XXX",
	"passwd": "XXX",
	"ashost": "XXX",
	"sysnr": "XX",
	"client": "XX"
});

var pause = function(x) {
	return new Promise(function(resolve, reject) {
		setTimeout(()=>{
			resolve();
		}, x)
	})
};

const connect = function() {
	return new Promise(function(resolve, reject) {
		glClient.connect(function(err) {
			if (err) {
				reject(err);
			} else {
				resolve(glClient);
			}
		});
	});
};

function executeClient() {
	return new Promise(function(resolve, reject) {
		client.invoke('STFC_CONNECTION', { REQUTEXT: 'Hello SAP!' }, function(err, res) {
			if (err) {
				return console.error('Error invoking STFC_CONNECTION:', err);
			}
			resolve();
		});
	});
};

(async () => {
	try {
		client = await connect();
	} catch (e) {
		console.error('Could not connect to server', err);
	}
	for (var i = 0; i < 100; i++) {
		console.time('executeClient');
		let variant = await executeClient();
		console.timeEnd('executeClient');
		pause(5000);
	}
})();

TABLES parameter

Hi there,

is it possible to use tables parameters? I'm especially interested in calling the FM RFC_READ_TABLE with proper parameters. This does not work:

  client.invoke('RFC_READ_TABLE',
    { 
      QUERY_TABLE: 'E070',
      OPTIONS: [
        {
          TEXT: ""
        }
      ]
    },
    function(err, res) {
      if (err) {
        throw err;
      }

      console.log(res);
    }
  );

It does not even give an error which confuses me. Any hint?

Thanks!

Passing Fields Parameter

We are facing an issue while passing multiple parameters for FIELDS:

client.invoke('RFC_READ_TABLE', { QUERY_TABLE: 'AGR_1016', OPTIONS: [{ TEXT: "" }], FIELDS: [{ FIELDNAME: "PROFILE,AGR_NAME,PSTATE" }] }, function(err, res) { debugger; if (err) { throw err } console.log(res); }); });

Getting exception code 5 'FIELD_NOT_VALID'. Please advise on how to pass multiple fields as a parameter to FIELDS. Also, we wish to extract data in JSON format, any help here is welcomed.

Fatal Error when invoking: RFC FM "SO_NEW_DOCUMENT_SEND_API1"

I got a fatal error when trying to invoke this function (that creates a new document in SAPOffice and sends it to a list of users (receivers).

#
# Fatal error in ..\..\src\heap\heap.cc, line 3609
# Check failed: map->instance_type() == JS_REGEXP_TYPE || map->instance_type() == JS_OBJECT_TYPE || map->instance_type() == JS_ARRAY_TYPE || map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE.
#

I think it has to do with the input Table (array) RECEIVERS, The first field (RECEIVER) looks kinda special in SAP GUI:
image

I have tried to transfer it (in javascript) as:
{RECEIVERS: [{RECEIVER: "SOMEUSERNAME"}]}

And also as:
{RECEIVERS: [{RECEIVER: {RECEIVER: "SOMEUSERNAME"}}]}

Both caused the fatal error, and the whole node process to break.

Doron

Build rfc.node online with CircleCI + AppVeyor

I just want to let you know that we're working on a cloud based build to create the rfc.node for both Linux and Windows with just a git push.

This is our first step to help to fix this module to make it work with Node.js 4.2.

You can have a look at our current work in progress in our fork plossys/node-rfc.

We have added Build status badges to the README.md.
Here you can jump to CircleCI for the latest Linux builds and AppVeyor to the latest Windows builds.

At each git push to the master branch a build is triggered and executed with

Both builds just compile the rfc.node files that are stored as artifacts in CircleCI and AppVeyor.

A still missing step should collect both the CircleCI artifact and AppVeyor artifacts and glue altogether to prepare a npm publish step. But this should only run if someone eg. creates a new GitHub release or a similar step.

This just shows that all could be done online and still keep the SAP NW RFC DLL closed to the public. Both CI servers download the SDK from a protected download area.

If you want we can create a PR and help you setup the both CI builds (which is no more than just registering to each and connect your repo to it and it costs nothing for public repos.).

Calling an RFC in a loop fails on Windows

Calling one RFC multiple times in a loop, fails on Windows platform.

Unit test to reproduce STFC_CONNECTION should work in a loop works on Linux and here the error message on Windows:

1) Connection STFC_CONNECTION should work in a loop:
     Uncaught AssertionError: expected Error {
     code: 1,
     key: 'RFC_COMMUNICATION_FAILURE',
     message: LOCATION    CPIC (TCP/IP) on local host with Unicode
     ERROR          program state check for conversation 00485915
     TIME        Tue Jan 12 10:43:06 2016
     RELEASE     742
     COMPONENT   CPIC (TCP/IP) with Unicode VERSION     3
     RC          471
     MODULE      D:/depot/bas/742_COR/src/krn/si/cpic/r3cpic.c
     LINE        6220
     DETAIL      called function STSEND in state state=BUFFER_DATA2
     COUNTER    2
} to not exist
     at C:\src\node-rfc\test\test.js:69:15

2) Connection "after each" hook:
     Uncaught AssertionError: expected Error {
     code: 1,
     key: 'RFC_COMMUNICATION_FAILURE',
     message: LOCATION    CPIC (TCP/IP) on local host with Unicode
     ERROR    program state check for conversation 00485915
     TIME        Tue Jan 12 10:43:06 2016
     RELEASE     742
     COMPONENT   CPIC (TCP/IP) with Unicode
     VERSION     3
     RC          471
     MODULE      D:/depot/bas/742_COR/src/krn/si/cpic/r3cpic.c
     LINE        6220
     DETAIL      called function STSEND in state state=BUFFER_DATA2
     COUNTER     2
} to not exist
     at C:\src\node-rfc\test\test.js:69:15

Create this issue as a reminder to investigate in detail.

Is there or could there be support for not specifying result tables?

Hi,
I am quite new to rfc and bapi but so far I have had good success with this library.

I am hitting one small hurdle - not sure if there is a workaround or maybe could be a fix?
I am trying to get a detail of a tasklist using the BAPI using the function EAM_TASKLIST_GET_DETAIL

In the return structure there is an error message:
"Task list A 00000008 is not hierarchical"

I read on the sap forum the way to get around this is not to specify ET_HDR_HIERARCHY or ET_OPR_HIERARCHY in the tables values but I think with node-rfc it automatically specifies all the tables or maybe this is a limitation in RFC?

You can see a forum post where someone else had this problem and the solution was not to pass these: https://archive.sap.com/discussions/thread/3484536

In case it is useful this is the full json that I get back from the call:
{
"IV_DATE": "00000000",
"IV_EQUNR": "",
"IV_LOCK": "",
"IV_PLANT": "",
"IV_PLNAL": "",
"IV_PLNGR": "",
"IV_PLNNR": "00000008",
"IV_PLNTY": "A",
"IV_REFRESH_BUFFER": "",
"IV_STATUS": "",
"IV_TPLNR": "",
"IV_USAGE": "",
"ET_COMPONENTS": [],
"ET_HDR_HIERARCHY": [],
"ET_HEADERS": [],
"ET_MPACKAGES": [],
"ET_OPERATIONS": [],
"ET_OPR_HIERARCHY": [],
"ET_PRTS": [],
"ET_RELATIONS": [],
"ET_RETURN": [
{
"TYPE": "E",
"ID": "DIWP1",
"NUMBER": "212",
"MESSAGE": "Task list A 00000008 is not hierarchical",
"LOG_NO": "",
"LOG_MSG_NO": "000000",
"MESSAGE_V1": "A",
"MESSAGE_V2": "00000008",
"MESSAGE_V3": "",
"MESSAGE_V4": "",
"PARAMETER": "HIERARCHY",
"ROW": 0,
"FIELD": "",
"SYSTEM": "ARTEST"
}
],
"ET_SPACK_CONTR_LIMITS": [],
"ET_SPACK_LIMITS": [],
"ET_SPACK_LINES": [],
"ET_SPACK_OUTLINES": [],
"ET_TEXT": [],
"ET_TEXT_LINES": []
}

Error fetching SAP document (workflow task attachment) using 'SO_DOCUMENT_READ_API1'

Hi,
I was trying to read an attachment data (bmp image) that was attached to a workflow task using the function SO_DOCUMENT_READ_API1, and I couldn't recreate the image on the client side. The data received was corrupted. I have also notice some kind of 'node-rfc' error in the returning structure.
What is the correct way to retrieve an attachment from SAP?

image

Error: libdl.so.1: cannot open shared object file: No such file or directory

Hi everyone,

i tried on ubuntu and debian, and get on both systems the following error, can anybody help?

module.js:434
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: libdl.so.1: cannot open shared object file: No such file or directory
    at Error (native)
    at Object.Module._extensions..node (module.js:434:18)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/blablub/node_modules/node-rfc/index.js:6:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

unable to compile the node-rfc

Hi,
I am unable to compile node-rfc module and i am getting the following error , please help me,

Error: The specified module could not be found.
\?\C:\Users\Aakash Kumar\AppData\Roaming\npm\node_modules\node-rfc\build\rfc\rfc.node

rfc sdk DETAIL NiBufIConnect:

Hello!
I used node-rfc with socket.io for connection to different abap backend, to get information from several SAP system.
If the all abap backend servers are available, then I getting results succesfully.
But if some abap backend servers is not available(for example saprouter is down), then after long time I get the following message in the log file:

LOCATION CPIC (TCP/IP) on local host with Unicode
ERROR timeout occured
TIME Tue Apr 15 15:37:18 2014
RELEASE 720
COMPONENT NI (network interface)
VERSION 40
RC -5
MODULE nibuf.cpp
LINE 4795
DETAIL NiBufIConnect: route connect '/H/xxx.xxx.xxx.xxx/H/xxx.xxx.xxx.xxx'
timeout
COUNTER 2

and the most pity, that the node-rfc before response for remaining abap backend(which are available) is waiting response from non available abap server, as a result the blocking the last connections and very long time of response.

It can be fixed?

Also I found at SDN post http://scn.sap.com/thread/3538125 it is very similar description problem.

Platform not supported win32 x64

Hi, i see the following error:

C:\Users\ak\Documents\code\sap>node
> var rfc = require('node-rfc')
Platform not supported win32 x64
undefined
> process.platform
'win32'
> process.arch
'x64'
>
C:\Users\ak\Documents\code\sap>

Please advise what can be wrong.

Thank you,
Alexei

[Question] Forwarding authentication from SCP

Hello @bsrdjan ,

I would like to know if there is any form to forward a SAP Cloud Platform authentication when consuming resources through RFC using node-rfc and the Cloud Connector.

I lack the background to judge by myself how this could be done.

Best Regards,
Guilherme.

Project Dead?

Is this project dead? I see no commits for 4 months. Looking forward to the nodes rfc server bindings.

node-rfc memory leak?

We have encountered very high memory consumption in our node process after some time the node-rfc was running.
We performed a small test (see below) trying to isolate only node-rfc's memory consumption change over time. The test invoke the BAPI_PO_GETITEMSREL function module 500 times sequentially, each time we write the node process memory to a text file. Results show a constant increase in the node rss memory, starting from ~33MB, ending at ~100MB.

var rfc = require ("node-rfc");

var abapSystem = {
    "user": "fill in yours",
    "passwd": "hidden",
    "ashost": "hidden",
    "sysnr": "hidden",
    "client": "hidden"
}

var fs = require ("fs");
var fileName = "withClose.txt";
fs.writeFile(fileName, `iteration\t\trss\t\theapTotal\t\theapUsed\t\texternal\n`)
function run (i) {

    console.log(i);
    if (i == 500) return;

    var client = new rfc.Client(abapSystem);

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

        client.invoke("BAPI_PO_GETITEMSREL", {"REL_GROUP":"02","REL_CODE":"A1"}, function (err, res) {
            var memUsage = process.memoryUsage();
            var line = `${i}\t\t${(memUsage.rss / 1024 / 1024).toFixed(3)}MB\t\t${(memUsage.heapTotal / 1024 / 1024).toFixed(3)}MB\t\t${(memUsage.heapUsed / 1024 / 1024).toFixed(3)}MB\t\t${(memUsage.external / 1024 / 1024).toFixed(3)}MB\t\t${err ? err : ""}\n`;
            fs.appendFileSync(fileName, line);
            client.close();
            setTimeout(() => run(++i), 0);
        });
    });
}

run(1);

Possible wrong handling of RFCTYPE_BCD in recently introduced fill type checks

Since updating to the latest version of node-rfc, our BAPI calls are being rejected with the following error:

Number expected when filling field AMOUNT of type 2

We dug into the source code to find out that this error is raised by the recently introduced fill type check commit. RFCTYPE_BCD is handled exactly like RFCTYPE_FLOAT, but as far as we know, RFCTYPE_BCD is supposed to be a Decimal, not a Float (we're using it to store money values). Thus, we believe RFCTYPE_BCD should expect a String, not a Number.

In older versions, we were able to successfully pass the following attribute to the BAPI call:

{
  "AMOUNT": "13.37"
}

which IMHO is the correct way to represent a currency value in JSON. With the latest version of the SDK this would need to be changed to:

{
  "AMOUNT": 13.37
}

to pass the fill type checks. But representing money values with a float type is generally a very bad idea. I looked into other SAP RFC implementations (especially PyRFC), where RFCTYPE_BCD is correctly associated with Python's Decimal type. Due to the fact that Javascript does not have a built-in Decimal type[1], a string value is the only way to safely pass in money values.

What do you think?

[1] Of course, there are modules like decimal.js

Deployment on AWS Lambda

Following a question posted in #35, the node-rfc deployment on AWS Lambda requires SAP NW RFC libraries copied to location different from the the usual one, `/usr/local'.

The SAP NW RFC libs location must be configured for the operating system runtime, as described here and it must be configured in SAPNWRFC_HOME env variable, referenced in binding.gyp, for building from source.

Regarding operating system runtime, LD_LIBRARY_PATH env variable can be used, to add the library for the current session. For permanent change, a path should be added under /etc.ld.so.conf.d, like described in node-rfc documentation but that is probably not permitted on AWS Lambda?

Regarding building from source, is it required on AWS Lambda? You could eventually compile once and install that precompiled binary, together with SAP dependencies, added to LD_LIBRARY_PATH ?

Id build from source required, could a script eventually determine a current working directory and set SAPNWRFC_HOME accordingly? As far I could find in node-gyp documentation, node-gyp does not support relative paths.

Node 6 support

After upgrading to Node 6 and recompiling the node-rfc library, I'm getting "Segmentation faults" on invoke() calls. Is this just me or is Node 6 not officially supported yet?

r3connect - lean wrapper of node-rfc

Hi, though node-rfc makes it easy to invoke RFCs in back-ends I thought that it deserves some more functionality to make it even simpler to use. Hence, I created a new project that builds on top of node-rfc and you can find it here: r3connect

Its main advantages are:

  • Based on ES6 Promises
  • Pooling of connections to improve performance (i.e. keep existing connections open and reuse them later) and queue function calls (otherwise at some point the system will not allow to make more RFCs)
  • Built-in REST API
  • Built-in Docker file in order to containerize node-rfc
  • Use it as CLI (global node module) or as a local node module within existing scripts

I am looking forward to getting feedback on the project and am happy about any contributions! :-)

Is there a way to make the rfc call Async?

When calling invoke(), although one of the parameters is a callback function, the call itself is synchronous.
The javascript thread is stuck untill the callback function is being called.
Kind of creates a problematic situation where the node process cannot serve any other request while an rfc call is in process.

Is there a way to call the invoke function Async?
Doron

Can't install node-rfc

i follow the install instruction "npm install node-rfc" i get this error:

npm install node-rfc
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/Cellar/node/5.3.0/bin/node" "/usr/local/bin/npm" "install" "node-rfc"
npm ERR! node v5.3.0
npm ERR! npm v3.5.2
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/node-rfc
npm ERR! 404
npm ERR! 404 'node-rfc' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/rio/Sites/holcim/npm-debug.log

thanks

Module not found

Hi!

Thank you for this package.
We are using the v0.1.6.
First, we tried to require the 'node-rfc-master'.
We noticed, after early testing, that the index.js file (inside the node-rfc-master folder) was referring to a non existing path and received a 'Could not load module' in the console(err.code==='MODULE_NOT_FOUND').
So we changed it to './lib/windows_x64/rfc-6.9.1', as we are using a 64x windows machine,
but we got a new error object where err.code === undefined and the a console.log of 'Error loading module - (may SAP RFC library in path not set?) Error: The specified module could not be found, followed by the path to the existing 'rfc-6.9.1.node' file.
We also tried to require 'rfc-6.9.1.node' directly and got the same error object.

We did both extend PATH and set SAPNWRFC_HOME variables to the lib folder of nwrfcsdk.
node -v
v6.9.1.

Thank you in advance,
Ben

BAPI_PO_GETDETAIL1 call takes 15 seconds!

Calling the BAPI_PO_GETDETAIL1 using the node-rfc lib takes about 15 seconds to run.
I ran a system trace (ST05) which is attached, and saw that most of the "heavy lifting" is done in entries like this:

13:41:35.739 218.371 SAPLSYST DESKTOP-I432GMN Server 0 0 0 DESKTOP-I432GMN erpides_IDS_00 Server RFC_GET_FUNCTION_INTERFACE 2180 394

It seems the node-rfc library calls a lot of descriptor functions to describe the requested function's API. Is this true? Is this needed? Can this be optimized?

1.txt

Clustered table

Hi, @bsrdjan!
I used node-rfc to get the data of the clustered table. Data received in Uint8Array(). Is there a way to further decode this data?
I use FM application_data_get.

thanks,

Parallel requests fail

When I try to run two function calls at the same time I get the following error:

{ [Error:
ERROR       program state check for conversation 69481959
TIME        Mon Aug 15 14:29:05 2016
RELEASE     721
COMPONENT   CPIC (TCP/IP) with Unicode
VERSION     3
RC          471
MODULE      r3cpic.c
LINE        6078
DETAIL      called function STSEND in state state=BUFFER_DATA2
COUNTER     1
] code: 1, key: 'RFC_COMMUNICATION_FAILURE' }
{ [Error: Invalid RFC connection handle: 50880736] code: 13, key: 'RFC_INVALID_H
ANDLE' }

Does that mean I need to create a new client for each function call if I want to do it in paralell?

the second value "true"

var client = new rfc.Client(connParams, true);
What Is responsible the second value "true"?

support install on windows without manual editing

I ran into 2 small issues when trying to install/use this on windows (via git bash), forcing me to edit the sources before npm install. With a couple of changes, manual editing can be avoided:

  1. binding.gyp:

"msvs_nwrfcsdk_path": "$(SAPNWRFC_HOME)",

this works on windows, at least under git bash, and matches what you do on linux
2. index.js:
before the require(plattformPath)

plattformPath += '-' + require('process').version;

to match the versioned "target_name" in binding.gyp

Question - Use of node-rfc with HANA Cloud Connector

Hi experts,

We were hoping that you could help us with some questions we have around the usage of this library and some more generic questions around the usage of SAP HANA Cloud connector and destinations.

We have deployed a nodejs app using the SAP HANA Cloud Platform, Starter Edition for Cloud Foundry Services (Beta). We have also installed and configured the cloud connector on our on-premise ABAP system and corresponding settings on HCP. We would now like to call the RFCs on the ABAP backend from our nodejs app.

Questions:

  1. Is it possible to consume the connector destinations directly from our nodejs app? There is a JCo API for Java applications but we could not find any documentation to use the connector destinations from nodejs.

  2. Using the node-rfc library, what is the relation to the HANA Cloud connector? Can this library be used in combination with the connector or will this establish a direct connection to the ABAP system i.e. the connector is actually bypassed?

  3. How can the NWGW SDK (prerequisit) be deployed/installed within the cloud foundary instance? Do we need to SSH into the instance and do this manually or is there an automated way to do this?

Thank you very much.

Best regards, Nils

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.