1.1.17 • Published 4 years ago

saprfc v1.1.17

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

SAP RFC

License NPM Version NPM Downloads

Call RFC modules from SAP with Ease. No need for creating SAP Gateway oData services or creating them through SAP API Management If your app has access to the ABAP Backend, just call a Remote Function Module (SE37) directly.

import RFC from 'saprfc'

Simplest call (if no import parameters are needed)

const rfcsys = new RFC('GET_SYSTEM_DATA_RFC')
const xmlsys = await rfcsys.call()
state.system = rfcsys.json(xmlsys)
//state.system results in : {EV_CLIENT: "100", EV_SYSID: "DEV"}

Simple call with parameters

 const rfc = new RFC('Z_MYRFC_USERSEARCH');
 const xml = await rfc.call({ LASTNAME: name })
 const resp = rfc.json(xml);
 state.users = rfc.castToArray( resp.RESULT.item )

ps: the castToArray is necessary for arrays because SAP will return empty arrays as "" and an array with 1 entry as an object. This castToArray will fix this and always return an array

For complex calls you can use javascript

 //give me all users from SAP with some part of a lastname (_name) and between userids 000000 - 999999
 const rfc = new RFC('BAPI_USER_GETLIST');
 const xml = await rfc.call(
    { WITH_USERNAME: "X", 
      USERLIST: { item: [] }, 
      SELECTION_RANGE: { item: 
        [   { PARAMETER: "ADDRESS", FIELD: "LASTNAME", SIGN : "I", OPTION: "CP", LOW: `*${_name}*`}, 
            { PARAMETER: "USERNAME", FIELD: "", SIGN : "I", OPTION: "BT", LOW: "000000", HIGH: "999999"}
        ] 
      } 
    } )
const { USERLIST } = rfc.json(xml);
state.users = rfc.castToArray(USERLIST.item) 
//state.users results in : [ { FULLNAME: "S.A.P. Test", LASTNAME: "Test", USERNAME: "100000" }, .....]  
const root = rfc.getRoot()
const p = root.ele("PARAMETERS");
p.ele("CASEGUID", state.guid );
p.ele("CHANGETIME", state.changetoken );
const r = await rfc.call();

Env var

Set env var VUE_APP_SAPSOAPURI or REACT_APP_SAPSOAPURI to: VUE_APP_SAPSOAPURI=/sap/bc/soap/rfc?sap-client={{your-client-number}}

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago