Git Product home page Git Product logo

node-sapnwrfc's Introduction

SAP Netweaver RFC SDK Bindings for Node.js

Build status Circle CI npm version

Description

This module provides bindings to the SAP Netweaver RFC SDK. With it, you will be able to call remote enabled function modules of a SAP system. Opening the connection and function invocations are fully/partially asynchronous operations, which will call a callback function upon completion.

Preparation

Note: In order to use this module you will have to obtain the SAP NW RFC SDK via http://service.sap.com. For further instructions see OSS note 1025361.

Linux

  • Extract the SDK archive with SAPCAR
  • Copy the files from the lib and include folders to the corresponding system directories (/usr/local/Lib /usr/local/include)
./SAPCAR_3-20002089.EXE -xf NWRFC_8-20004549.SAR
cd nwrfcsdk
cp ./lib/* /usr/lib
cp ./include/* /usr/inlude

Windows

  • Extract the SDK archive with SAPCAR
  • Copy the files from the lib folder to C:\Windows\system32
  • Warning: If you are working with NodeJS 32-bit on a Windows 64-bit OS, you should copy the files to C:\Windows\SysWOW64 instead.

OS X

OS X is not supported due to the fact that there is no suitable SAP RFC NW SDK available. The module will compile but fail when trying to lazy-load its dependencies.

Installation (both Linux and Windows)

  • You may now download the addon from the npm registry and install it by using the npm command.
npm install sapnwrfc

Usage

As with all other Node.js modules, you need to require it:

var sapnwrfc = require('sapnwrfc');

Connection parameters

Connection parameters have to be specified using a JavaScript object. For a complete list of possible parameters, refer to the SAP NetWeaver RFC SDK Guide which is available via SAP Connectors.

Example:

var conParams = {
  ashost: '192.168.0.10',
  sysid: 'NPL',
  sysnr: '42',
  user: 'DEVELOPER',
  passwd: 'password',
  client: '001',
  lang: 'E'
};

Set path to sapnwrfc.ini

Before you open a connection you can set the directory path to look for the sapnwrfc.ini file.

Example:

var con = new sapnwrfc.Connection;
var iniPath = '/path/to/dir/with/inifile/in/it'

con.SetIniPath(iniPath);

Opening the connection

Before you can invoke a remote function, you will have to open a connection to the SAP system.

Connection.Open( connectionParameters, callback( errorObject ) );
  • connectionParameters: JavaScript object containing the parameters used for connecting to a SAP system (see above)
  • callback: A function to be executed after the connection has been attempted. In case of an error, an errorObject will be passed as an argument.
versionInfo = Connection.GetVersion( );
  • versionInfo: An Array containing major number, minor number and patch level of the NW RFC SDK

Example:

var con = new sapnwrfc.Connection;

con.Open(conParams, function(err) {
  if (err) {
    console.log(err);
    return;
  }
  console.log('sapnwrfc: ' + con.GetVersion());
});

Calling a remote function module

This is a two step process:

  • You will first have to lookup the function module's definition, getting a Function object in return
  • After a successful lookup, you may invoke the function and pass arguments to it

However, you can use the Function object subsequently multiple times for invocations, without having to do another lookup upfront.

functionObject = Connection.Lookup( functionModuleName )
  • functionModuleName: A string containing the name of the remote function module to be called
  • functionObject: A JavaScript object (class name: Function) which represents an interface to invoke the function
Function.Invoke( functionParameters, callback( errorObject, result ) )
  • functionParameters: JavaScript object containing the parameters used for connecting to a SAP system (see above)
  • callback: A function to be executed after the connection has been attempted. In case of an error, an errorObject will be passed as an argument. The result will be returned as a JavaScriptObject (see below for details)

For the sake of simplicity, the following example will neither pass arguments to the remote function nor receive a result:

var func = con.Lookup('RFC_PING');
func.Invoke({ }, function(err, result) {
  console.log('Got pong!');
});

Passing and receiving arguments

Remote function arguments are being passed by using a plain JavaScript object. For each parameter to pass in, you'll have to define a member property named according to the remote function's interface. There is no need to distinguish between importing, exporting or table parameters.

Primitives

Assigning primitive types (non-structures, non-tables) is straightforward. You will, however, have to take care that the argument matches the parameter's data type. E.g. if the parameter type is an integer, you may not assign a string value to it.

Example:

var params = {
  QUESTION: 'How are you'
};

var func = con.Lookup('STFC_STRING');
func.Invoke(params, function(err, result) {
  if (err) {
    console.log(err);
    return;
  }

  console.log(result);
});

Binary data

SAP data types like XSTRING and RAW need some special treatment as JavaScript does not support binary data very well. In order to safely pass binary data back and forth, you will have to use Node Buffers. This, of course, also holds true for binary data types used within structures and tables.

Example:

var func = con.Lookup('STFC_XSTRING');
var params = { QUESTION: new Buffer('00FF65', 'hex') };

func.Invoke(params, function (err, result) {
  console.log(result); // => <Buffer de ad>
});

Structures

Structures are represented by JavaScriptObjects, where each field corresponds to a member property.

Example:

var params = {
  IMPORTSTRUCT: { RFCFLOAT: 3.14159, RFCINT1: 123, RFCTIME: '094500', RFCCHAR4: 'NODE' }
};

var func = con.Lookup('STFC_STRUCTURE');
func.Invoke(params, function(err, result) {
  if (err) {
    console.log(err);
    return;
  }

  console.log(result);
});

Tables

A table is nothing else than an array of structures. This means, in terms of JavaScript, that you need to put JavaScript objects into an array.

Example:

var table = [
  { I: 1, C: 'A', STR: 'String1' },
  { I: 2, C: 'B', STR: 'String2' },
  { I: 3, C: 'C', STR: 'String3' }
];

var params = {
  IMPORT_TAB: table
};

var func = con.Lookup('STFC_DEEP_TABLE');
func.Invoke(params, function(err, result) {
  if (err) {
    console.log(err);
    return;
  }

  for (var i = 0; i < result.EXPORT_TAB.length; i++) {
    console.log('Row ' + (i + 1) + ':');
    console.log(result.EXPORT_TAB[i]);
  }
  console.log(result.RESPTEXT);
});

Retrieving function signature as JSON Schema

You can retrieve the name and types of remote function arguments with MetaData() call.

Example:

var func = con.Lookup('STFC_STRING');
var signature = func.MetaData();
console.log(JSON.stringify(signature, null, 2));

The console output is:

{
  "title": "Signature of SAP RFC function STFC_STRING",
  "type": "object",
  "properties": {
    "MYANSWER": {
      "type": "string",
      "length": "0",
      "sapType": "RFCTYPE_STRING",
      "description": "",
      "sapDirection": "RFC_EXPORT"
    },
    "QUESTION": {
      "type": "string",
      "length": "0",
      "sapType": "RFCTYPE_STRING",
      "description": "",
      "sapDirection": "RFC_IMPORT"
    }
  }
}

The result of function MetaData() is an object of JSON Schema.

The properties sub-object specifies the parameter of the remote function. In the above example the remote function STFC_STRING has the parameters MYANSWER and QUESTION. The sapDirection specifies if it is an input parameter (RFC_IMPORT) or output parameter (RFC_EXPORT) or input and/or output (RFC_CHANGING | RFC_TABLES).

Attributes with the prefix sap are specific to this JSON Schema instance.

  • title: Name of the JSON Schema.
  • type: JavaScript type.
  • length: Length of a simple type or structure.
  • description: Description of parameters from SAP. Can be empty.
  • sapType: Native SAP type. RFCTYPE_TABLE | RFCTYPE_STRUCTURE | RFCTYPE_STRING | RFCTYPE_INT | RFCTYPE_BCD | RFCTYPE_FLOAT | RFCTYPE_CHAR | RFCTYPE_DATE | RFCTYPE_TIME | RFCTYPE_BYTE | RFCTYPE_NUM | ... . You find the complete list of possible values in the SAP header file sapnwrfc.h. Look for enum type RFCTYPE.
  • sapDirection: Attribute of the first level of properties. RFC_IMPORT | RFC_EXPORT | RFC_CHANGING | RFC_TABLES
  • sapTypeName: Name of a structure or name of a structure of a table.

Contributors

  • Alfred Gebert
  • Stefan Scherer
  • Michael Scherer
  • Szilard Novaki
  • Jakub Zakrzewski
  • Alex
  • LeandroDG

Changelog

0.2.0 (2015-11-11)

  • Add SetIniPath
  • RAW fields and XSTRINGs return/expect node Buffers

0.1.8 (2015-11-02)

  • Automatic builds for Linux and Windows
  • Add tests
  • Bugfixes

0.1.7 (2015-11-01)

  • Add gulp script for bulk compiling

0.1.6 (2015-11-01)

  • Support for Node.js 4.x (and io.js)
  • Fix library path issue (Windows)
  • Add parameter msvs_nwrfcsdk_path for node-gyp
  • Add MetaData()

0.1.5 (2013-05-25)

  • Support for Node.js 0.10

0.1.4 (2013-02-09)

  • Fix compilation on Linux (issue #2)

0.1.3 (2012-08-16)

  • Support for Node.js >= 0.7.9
  • Change global invocation lock to a connection based lock

TODO

  • Unit tests
  • Missing but probably useful functions:
    • RfcIsConnectionHandleValid (aka Connection::IsOpen())
    • RfcRemoveFunctionDesc (invalidate cache)
    • RfcGetPartnerSSOTicket
  • Use of buffers for xstring
  • Event emission on disconnect

License

(The MIT License)

Copyright (c) 2011-2012 Joachim Dorner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-sapnwrfc's People

Contributors

agebert avatar frankseeger avatar hyp avatar jdorner avatar jzakrzewski avatar leandrodg avatar novaki avatar scherermichael avatar stefanscherer 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

Watchers

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

node-sapnwrfc's Issues

Async and streaming read of table results

The function module I call returns a huge table. For performance reasons, I don't want to keep that table in the memory. Also, I don't want to wait until the whole table is read, I'd like to process the table row-by-row as received.

It would be really nice if table were not converted to array immediately, but it would be a nodejs stream in object mode.

I presume RfcGetCurrentRow (in SAP NW RFC) retrieves table row from the server and not from prefetched local copy, otherwise this FR is obsolete.

Time Out method

Hi, I am trying to extend time out on my node application for SAP using this Module, but i couldnt find any. Can you expose Timeout function?

RAW fields encoding issue in invocation result

Hello, we are using the module to connect to a SAP instance. After invoking a function and inspecting the result, we noticed that for fields of type "RAW" the returned value is not the expected one.
We get for example J*�㾀�� instead of 4A2ADF0FE3BE80D8E10080000A6627E7. Maybe raw fields in result should be Base64 encoded.
Thanks,
Sole

Problems compiling the module

Hi,

I get the following Error messages when I try to install the Module.
I already copied the nwrfcsdk directory in the sapnwrfc module directory because he couldn't find the include file otherwise.

C:\Project\Path\node_modules\sapnwrfc>npm i --python=python2

> [email protected] install C:\Project\Path\node_modules\sapnwrfc
> node preinstall.js


C:\Project\Path\node_modules\sapnwrfc>node "C:\Chocolatey\lib\nodist.0.4.6-beta\tools\nodist-master\bin\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean
[Error: no errorC:\Project\Path\node_modules\sapnwrfc\compiled\0.10\win32\ia32\sapnwrfc.node]
error a precompiled module could not be found or loaded
info trying to compile it...

C:\Project\Path\node_modules\sapnwrfc>node "C:\Chocolatey\lib\nodist.0.4.6-beta\tools\nodist-master\bin\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.
  binding.cc
  Connection.cc
  Function.cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++-Handler verwendet, aber Entladesemantik ist nicht aktiviert. Geben Sie /EHsc an. (..\src\Function.cc) [C:\Project\Path\node_modules\sapnwrfc\
build\sapnwrfc.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++-Handler verwendet, aber Entladesemantik ist nicht aktiviert. Geben Sie /EHsc an. (..\src\Connection.cc) [C:\Project\Path\node_modules\sapnwrf
c\build\sapnwrfc.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++-Handler verwendet, aber Entladesemantik ist nicht aktiviert. Geben Sie /EHsc an. (..\src\binding.cc) [C:\Project\Path\node_modules\sapnwrfc\b
uild\sapnwrfc.vcxproj]
..\src\Function.cc(538): warning C4018: '>': Konflikt zwischen 'signed' und 'unsigned' [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
..\src\Function.cc(561): warning C4018: '>': Konflikt zwischen 'signed' und 'unsigned' [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
..\src\Function.cc(584): warning C4018: '>': Konflikt zwischen 'signed' und 'unsigned' [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(1186,5): warning MSB8012: TargetPath(..\Release\sapnwrfc.node) does not match the Linker's OutputFile property value (C:\Project\Path\node_modules\sapnwrfc
\build\Release\sapnwrfc.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:\Users\schmale\workspace\UO Ec
o Base\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
     Bibliothek "C:\Project\Path\node_modules\sapnwrfc\build\Release\sapnwrfc.lib" und Objekt "C:\Project\Path\node_modules\sapnwrfc\build\Release\sapnwrfc.exp" werden erstellt.
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetVersion@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcIsConnectionHandleValid@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcPing@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcUTF8ToSAPUC@24". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcCloseConnection@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Connection.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcOpenConnection@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetTable@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcInvoke@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetRowCount@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcDescribeType@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetTime@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetFunctionDesc@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcMoveTo@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetStructure@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcCreateFunction@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetFieldCount@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetNum@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcDestroyFunction@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetParameterCount@12". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetString@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetBytes@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetInt@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetDate@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetBytes@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetInt1@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetChars@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetInt2@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetFloat@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetFloat@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetParameterDescByIndex@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetChars@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetInt1@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetFieldDescByIndex@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetStringLength@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetXString@24". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcAppendNewRow@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetDate@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetInt2@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetInt@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetParameterActive@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetCurrentRow@8". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetTime@16". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetString@24". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcGetNum@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.obj : error LNK2001: Nicht aufgel÷stes externes Symbol "_RfcSetXString@20". [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Release\sapnwrfc.node : fatal error LNK1120: 45 nicht aufgel÷ste Externe [C:\Project\Path\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Chocolatey\lib\nodist.0.4.6-beta\tools\nodist-master\bin\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Chocolatey\\lib\\nodist.0.4.6-beta\\tools\\nodist-master\\bin\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Project\Path\node_modules\sapnwrfc
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

Node 4.x support?

I just want to ping and ask if and when the latest commit will be published on npm?
I've compiled it with Node 4.2.0 on Linux and it seems to work.

Can't build on Ubuntu 12.04 and node.js v0.10.41

Unable to build binding on Ubuntu 12.04 and node.js v0.10.41.

Steps Taken For First Attempt

  • Extracted the NW GW SDK archive with SAPCAR
  • Copied the files from the lib and include folders to the corresponding system directories (/usr/local/Lib /usr/local/include)
./SAPCAR_3-20002089.EXE -xf NWRFC_8-20004549.SAR
cd nwrfcsdk
cp ./lib/* /usr/lib
cp ./include/* /usr/inlude

Second Attempt
Added sdk files to the sapnwrfc directory under our project.
ran npm rebuild sapnwrfc

Received the following error for both attempts:

> [email protected] install /app_dir/node_modules/sapnwrfc
> node preinstall.js

>{ [Error: Could not locate the bindings file. Tried:
→ /app_dir/node_modules/sapnwrfc/build/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/build/Debug/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/build/Release/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/out/Debug/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/Debug/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/out/Release/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/Release/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/build/default/sapnwrfc.node
 → /app_dir/node_modules/sapnwrfc/compiled/0.10/linux/x64/sapnwrfc.node]
  tries:
   [ '/app_dir/node_modules/sapnwrfc/build/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/build/Debug/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/build/Release/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/out/Debug/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/Debug/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/out/Release/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/Release/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/build/default/sapnwrfc.node',
     '/app_dir/node_modules/sapnwrfc/compiled/0.10/linux/x64/sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...
make: Entering directory `/app_dir/node_modules/sapnwrfc/build'
  CXX(target) Release/obj.target/sapnwrfc/src/binding.o
In file included from ../src/Connection.h:28:0,
                 from ../src/binding.cc:28:
../src/Common.h:30:22: fatal error: sapnwrfc.h: No such file or directory
compilation terminated.
make: *** [Release/obj.target/sapnwrfc/src/binding.o] Error 1
make: Leaving directory `/app_dir/node_modules/sapnwrfc/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ubuntu/nodejs/node0.10.41/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.8.0-44-generic
gyp ERR! command "node" "/home/ubuntu/nodejs/node0.10.41/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /app_dir/node_modules/sapnwrfc
gyp ERR! node -v v0.10.41
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
[email protected] /app_dir/node_modules/sapnwrfc

The following is the tree for our sapnwrfc directory:

$ tree -L 2 /app_dir/node_modules/sapnwrfc
├── bin
│   ├── desktop.ini
│   ├── rfcexec
│   └── startrfc
├── binding.gyp
├── build
│   ├── binding.Makefile
│   ├── config.gypi
│   ├── Makefile
│   ├── Release
│   └── sapnwrfc.target.mk
├── circle.yml
├── compiled
│   ├── 4.0
│   ├── 4.1
│   ├── 4.2
│   └── 5.0
├── demo
│   ├── companyClient.c
│   ├── desktop.ini
│   ├── readme.txt
│   ├── rfcexec.cpp
│   ├── rfcexec.h
│   ├── sapnwrfc.ini
│   ├── sflightClient.c
│   ├── sso2sample.c
│   ├── startrfc.cpp
│   ├── startrfc.h
│   └── stfcDeepTableServer.c
├── desktop.ini
├── doc
│   └── desktop.ini
├── examples
│   └── example1.js
├── gulpfile.js
├── include
│   ├── desktop.ini
│   ├── sapdecf.h
│   ├── sapnwrfc.h
│   ├── sapuc.h
│   └── sapucx.h
├── lib
│   ├── desktop.ini
│   ├── libicudata.so.34
│   ├── libicudecnumber.so
│   ├── libicui18n.so.34
│   ├── libicuuc.so.34
│   ├── libsapnwrfc.so
│   └── libsapucum.so
├── LICENSE
├── node_modules
│   ├── bindings
│   └── nan
├── package.json
├── preinstall.js
├── README.md
├── sapnwrfc.js
├── src
│   ├── binding.cc
│   ├── Common.h
│   ├── Connection.cc
│   ├── Connection.h
│   ├── Function.cc
│   └── Function.h
└── tests
    ├── offline.js
    └── testSetIniPath.js

Compiling on Debian

Node version: 0.8.19
OS: Debian 6
Extracted NW RFC SDK 7.20, moved folders to appropriate places

npm install sapnwrfc

error a precompiled module could not be found or loaded
info trying to compile it...
make: Entering directory `/home/tony/Desktop/projects/nwrfc/node_modules/sapnwrfc/build'
sapnwrfc.target.mk:134: warning: overriding commands for target `Release/sapnwrfc.node'
sapnwrfc.target.mk:124: warning: ignoring old commands for target `Release/sapnwrfc.node'
make: Circular Release/sapnwrfc.node <- Release/sapnwrfc.node dependency dropped.
  CXX(target) Release/obj.target/sapnwrfc/src/binding.o
  CXX(target) Release/obj.target/sapnwrfc/src/Connection.o
  CXX(target) Release/obj.target/sapnwrfc/src/Function.o
  COPY Release/sapnwrfc.node
cp: cannot stat `FORCE_DO_CMD': No such file or directory
make: *** [Release/sapnwrfc.node] Error 1
make: Leaving directory `/home/tony/Desktop/projects/nwrfc/node_modules/sapnwrfc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:255:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Linux 3.2.0-4-amd64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/tony/Desktop/projects/nwrfc/node_modules/sapnwrfc
gyp ERR! node -v v0.8.19
gyp ERR! node-gyp -v v0.8.4
gyp ERR! not ok 

NPM Install Compile Error

I am trying to install sapnwrfc and am getting the error below. I see other similar issues that were closed but not sure what was done to resolve the issue. I am running on Windows 2012 x64, Node 5.2, JDK 8u66 with VS 2015.

Any help is appreciated!

C:\Boelter Applications\BoelterIntegrationServer>npm install sapnwrfc

[email protected] install C:\Boelter Applications\BoelterIntegrationServer\node_m
odules\sapnwrfc
node preinstall.js

C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc>if not de
fined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\no
de-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node cl
ean )
{ [Error: Could not locate the bindings file. Tried:
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\build
sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\build
Debug\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\build
Release\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\out\De
bug\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\Debug
sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\out\Re
lease\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\Releas
e\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\build
default\sapnwrfc.node
→ C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc\compil
ed\5.2\win32\x64\sapnwrfc.node]
tries:
[ 'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\build\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\build\Debug\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\build\Release\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\out\Debug\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\Debug\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\out\Release\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\Release\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\build\default\sapnwrfc.node',
'C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc
\compiled\5.2\win32\x64\sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...

C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnwrfc>if not de
fined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\no
de-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node
rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
binding.cc
Connection.cc
c:\boelter applications\boelterintegrationserver\node_modules\sapnwrfc\src\Comm
on.h(30): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such fi
le or directory (compiling source file ..\src\Connection.cc) [C:\Boelter Applic
ations\BoelterIntegrationServer\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
Function.cc
c:\boelter applications\boelterintegrationserver\node_modules\sapnwrfc\src\Comm
on.h(30): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such fi
le or directory (compiling source file ..\src\binding.cc) [C:\Boelter Applicati
ons\BoelterIntegrationServer\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
c:\boelter applications\boelterintegrationserver\node_modules\sapnwrfc\src\Comm
on.h(30): fatal error C1083: Cannot open include file: 'sapnwrfc.h': No such fi
le or directory (compiling source file ..\src\Function.cc) [C:\Boelter Applicat
ions\BoelterIntegrationServer\node_modules\sapnwrfc\build\sapnwrfc.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules
npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:88:13)
gyp ERR! stack at ChildProcess.emit (events.js:173:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:201:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Boelter Applications\BoelterIntegrationServer\node_modules\sapnw
rfc
gyp ERR! node -v v5.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
[email protected] C:\Boelter Applications\BoelterIntegrationServer
└── [email protected] extraneous

C:\Boelter Applications\BoelterIntegrationServer>

Collaboration?

I am the author of another open source node rfc connector and wonder if we could evenrually join forces and collaborate somehow? If sounds interesting my pm is in my gh profile.

Connection count limited to 4

I spent some time figuring out why this module would only allow 4 concurrent Connections. It turns out that the underlying libuv threading library has a default concurrency setting of 4. See http://docs.libuv.org/en/v1.x/threadpool.html
You can change the number of concurrent SAP connections by setting export UV_THREADPOOL_SIZE=<newsize>

I would argue that we either document this in the README, or somehow set the environment variable during execution/invocation of the gyp bindings.

clear cache MetaData

Hi,
i'd like to add the functionnality to remove metadata each time after the result.

Do you have made the call to the function : RfcRemoveFunctionDesc ?

I tried at the end of invoke function but i get a segmentation fault.
RFC_ABAP_NAME functionName;
rc = RfcGetFunctionName(self->functionDescHandle, functionName, &errorInfo);
if (rc != RFC_OK) {
RETURN_RFC_ERROR(errorInfo);
}
rc = RfcRemoveFunctionDesc((const SAP_UC*)sysID, (const SAP_UC)*functionName, &errorInfo);
if (rc != RFC_OK) {
RETURN_RFC_ERROR(errorInfo);
}

Thankyou for your helping

Error on running test

Hi Joachim,
I have a win7 pc. I installed node version v0.10.2. I copied the files to windows/system32 in the lib folder of nwrfcsdk 7.10. When I run the example bindings throws following errors;


C:\MyWeb\crud>node sap_test1.js

C:\MyWeb\crud\node_modules\sapnwrfc\node_modules\bindings\bindings.js:85
throw err
^
Error: Could not load the bindings file. Tried:
-> C:\MyWeb\crud\node_modules\sapnwrfc\build\Debug\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\build\Release\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\out\Debug\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\Debug\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\out\Release\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\Release\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\build\default\sapnwrfc.node
-> C:\MyWeb\crud\node_modules\sapnwrfc\compiled\0.10\win32\x64\sapnwrfc.node
at bindings (C:\MyWeb\crud\node_modules\sapnwrfc\node_modules\bindings\bindi
ngs.js:82:13)
at Object. (C:\MyWeb\crud\node_modules\sapnwrfc\sapnwrfc.js:1:99)

at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\MyWeb\crud\sap_test1.js:19:16)
at Module._compile (module.js:456:26)

I have copied sapnwrfc.node in node_modules\sapnwrfc\compiled\0.8\win32\ia32\sapnwrfc.node to the node_modules\sapnwrfc\Release folder and tried again. That time bindings throws different errors.

C:\MyWeb\crud>node sap_test1.js

C:\MyWeb\crud\node_modules\sapnwrfc\node_modules\bindings\bindings.js:77
throw e
^
Error: no errorC:\MyWeb\crud\node_modules\sapnwrfc\Release\sapnwrfc.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (C:\MyWeb\crud\node_modules\sapnwrfc\node_modules\bindings\bindi
ngs.js:72:15)
at Object. (C:\MyWeb\crud\node_modules\sapnwrfc\sapnwrfc.js:1:99)

at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

Do you recommend me any thing to recover the problem? Thank you.

Problem installing sapnwrfc

Hi,
i'm having problem installing package sapnwrfc.
I'm using:

  • Windows 10 pro,
  • node v8.9.3,
  • SAP NW RFC SDK 7.20.
    The steps I have followed are:
  1. download sap nw rfc sdk 7.20 from Sap support Portal
  2. Decompress the file with SAPCAR (even this one downloaded from Sap Portal)
  3. Copy the files in: \nwrfcsdk\lib to c:\windows\System32
  4. Create my project in C:\MY_PROJECT
  5. In command prompt: CD c:\my_project
  6. run the command: node install sapnwrfc. Then I have the error log below

I have tried some suggestions from other issues but without success. Can anyone, please, describe the right procedure? Thank you very much.


C:\my_project>npm install sapnwrfc

[email protected] install C:\my_project\node_modules\sapnwrfc
node preinstall.js

C:\my_project\node_modules\sapnwrfc>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node "" clean )
{ Error: Could not locate the bindings file. Tried:
→ C:\my_project\node_modules\sapnwrfc\build\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\build\Debug\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\build\Release\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\out\Debug\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\Debug\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\out\Release\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\Release\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\build\default\sapnwrfc.node
→ C:\my_project\node_modules\sapnwrfc\compiled\8.9\win32\x64\sapnwrfc.node
at bindings (C:\my_project\node_modules\bindings\bindings.js:93:9)
at ChildProcess.rebuild (C:\my_project\node_modules\sapnwrfc\preinstall.js:25:39)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
tries:
[ 'C:\my_project\node_modules\sapnwrfc\build\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\build\Debug\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\build\Release\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\out\Debug\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\Debug\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\out\Release\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\Release\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\build\default\sapnwrfc.node',
'C:\my_project\node_modules\sapnwrfc\compiled\8.9\win32\x64\sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...

C:\my_project\node_modules\sapnwrfc>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Francisco\Documents\JavaScript_PHP_Training\JavaScript\Python Software", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\my_project\node_modules\sapnwrfc
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'C:\my_project\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\my_project\package.json'
npm WARN my_project No description
npm WARN my_project No repository field.
npm WARN my_project No README data
npm WARN my_project No license field.

Could not load the bindings file

Hi,
I have tried installing sapnwrfc in my linux 64 bit machine. But I am not able to install it. I have got the SAP SDK file of version 7.20 and also I copied the files from "lib" folder to /usr/lib and "include" folder to /usr/include. Then I tried to install module using "npm install sapnwrfc". But I got the below given error. Please help me to fix this issue:

npm http GET https://registry.npmjs.org/sapnwrfc
npm http 304 https://registry.npmjs.org/sapnwrfc
npm http GET https://registry.npmjs.org/bindings/0.3.0
npm http 304 https://registry.npmjs.org/bindings/0.3.0

[email protected] install /usr/node_modules/sapnwrfc
node preinstall.js

{ [Error: Could not load the bindings file. Tried:
-> /usr/node_modules/sapnwrfc/build/Debug/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/build/Release/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/out/Debug/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/Debug/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/out/Release/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/Release/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/build/default/sapnwrfc.node
-> /usr/node_modules/sapnwrfc/compiled/0.10/linux/x64/sapnwrfc.node]
tries:
[ '/usr/node_modules/sapnwrfc/build/Debug/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/build/Release/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/out/Debug/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/Debug/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/out/Release/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/Release/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/build/default/sapnwrfc.node',
'/usr/node_modules/sapnwrfc/compiled/0.10/linux/x64/sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...
make: Entering directory /usr/node_modules/sapnwrfc/build' CXX(target) Release/obj.target/sapnwrfc/src/binding.o CXX(target) Release/obj.target/sapnwrfc/src/Connection.o CXX(target) Release/obj.target/sapnwrfc/src/Function.o ../src/Function.cc: In member function âv8::Handle<v8::Value> Function::NumToExternal(CHND, const SAP_UC*, v8::Handle<v8::Value>, unsigned int)â: ../src/Function.cc:538:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (valueU16.length() > len) { ^ ../src/Function.cc: In member function âv8::Handle<v8::Value> Function::CharToExternal(CHND, const SAP_UC*, v8::Handle<v8::Value>, unsigned int)â: ../src/Function.cc:561:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (valueU16.length() > len) { ^ ../src/Function.cc: In member function âv8::Handle<v8::Value> Function::ByteToExternal(CHND, const SAP_UC*, v8::Handle<v8::Value>, unsigned int)â: ../src/Function.cc:584:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (valueAscii.length() > len) { ^ SOLINK(target) Release/obj.target/sapnwrfc.node /usr/bin/ld: cannot find -lsapnwrfc /usr/bin/ld: cannot find -lsapucum collect2: error: ld returned 1 exit status make: *** [Release/obj.target/sapnwrfc.node] Error 1 make: Leaving directory/usr/node_modules/sapnwrfc/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.13.0-48-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/node_modules/sapnwrfc
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
[email protected] node_modules/sapnwrfc
âââ [email protected]

FATAL ERROR: EscapeableHandleScope::Escape Escape value set twice

Hi experts,

I am using this library to connect from nodejs to SAP. I am getting above error and nodejs crashes. When I deactivate the call to the rfc service this error does not occur, hence I assume it must have something to do with the library. Did anyone encounter this problem before and potentially have a solution?

System info:

nodejs 5.12
Windows 10
binaries copied from 5.0 to 5.12

Thank you very much.

Addon from the npm registry

You may now download the addon from the npm registry and install it by using the npm command.

Link is not working. Any update on where to download the addon.

Thanks for your help.

sapnwrfc is not installing

I tried npm install sapnwrfc, I have copied sdk lib to system32, I am using windows 7 32 bit os, But i am getting the below error, Please help me on this,

C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc>if not defined npm_co
fig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin
...\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node clean )
{ [Error: Could not locate the bindings file. Tried:
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build\sapnwrfc.nod

→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build\Debug\sapnwr
c.node
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build\Release\sapn
rfc.node
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\out\Debug\sapnwrfc
node
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\Debug\sapnwrfc.nod

→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\out\Release\sapnwr
c.node
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\Release\sapnwrfc.n
de
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build\default\sapn
rfc.node
→ C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\compiled\4.2\win32
ia32\sapnwrfc.node]
tries:
[ 'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build
apnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build
ebug\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build
elease\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\out\De
ug\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\Debug
apnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\out\Re
ease\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\Release
\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\build
efault\sapnwrfc.node',
'C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc\compile
\4.2\win32\ia32\sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...

C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc>if not defined npm_co
fig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin
...\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
binding.cc
Connection.cc
c:\users\323847\appdata\roaming\npm\node_modules\sapnwrfc\src\Common.h(30): fat
al error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directo
ry (..\src\Connection.cc) [C:\Users\323847\AppData\Roaming\npm\node_modules\sap
nwrfc\build\sapnwrfc.vcxproj]
Function.cc
c:\users\323847\appdata\roaming\npm\node_modules\sapnwrfc\src\Common.h(30): fat
al error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directo
ry (..\src\binding.cc) [C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwr
fc\build\sapnwrfc.vcxproj]
c:\users\323847\appdata\roaming\npm\node_modules\sapnwrfc\src\Common.h(30): fat
al error C1083: Cannot open include file: 'sapnwrfc.h': No such file or directo
ry (..\src\Function.cc) [C:\Users\323847\AppData\Roaming\npm\node_modules\sapnw
rfc\build\sapnwrfc.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files\MSBuild\12.0\bin\msbuild.exe failed wi
h exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules
npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proce
s.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\node
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
[email protected] C:\Users\323847\AppData\Roaming\npm\node_modules\sapnwrfc
├── [email protected]
└── [email protected]

Error installing on 64-bit Linux system, RHEL

I tried an npm install on a 64-bit Linux machine running RHEL 5.5 with node 0.12.7 installed and I get an error:

[email protected] install /root/SAPConnector/node_modules/sapnwrfc
node preinstall.js

child_process: customFds option is deprecated, use stdio instead.
{ [Error: Could not load the bindings file. Tried:
-> /root/SAPConnector/node_modules/sapnwrfc/build/Debug/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/build/Release/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/out/Debug/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/Debug/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/out/Release/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/Release/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/build/default/sapnwrfc.node
-> /root/SAPConnector/node_modules/sapnwrfc/compiled/0.12/linux/x64/sapnwrfc.node]
tries:
[ '/root/SAPConnector/node_modules/sapnwrfc/build/Debug/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/build/Release/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/out/Debug/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/Debug/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/out/Release/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/Release/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/build/default/sapnwrfc.node',
'/root/SAPConnector/node_modules/sapnwrfc/compiled/0.12/linux/x64/sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...
make: Entering directory `/root/SAPConnector/node_modules/sapnwrfc/build'
CXX(target) Release/obj.target/sapnwrfc/src/binding.o
/root/.node-gyp/0.12.7/deps/v8/include/v8.h: In function âstd::string convertToString(const v8::Handlev8::Value&)â:
/root/.node-gyp/0.12.7/deps/v8/include/v8.h:816: error: âv8::HandleScope::HandleScope()â is protected
../src/Common.h:41: error: within this context
/root/.node-gyp/0.12.7/deps/v8/include/v8.h: In function âstd::string convertToString(const SAP_UC*)â:
/root/.node-gyp/0.12.7/deps/v8/include/v8.h:816: error: âv8::HandleScope::HandleScope()â is protected
../src/Common.h:55: error: within this context
../src/Common.h:56: error: âNewâ is not a member of âv8::Stringâ
/root/.node-gyp/0.12.7/deps/v8/include/v8.h: In function âv8::Handlev8::Value RfcError(const RFC_ERROR_INFO&)â:
/root/.node-gyp/0.12.7/deps/v8/include/v8.h:816: error: âv8::HandleScope::HandleScope()â is protected
../src/Common.h:82: error: within this context
../src/Common.h:84: error: âNewâ is not a member of âv8::Stringâ
../src/Common.h:87: error: âNewâ is not a member of âv8::Stringâ


Connection recovery after network failure

Hi Joachim,
I use your "sapnwrf" module in a node expressjs web application.
I get an instance of "sapnwrfc.Connection" and use it for all requests for different clients.
Everything goes well until a network connection to SAP system failure.
I check the connection status by using connection.Ping() method and if the connection is not alive I try to reOpen the connection by close() and then Open(). But I get the " WSAETIMEDOUT: Connection timed out" error even if the connection to SAP system is established again.

Do you have any recommendation for handle the connection failure?

Unable to install sapnwrfc on Ubuntu 16.04

austin@analytics:~$ npm install sapnwrfc

[email protected] install /home/austin/node_modules/sapnwrfc
node preinstall.js

{ Error: Could not locate the bindings file. Tried:
→ /home/austin/node_modules/sapnwrfc/build/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/build/Debug/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/build/Release/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/out/Debug/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/Debug/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/out/Release/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/Release/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/build/default/sapnwrfc.node
→ /home/austin/node_modules/sapnwrfc/compiled/6.9/linux/x64/sapnwrfc.node
at bindings (/home/austin/node_modules/bindings/bindings.js:88:9)
at ChildProcess.rebuild (/home/austin/node_modules/sapnwrfc/preinstall.js:25:39)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess.handle.onexit (internal/child_process.js:215:12)
tries:
[ '/home/austin/node_modules/sapnwrfc/build/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/build/Debug/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/build/Release/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/out/Debug/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/Debug/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/out/Release/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/Release/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/build/default/sapnwrfc.node',
'/home/austin/node_modules/sapnwrfc/compiled/6.9/linux/x64/sapnwrfc.node' ] }
error a precompiled module could not be found or loaded
info trying to compile it...
make: Entering directory '/home/austin/node_modules/sapnwrfc/build'
CXX(target) Release/obj.target/sapnwrfc/src/binding.o
CXX(target) Release/obj.target/sapnwrfc/src/Connection.o
CXX(target) Release/obj.target/sapnwrfc/src/Function.o
../src/Function.cc: In static member function ‘static v8::Localv8::Value Function::NewInstance(Connection&, Nan::NAN_METHOD_ARGS_TYPE)’:
../src/Function.cc:59:60: warning: ‘v8::Localv8::Object v8::Function::NewInstance() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Object func = Nan::New(ctor)->NewInstance();
^
In file included from /home/austin/.node-gyp/6.9.1/include/node/v8.h:25:0,
from ../src/Common.h:28,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:3274:52: note: declared here
V8_DEPRECATED("Use maybe version", Local NewInstance() const);
^
/home/austin/.node-gyp/6.9.1/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
../src/Function.cc: In member function ‘v8::Localv8::Value Function::IntToExternal(CHND, const SAP_UC, v8::Localv8::Value)’:
../src/Function.cc:656:37: warning: ‘v8::Localv8::Int32 v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
RFC_INT rfcValue = value->ToInt32()->Value();
^
In file included from ../src/Common.h:28:0,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:8202:14: note: declared here
Local Value::ToInt32() const {
^
../src/Function.cc: In member function ‘v8::Localv8::Value Function::Int1ToExternal(CHND, const SAP_UC_, v8::Localv8::Value)’:
../src/Function.cc:675:43: warning: ‘v8::Localv8::Int32 v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
int32_t convertedValue = value->ToInt32()->Value();
^
In file included from ../src/Common.h:28:0,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:8202:14: note: declared here
Local Value::ToInt32() const {
^
../src/Function.cc: In member function ‘v8::Localv8::Value Function::Int2ToExternal(CHND, const SAP_UC_, v8::Localv8::Value)’:
../src/Function.cc:699:43: warning: ‘v8::Localv8::Int32 v8::Value::ToInt32() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
int32_t convertedValue = value->ToInt32()->Value();
^
In file included from ../src/Common.h:28:0,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:8202:14: note: declared here
Local Value::ToInt32() const {
^
../src/Function.cc: In member function ‘v8::Localv8::Value Function::FloatToExternal(CHND, const SAP_UC_, v8::Localv8::Value)’:
../src/Function.cc:722:40: warning: ‘v8::Localv8::Number v8::Value::ToNumber() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
RFC_FLOAT rfcValue = value->ToNumber()->Value();
^
In file included from ../src/Common.h:28:0,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:8166:15: note: declared here
Local Value::ToNumber() const {
^
../src/Function.cc: In member function ‘v8::Localv8::Value Function::BCDToInternal(CHND, const SAP_UC*)’:
../src/Function.cc:1198:39: warning: ‘v8::Localv8::Number v8::Value::ToNumber() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
return scope.Escape(value->ToNumber());
^
In file included from ../src/Common.h:28:0,
from ../src/Function.h:28,
from ../src/Function.cc:25:
/home/austin/.node-gyp/6.9.1/include/node/v8.h:8166:15: note: declared here
Local Value::ToNumber() const {
^
SOLINK(target) Release/obj.target/sapnwrfc.node
COPY Release/sapnwrfc.node
make: Leaving directory '/home/austin/node_modules/sapnwrfc/build'
/home/austin
`-- [email protected]

npm WARN enoent ENOENT: no such file or directory, open '/home/austin/package.json'
npm WARN austin No description
npm WARN austin No repository field.
npm WARN austin No README data
npm WARN austin No license field.
austin@analytics:~$

austin@analytics:$ node -v
v6.9.1
austin@analytics:
$ npm -v
3.10.8

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.