How to use node-rfc - 5 common examples

To help you get started, we’ve selected a few node-rfc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / node-rfc / examples / js / promises.js View on Github external
'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);
github SAP / node-rfc / examples / ts / async.ts View on Github external
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);
	}
})();
github SAP / devops-docker-images / node-rfc / run_rfc_task.js View on Github external
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();
github sbcgua / sap-nw-abap-vagrant / certinst.js / certinst.js View on Github external
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;
}
github SAP / node-rfc / examples / js / pool.js View on Github external
'use strict';

const Pool = require('node-rfc').Pool;

const abapSystem = require('./abapSystem').DSP;

const pool = new Pool(abapSystem);

pool.acquire()
    .then(client => {
        client
            .call('STFC_CONNECTION', { REQUTEXT: 'H€llö SAP!' })
            .then(res => {
                console.log('STFC_CONNECTION call result:', res.ECHOTEXT);
                console.log(pool.status);
                pool.release(client);
                console.log(pool.status);
            })
            .catch(err => {
                console.error('Error invoking STFC_CONNECTION:', err);
            });
    })
    .catch(err => {

node-rfc

nodejs bindings for SAP NW RFC SDK

Apache-2.0
Latest version published 10 months ago

Package Health Score

59 / 100
Full package analysis

Popular node-rfc functions