Skip to content

Instantly share code, notes, and snippets.

@softy12
Created April 17, 2018 21:12
Show Gist options
  • Save softy12/5367042c2012dcdf892828e6812a17ec to your computer and use it in GitHub Desktop.
Save softy12/5367042c2012dcdf892828e6812a17ec to your computer and use it in GitHub Desktop.
SAP/node-rfc nodule: usage of table and variable parameters of SAP's BAPI
//demo prg to showcase usage of table and variable parameters of SAP's BAPI while called from nodejs app via SAP/node-rfc nodule
"use strict";
var rfc = require('node-rfc');
var abapSystem = {
user: 'sap_user',
passwd: 'sap_user_pwd',
ashost: 'sap.nodomain',
sysnr: '01',
client: '800'
};
var client = new rfc.Client(abapSystem);
var MAX_ROWS = 3;
var SELECTION_RANGE_str = {
PARAMETER: "USERNAME",
SIGN: "I",
OPTION: "CP",
LOW: "A*"
};
var SELECTION_RANGE_tab = [SELECTION_RANGE_str];
client.connect(function(err) {
if (err) {
return console.error('could not connect to server', err);
}
client.invoke('BAPI_USER_GETLIST', {
MAX_ROWS: MAX_ROWS,
SELECTION_RANGE: SELECTION_RANGE_tab
},
function(err, res) {
if (err) {
return console.error('Error invoking BAPI_USER_GETLIST:', err);
}
console.log('Result BAPI_USER_GETLIST:', res);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment