Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const rfcClient = require('node-rfc').Client;
const abapSystem = require('./abapSystem').DSP;
const client = new rfcClient(abapSystem);
client
.open()
.then(() => {
client
.call('STFC_CONNECTION', { REQUTEXT: 'H€llö SAP!' })
.then(res => {
// process results, reuse for the next RFC call
res.ECHOTEXT += '#';
return new Promise(resolve => resolve(res));
})
.then(res => {
client
.call('STFC_CONNECTION', { REQUTEXT: res.ECHOTEXT })
.then(res => {
console.log('STFC_CONNECTION call result:', res.ECHOTEXT);
import { Client } from 'node-rfc';
import { DSP } from './abapSystem';
const client: Client = new Client(DSP);
(async function() {
try {
await client.open();
let result = await client.call('STFC_CONNECTION', { REQUTEXT: 'H€llö SAP!' });
result.ECHOTEXT += '#';
await client.call('STFC_CONNECTION', { REQUTEXT: result.ECHOTEXT });
console.log(result.ECHOTEXT); // 'H€llö SAP!#'
} catch (ex) {
console.error(ex);
}
})();
return new Promise(function(resolve, reject) {
var verbose = gruntContext.options().verbose
var conn = gruntContext.options().conn;
var client = new rfc.Client(conn);
grunt.log.writeln("RFC client lib version:", client.version);
client.connect(function(err) {
if (err) { // check for login/connection errors
grunt.log.errorlns("could not connect to server", err);
return reject();
}
// invoke remote enabled ABAP function module
grunt.log.writeln("Invoking function module", functionModule);
client.invoke(functionModule,
importParameters,
function(err, res) {
if (err) { // check for errors (e.g. wrong parameters)
grunt.log.errorlns("Error invoking", functionModule, err);
return reject();
async function callRfc(fmName, params, isVerbose = false) {
const client = new rfc.Client(abapSystem);
if (isVerbose) console.log('RFC client lib version: ', client.version);
await client.open();
const res = await client.call(fmName, params);
await client.close();
return res;
}