Below is ABAP program which uses lv_destination
which is RFC Target system for functional module BAPI_COMPANYCODE_GETDETAIL
.
DATA lv_destination TYPE char10.
CASE sy-sysid+2(1).
WHEN 'P'.
lv_destination = 'K0P_040'.
WHEN OTHERS.
lv_destination = 'NONE'.
ENDCASE.
CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'
DESTINATION lv_destination
...
Below is the code of javascript code which uses node-RFC libraries to call and communicate with SAP system.
This is ABAP system connection details and below is complete code to create client and calling connect and invoke method.
Where exactly I need to pass lv_destination
value i.e; RFC Target system in invoke method ?
const abapSystem_EH8 = {
user: '',
passwd: '',
ashost: '',
sysnr: '00',
client: '800',
};
//creating client object
const clientEH8 = new nodeRFC.Client(abapSystem_EH8);
//calling connection method and invoke
clientEH8.connect(function (err) {
if (err)
{
console.error('could not connect to server', err);
addContext(_this, 'could not connect to server', err);
done(err)
}
console.log('After Connect success:');
addContext(_this,'After Connect success:')
clientEH8.invoke('BAPI_COMPANYCODE_GETDETAIL', {
"COMPANYCODEID": "1000",
},
function (err, res)
{
if (err)
{
done(err)
}
clientEH8.close();
done()
});
});
I am trying to pass RFC TARGET system value in invoke method of node-RFC library.