A node-red node wrapper for node-rfc (SAP Net Weaver Remote Function Call SDK Client).
npm install node-red-contrib-saprfcCurrently in Beta state.
Node-Red (http://nodered.org) nodes for communicating with SAP via node-rfc (https://github.com/SAP/node-rfc).
There are three nodes included:
* call - used to make a remote function or BAPI call.
* read table - query a table. a wrapper for RFC\_READ\_TABLE which allows you to query a table with conditions and returns parsed rows.
* field list - gets the field list of a table. This is a wrapper for RFC\_READ\_TABLE which only gets the field list.
npm install -g node-red-contrib-saprfc
You will need the connection parameters for your SAP system, which can usually be obtained from your SAP GUI Logon.
These nodes will appear in their own "sapRFC" catagory on the Node-Red pallet.
This node sets up a node-rfc connection pool and an async queue which limits the amount of simultaneous connections to 4. In testing, there does not seem to be a performance gain for using more than 4 connections. The queue is processed first in first out.
Use the condense flag to convert the standard output from the RFC to a simple object where each property is the technical name of the table and it's value is the display name.
To use the node, enter the table name and click the _Fetch Fields_ button to get all the fields of the table. Then select the fields you wish to include in the output. You will also want to use a _function_ node pass a structure with additional parameters, such as ROWCOUNT, OPTIONS, etc.
Here is an example function node which builds the import structure:
``javascript
var date = new Date();
msg.payload = {
OPTIONS: ["ERSDA >= '"+date.getFullYear()+""+("0" + (date.getMonth() - 2)).slice(-2)+""+("0" + date.getDate()).slice(-2)+"'"],
ROWCOUNT: 10
}
return msg;
`
You could also specify the table and field list in the input payload instead of configuring them in the GUI:
`javascript`
msg.payload = {
QUERY_TABLE: "MARA",
FIELDS: ["MATNR","ERSDA","ERNAM"],
OPTIONS: ["ERSDA >= '"+date.getFullYear()+""+("0" + (date.getMonth() - 2)).slice(-2)+""+("0" + date.getDate()).slice(-2)+"'"],
ROWCOUNT: 10
}
The __call__ node allows you to call any SAP RFC you would like. Just like the __read table__ node, you must use a _function_ node to build and pass the import parameters.
This example shows how you would build an import structure for _BAPI\_USER\_CHANGE_ to update a user's email address:
`javascript``
msg.payload = {
USERNAME: "SOME_SAP_USER",
ADDRESS: {
E_MAIL: "myemail@company.com"
},
ADDRESSX: {
E_MAIL: "X"
}
}
return msg;
Use these programs at your own risk.
Paul Wieland, https://github.com/PaulWieland
Submit any issues here on github, or ping me @Paul W on the node-red slack channel.