Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server support integration #236

Closed
wants to merge 339 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
339 commits
Select commit Hold shift + click to select a range
1040a8c
nvm aliases
bsrdjan Nov 12, 2019
0880fce
nvm active version indicator
bsrdjan Nov 12, 2019
454ba1d
Windows build options and warning clean-up
bsrdjan Nov 14, 2019
0258c30
VERSION file removed
bsrdjan Nov 14, 2019
86601c9
Windows build options cleanup
bsrdjan Nov 14, 2019
ddd6048
Windows build options cleanup
bsrdjan Nov 14, 2019
1d89a18
VERSION file removed
bsrdjan Nov 14, 2019
a534e36
release 1.0.3
bsrdjan Nov 14, 2019
fb3f201
documentation
bsrdjan Nov 14, 2019
56846ef
documentation
bsrdjan Nov 14, 2019
55e5cf9
CHANGES
bsrdjan Nov 14, 2019
f1c69e9
documentation
bsrdjan Nov 14, 2019
071dc5b
PATH parser fix: superfluous $ removed
bsrdjan Nov 30, 2019
4977702
AUTHORS file removed
bsrdjan Nov 30, 2019
527ffcb
Build script fix when node headers missing, closes #110
bsrdjan Nov 30, 2019
b93f21e
Fix Linux build error
fredimartins Feb 3, 2020
9c88b95
Windows 32 bit build enabled, fix #124
bsrdjan Mar 2, 2020
31a5256
vscode filter added to gitignore
bsrdjan Mar 6, 2020
2a9c7f5
nvm dependency removed from make script
bsrdjan Mar 6, 2020
ab2438c
README: prerequisites
bsrdjan Mar 6, 2020
43afd38
Documentation, fix #120
bsrdjan Mar 6, 2020
18eeea9
release 1.0.4
bsrdjan Mar 9, 2020
0b4f392
release 1.0.5
bsrdjan Mar 9, 2020
1d55e6e
Merge pull request #123 from fredimartins/patch-1
bsrdjan Mar 16, 2020
cca56ac
README
bsrdjan Mar 17, 2020
03840e5
README
bsrdjan Mar 17, 2020
9de4aaa
Concurrent locking fix for invoke() and ping(), related to #128
bsrdjan Mar 19, 2020
52e473e
Concurrent locking fix for ConnectionInfo(), related to #128
bsrdjan Mar 20, 2020
deea103
ConnectionInfo update for 750 PL6, related to #128
bsrdjan Mar 20, 2020
49ca2a8
Security audit fix by dependencies update; fixes #129
bsrdjan Mar 20, 2020
5e8a331
UTCLONG ABAP datatype support
bsrdjan Mar 26, 2020
8cb3440
New ConnectionInfo attributes added to wrapper class
bsrdjan Mar 27, 2020
14215da
NodeJS deprecation fix DEP0097: MakeCallback with domain property
bsrdjan Mar 27, 2020
0cba3e6
Connection lifecycle: create, open, call, close timestamps
bsrdjan Mar 27, 2020
ced11c7
Unit tests open handles cleanup
bsrdjan Mar 27, 2020
bb24809
Wrapper lib update
bsrdjan Mar 28, 2020
b1f2a66
Refactoring for Throughput
bsrdjan Mar 28, 2020
0b8691d
Pass known string length to wrapString
bsrdjan Mar 28, 2020
a9a85ca
rstrip removed always true; Methods used by both the Client and Throu…
bsrdjan Mar 30, 2020
2d77214
Throughput monitoring, with SAP NWRFC SDK >= 7.53
bsrdjan Mar 31, 2020
3c339b3
release 1.0.6
bsrdjan Mar 31, 2020
6ca96b8
README
bsrdjan Mar 31, 2020
d0c9061
Connection close after fatal errors, related to #128
bsrdjan Apr 2, 2020
ec03040
Unit tests
bsrdjan Apr 2, 2020
969d1e6
Connection close after fatal errors, related to #128
bsrdjan Apr 2, 2020
1640a08
Unit tests refactoring, imprving async tests stability
bsrdjan Apr 2, 2020
9cb2216
Unit tests refactoring, improving async tests stability
bsrdjan Apr 2, 2020
1f81ee8
Unit tests merge conflicts
bsrdjan Apr 3, 2020
2f59a46
Unit tests Lifecycle and setup.client improvements
bsrdjan Apr 6, 2020
7abfcd1
Unit tests Lifecycle
bsrdjan Apr 6, 2020
65d6011
Pool w. JS mutex
bsrdjan Apr 6, 2020
a7a6c9f
Multiple fixes for 1.0.7
bsrdjan Apr 13, 2020
125cba4
Warnings when compiling for Windows IA32 platform, fix #131
bsrdjan Apr 13, 2020
a17e7bf
Unit tests
bsrdjan Apr 13, 2020
c4ca136
Installation fails with NODE_ENV=produciton, fix #122
bsrdjan Apr 14, 2020
38694fe
Unit test fix
bsrdjan Apr 14, 2020
69fbb3f
release 1.1.0
bsrdjan Apr 14, 2020
d525ea6
Client Log unused variables fix
bsrdjan Apr 14, 2020
dd7513e
Reopen connection after fatal errors
bsrdjan Apr 15, 2020
dcfc17b
Server context reset after ABAP exceptions
bsrdjan Apr 16, 2020
8eb5b0a
Pool without connections recycling
bsrdjan Apr 17, 2020
a59c936
Pool without Client instances instead of Client Promises in internal …
bsrdjan Apr 17, 2020
b394c06
release 1.2.0
bsrdjan Apr 18, 2020
50bb2e0
Locking tests cleanup
bsrdjan Apr 18, 2020
ba8cbe3
Unit tests sequencing
bsrdjan Apr 20, 2020
c41772d
Connection attribute PartnerIPv6 added
bsrdjan Apr 29, 2020
07e7534
SAP NWRFC SDK post-installation step removed
bsrdjan May 5, 2020
fd569b2
README Darwin issue
bsrdjan May 7, 2020
3ed20a5
README Darwin issue
bsrdjan May 7, 2020
c200625
namespace cleanup
bsrdjan May 26, 2020
d5a8643
electron-quick-start
bsrdjan May 27, 2020
52ae91d
electron-quick-start with node-rfc
bsrdjan May 27, 2020
deaee42
README
bsrdjan May 27, 2020
d4ceccb
nwjs-quick-start
bsrdjan May 27, 2020
88652bc
frameworks
bsrdjan May 27, 2020
054c09e
invalid_handle test
bsrdjan May 28, 2020
b775337
readme
bsrdjan May 28, 2020
2576eb1
track handle status in client->alive
clausreinke Jun 3, 2020
253149f
downloads are local, don't choke on drive letter
clausreinke Jun 3, 2020
10723a2
Merge branch 'trackHandleStatus'
bsrdjan Jun 12, 2020
0ec3923
install
bsrdjan Jul 8, 2020
4abfcf8
release 2.0.0
bsrdjan Jul 20, 2020
180f58d
release 2.0.0 readme
bsrdjan Jul 20, 2020
0485a6a
documentation
bsrdjan Jul 20, 2020
7b4bf6b
documentation
bsrdjan Jul 20, 2020
b593bc9
documentation
bsrdjan Jul 20, 2020
a5d4d2b
documentation
bsrdjan Jul 20, 2020
bc7740a
pr #154 --force-local removed
bsrdjan Jul 20, 2020
7e08895
release 2.0.1
bsrdjan Jul 20, 2020
f771838
Update README.md
bsrdjan Jul 20, 2020
806c8dc
ci/utils added back
bsrdjan Jul 21, 2020
59a65ea
CMake 3.18 and CXX 17
bsrdjan Jul 21, 2020
9141691
printf removed from logging
bsrdjan Jul 21, 2020
7772ddc
Fix #158
bsrdjan Jul 21, 2020
162a46b
remove .vscode from remote repository
bsrdjan Jul 21, 2020
73f183d
fix #151 wrapString fatal error (core dumped)
bsrdjan Jul 21, 2020
30b1475
release 2.0.2
bsrdjan Jul 21, 2020
7fa158c
all unit tests activated (.only suffix removed)
bsrdjan Jul 22, 2020
02541dd
documentation
bsrdjan Jul 22, 2020
5f56826
documentation
bsrdjan Jul 22, 2020
4c10e33
documentation
bsrdjan Jul 22, 2020
1750401
Clean the ERROR() macro redefinition warning
bsrdjan Jul 22, 2020
c2fdfc5
Buffers testing and EDEBUG warnings
bsrdjan Jul 24, 2020
41bd2ca
Boolean flag added to , if SAP NWRFC SDK LIB folder is on Windows PATH
bsrdjan Jul 27, 2020
4c7b860
Environment object appended to error message when SAP NWRFC SDK not f…
bsrdjan Jul 27, 2020
4d5a68f
Accidentally added p-queue dependency removed
bsrdjan Jul 27, 2020
34557ad
pool unit test fix
bsrdjan Jul 27, 2020
54599bf
Segfault when more Pool more connections requested than available as …
bsrdjan Jul 27, 2020
6b36d70
CLA replaced with DCO, FSFE Reuse compliance
bsrdjan Aug 4, 2020
2d0c147
README: added that the installation and build from source work for No…
bsrdjan Aug 4, 2020
4d4ea6d
NWRFC SDK Server API exposed
bsrdjan Aug 10, 2020
c2fb23b
Fix error TS2741 closes #164
bsrdjan Aug 10, 2020
e85a381
release 2.1.0
bsrdjan Aug 10, 2020
3250188
RFM table typing extended with Array of variables
bsrdjan Aug 11, 2020
34e0b2b
RFM call template published, added to README
bsrdjan Aug 11, 2020
b88cd68
Insignificant files license
bsrdjan Aug 13, 2020
2fdb6b4
Ensure build succeeds when environment variable 'NODE_HEADERS_INCLUDE…
Alexlambertz Aug 26, 2020
c4d285b
Merge pull request #168 from Alexlambertz/master
bsrdjan Aug 26, 2020
6902ec6
Update installation.md
DenisTis Aug 27, 2020
ef1dec1
Merge pull request #171 from DenisTis/patch-1
bsrdjan Aug 27, 2020
aa043cc
Bump bl from 3.0.0 to 3.0.1
dependabot[bot] Sep 2, 2020
839b5b8
Merge pull request #173 from SAP/dependabot/npm_and_yarn/bl-3.0.1
bsrdjan Sep 2, 2020
55c5195
Update README.md
bsrdjan Sep 3, 2020
0361788
fix link to sdk installation
brunopenso Sep 28, 2020
2373501
Merge pull request #177 from brunopenso/master
bsrdjan Oct 1, 2020
b2af4a3
release 2.2.0
bsrdjan Oct 13, 2020
ad8d840
merge the current master
bsrdjan Oct 13, 2020
851396a
release 2.2.0
bsrdjan Oct 13, 2020
b33376b
README
bsrdjan Oct 14, 2020
495c1b3
Reuse compliance fix
bsrdjan Oct 16, 2020
23eed4a
README: CII badge
bsrdjan Oct 19, 2020
3210fc4
The client parameter set to optional in RfcConnectionParameters inter…
bsrdjan Oct 20, 2020
2991acd
setIniFileDirectory method added at addon level, to set the sapnwrfc.…
bsrdjan Oct 21, 2020
30c699f
README
bsrdjan Oct 21, 2020
f77f838
release 2.3.0
bsrdjan Oct 26, 2020
482b593
Unt test fix
bsrdjan Oct 26, 2020
e640953
README: example
bsrdjan Oct 27, 2020
babefc0
README: example
bsrdjan Oct 27, 2020
1aee16c
electron example update
bsrdjan Oct 27, 2020
37757ba
Merge branch 'master' of https://github.com/SAP/node-rfc
bsrdjan Oct 27, 2020
2c2590f
electron and NW.js examples README
bsrdjan Oct 27, 2020
1a408be
server experimental documentation
bsrdjan Oct 27, 2020
55016b2
README
bsrdjan Oct 28, 2020
2eda5d6
README update: N-API 7
bsrdjan Oct 28, 2020
4dc33ba
README update: N-API 7
bsrdjan Oct 28, 2020
98aa119
documentation
bsrdjan Nov 11, 2020
012a169
Pool acquire() error message for wrong user credentials; fix #185
bsrdjan Nov 18, 2020
5b7591b
Connection parameters error messages and unit tests
bsrdjan Nov 18, 2020
e18685e
release 2.3.1
bsrdjan Nov 18, 2020
37c9b7e
PL7 encoding bug workaround
bsrdjan Dec 1, 2020
b20055a
CHARnn fields gets cut off after the first zero byte; fix #193
bsrdjan Dec 21, 2020
63df6a5
CMakeLists SDK version output
bsrdjan Dec 21, 2020
12fafd8
N-API versions support 6 and 7
bsrdjan Dec 21, 2020
e92d86c
Node strings sent to ABAP CHARnn fields, get cut out after the first …
bsrdjan Dec 21, 2020
cacf205
n-api version 6 fixed; tests against minimum n-api 6 node versions
bsrdjan Dec 28, 2020
a39f2c0
Fix typo in README.md
Jan 4, 2021
79ad80e
Merge pull request #195 from florian-richter/patch-1
bsrdjan Jan 4, 2021
cee201e
release 2.4.0
bsrdjan Jan 13, 2021
953c4b5
documentation
bsrdjan Jan 26, 2021
bdd495e
typings dev dependency removed, closes #202
bsrdjan Feb 3, 2021
ec81683
fix #203 client.connectionInfo result contains trailing zeros
bsrdjan Feb 24, 2021
8a57438
frameworks' samples moved to SAP-samples
bsrdjan Mar 29, 2021
7027e68
readme
bsrdjan Apr 1, 2021
376de4f
Misc
samuel-allan Apr 17, 2021
6727ce4
Self thread id reporting
samuel-allan Apr 17, 2021
31abfa8
misc
samuel-allan Apr 17, 2021
6a70cfc
Self report fixes
samuel-allan Apr 17, 2021
e1fa7f0
Latest changes
samuel-allan Apr 18, 2021
d968e5f
Bug fix in destructor
samuel-allan Apr 18, 2021
2dc397a
PL7 string conversion workaround removed
bsrdjan Apr 22, 2021
a893b59
release 2.4.1
bsrdjan Apr 22, 2021
39bd764
Misc
samuel-allan Apr 26, 2021
1ed15c8
unit tests timeout & unicode
bsrdjan Apr 27, 2021
b1a801d
# appended to strings with special unicode characters; fix #211
bsrdjan Apr 29, 2021
66d1ef0
Connection parameters typings update, following NWRFC SDK PL8
bsrdjan Apr 29, 2021
23765e6
compliance
bsrdjan May 4, 2021
ec083b9
compliance
bsrdjan May 4, 2021
9fff246
Added stop implementation
samuel-allan May 5, 2021
bec19c1
Added comments back on
samuel-allan May 5, 2021
31a767b
Update issue templates
bsrdjan May 16, 2021
e09e537
Create codeql-analysis.yml
bsrdjan May 19, 2021
7001855
WebSocket RFC support
bsrdjan May 19, 2021
738c1ee
WebSocket RFC support
bsrdjan May 19, 2021
3d46f45
WebSocket RFC docu
bsrdjan May 21, 2021
565d0b7
release 2.4.3
bsrdjan May 26, 2021
1b73cf7
README urls update
bsrdjan May 26, 2021
165f06a
README
bsrdjan May 26, 2021
85df2d5
Cancel ongoing RFC call
bsrdjan Jun 14, 2021
c76d92f
Cancellation timeout and event
bsrdjan Jun 16, 2021
95292ef
documentation
bsrdjan Jun 16, 2021
4a2e5d6
documentation
bsrdjan Jun 23, 2021
bc69afa
release 2.5.0
bsrdjan Jun 23, 2021
d96e144
Commented out debug prints + new done() callback
samuel-allan Jun 28, 2021
289e4a1
Latest changes
samuel-allan Jun 29, 2021
3413a59
Attempt 1
samuel-allan Jun 29, 2021
9dd2def
Attempt 2
samuel-allan Jun 29, 2021
28af2ac
Testing
samuel-allan Jun 29, 2021
5b79b4a
Cleanup
samuel-allan Jun 29, 2021
4422895
Trying to destroy the func desc
samuel-allan Jun 29, 2021
4ea461d
Attempt 11
samuel-allan Jun 29, 2021
9742ddc
Attempt 12
samuel-allan Jun 29, 2021
8ce0253
New env fixes
samuel-allan Jun 29, 2021
47cdbbc
Fake destroys
samuel-allan Jun 29, 2021
ea381ed
Package.json updates
samuel-allan Jun 30, 2021
b548302
WrapString changes
samuel-allan Jun 30, 2021
7304aca
Trial and error.. yet again
samuel-allan Jun 30, 2021
beef4fb
Xstring
samuel-allan Jun 30, 2021
989e46e
Finalizer added
samuel-allan Jun 30, 2021
878595f
Garbage system
samuel-allan Jun 30, 2021
f4a532a
missing 'dest' connection parameter name added to connection paramete…
bsrdjan Jul 7, 2021
1c4acd1
missing 'dest' connection parameter name added to connection paramete…
bsrdjan Jul 7, 2021
bebcbf9
release 2.5.1
bsrdjan Jul 8, 2021
d921bfb
Dirty fixes
samuel-allan Jul 14, 2021
d4fe6bc
Cleanup 1
samuel-allan Jul 15, 2021
e739c22
Cleanup 2
samuel-allan Jul 15, 2021
81ba522
Cleanup 3
samuel-allan Jul 15, 2021
db27d5a
Cleanup 4
samuel-allan Jul 15, 2021
08344f1
More cleanup
samuel-allan Jul 15, 2021
d5e1b0f
Cleanup...
samuel-allan Jul 15, 2021
5039735
fixes
samuel-allan Jul 15, 2021
eaf4102
include nwrfcsdk in server.cc
samuel-allan Jul 15, 2021
006d28c
fixes 2
samuel-allan Jul 15, 2021
0f1b140
fixes 3
samuel-allan Jul 15, 2021
13bc9dd
test1
samuel-allan Jul 15, 2021
1ddb0f6
test3
samuel-allan Jul 15, 2021
abc01d5
test0
samuel-allan Jul 15, 2021
54edae6
final
samuel-allan Jul 15, 2021
3cb86f3
final
samuel-allan Jul 15, 2021
631bc27
nullptr
samuel-allan Jul 15, 2021
87c0eba
debugging 1
samuel-allan Jul 15, 2021
2f9cf65
debug 2
samuel-allan Jul 15, 2021
ab0c6e0
debug 3
samuel-allan Jul 15, 2021
86ba9ea
Clean + finalized support for js->abap return
samuel-allan Jul 15, 2021
e78c3c3
Length tests 1
samuel-allan Jul 15, 2021
b64aebd
Memory leak
samuel-allan Jul 15, 2021
c22e4c2
Usage updated
samuel-allan Jul 15, 2021
a743fc9
Use any unarchiver available, not only tar; fix #227
bsrdjan Aug 9, 2021
80cd01f
Update issue templates
bsrdjan Aug 19, 2021
8829866
Fixed JS->ABAP done callback
samuel-allan Sep 11, 2021
9371e96
Merge branch 'testing'
samuel-allan Sep 22, 2021
db29728
Merge branch 'main' of https://github.com/smarterpsoft/node-rfc
samuel-allan Oct 4, 2021
4c5f0bd
Merge branch 'main' into main
samuel-c-allan Oct 4, 2021
7dbeb65
Minor formatting
samuel-allan Oct 5, 2021
7ea2714
Server stop function
samuel-allan Oct 5, 2021
970a703
Server.stop full implementation
samuel-allan Oct 5, 2021
d29a849
Fixed func name comparison bug
samuel-allan Oct 8, 2021
88ad6b1
Switched to SAP_UC * everywhere
samuel-allan Oct 9, 2021
4b9b7e6
Fixed UD due to depending on unitialized values
samuel-allan Oct 9, 2021
371a5db
Internal changes. Ignore
samuel-allan Oct 11, 2021
c20a65a
Internal tweaks
Nov 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 55 additions & 38 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,10 @@ API: [api/server](api.md#server)

Using the node-rfc Server instance, NodeJS functions can be exposed and consumed from ABAP, using `CALL FUNCTION DESTINATION` ABAP statement. Just the same way like standard RFMs from ABAP systems.

To expose one NodeJS function for ABAP clients, the ABAP function definition must be provided, defining ABAP parameters through which the ABAP client can invoke the NodeJS function. When ABAP clients calls the NodeJS function, ABAP input parameters are automatically converted to NodeJS function input and the function is invoked. The function output is automatically converted to ABAP output parameters, returned back to ABAP client.
To expose one NodeJS function for ABAP clients, the ABAP function definition must be provided, defining ABAP parameters through which the ABAP client can invoke the NodeJS function. When ABAP clients calls the NodeJS function, the NodeJS function is called with three arguments. The first argument indicates if any error occurred, the second arguments is an object representing the input parametes passed from ABAP and the final argument is a `done` function that the addon requires be called once ABAP may continue execution.

The `done` function takes two optional arguments. The first is an object representing data to be passed back to ABAP and the second is a callback that executes once we have returned our data to ABAP. This second callback also accepts an error parameter.


ABAP function definition defines ABAP parameters and data definitions for all variables, structures and tables used in ABAP parameers. Coding these metadata down to field level is not very exciting task and node-rfc Server provides a more elegant solution here:

Expand All @@ -683,7 +686,8 @@ ABAP function definition defines ABAP parameters and data definitions for all va

When invoked by ABAP, the NodeJS function will automatically fetch the function definition from ABAP RFM and expose itself as exactly such RFM to ABAP

As an example, let make the `STFC_CONNECTION` available as NodeJS RFM and call it from ABAP.
As an example, let's make the `STFC_CONNECTION` available as NodeJS RFM and call it from ABAP.


### Function Definition

Expand All @@ -707,44 +711,55 @@ Let provide the NodeJS function, mimicking the ABAP `STFC_CONNECTION` logic. Of

```node
function my_stfc_connection(
request_context,
abap_parameters: { REQUTEXT: "" }
error,
abap_parameters,
done
) {
console.log("NodeJS stfc invoked ", request_context);

return {
ECHOTEXT: abap_parameters.REQUTEXT,
RESPTEXT: `Python server here. Connection attributes are:\nUser '${request_context.user}' from system '${request_context.sysId}', client '${request_context.client}', host '${request_context.partnerHost}'`,
};
console.log("NodeJS stfc invoked ", abap_parameters);

done({
REQUTEXT: abap_parameters.REQUTEXT,
ECHOTEXT: 'Some response text goes here',
RESPTEXT: 'Some response text goes here',
}, (err) => {
if(err)
console.log('Error occurred while transferring data to ABAP!', err);
else
console.log('All fine :)');
});
}
```

When invoked from ABAP, the first argument `request_context` provides some information about ABAP consumer and the second argument `abap_parameters` provides input parameters sent from ABAP.
When invoked from ABAP, the first argument `error` indicates whether an error occurred.

The second argument `abap_parameters` is an object containing all of the information ABAP passed in the call (the arguments).

The third argument `done` is the callback which **MUST** be called when finished (otherwise the ABAP will be stuck in an endless deadlock).


### ABAP calls NodeJS RFM

ABAP call looks like this:

```abap
*&---------------------------------------------------------------------*
*& Report ZNODETEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT znodetest.
FUNCTION ZNODETEST.


DATA lv_echo LIKE sy-lisel.
DATA lv_resp LIKE sy-lisel.

CALL FUNCTION 'STFC_CONNECTION' DESTINATION 'NODEJS'
EXPORTING
requtext = 'Hello Nöde'
requtext = 'Hello Nöde 1'
IMPORTING
echotext = lv_echo
resptext = lv_resp.

WRITE 'RESULTS:'.
WRITE lv_echo.
WRITE lv_resp.

ENDFUNCTION.
```

### Configuration
Expand Down Expand Up @@ -785,26 +800,23 @@ The NodeJS destination is in SM59 looks like
**ABAP**

```abap
*&---------------------------------------------------------------------*
*& Report ZSERVERTEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zservertest.

FUNCTION ZNODETEST.

DATA lv_echo LIKE sy-lisel.
DATA lv_resp LIKE sy-lisel.

CALL FUNCTION 'STFC_CONNECTION' DESTINATION 'NODEJS'
EXPORTING
requtext = 'XYZ'
requtext = 'Hello Nöde 1'
IMPORTING
echotext = lv_echo
resptext = lv_resp.

WRITE 'RESULTS:'.
WRITE lv_echo.
WRITE lv_resp.

ENDFUNCTION.
```

**Node Server**
Expand All @@ -815,22 +827,27 @@ const Server = addon.Server;
const server = new Server({ dest: "gateway" }, { dest: "MME" });

// Callback function
function my_stfc_connection(request_context, REQUTEXT = "") {
console.log("stfc invoked");
console.log("request_context", request_context);
console.log("abap_parameters", abap_parameters);

return {
ECHOTEXT: REQUTEXT,
RESPTEXT: `Node server here. Connection attributes are:\nUser '${request_context.user}' from system '${request_context.sysId}', client '${request_context.client}', host '${request_context.partnerHost}'`,
};
function my_stfc_connection(
error,
abap_parameters,
done
) {
console.log("NodeJS stfc invoked ", abap_parameters);

done({
REQUTEXT: abap_parameters.REQUTEXT,
ECHOTEXT: 'Some response text goes here',
RESPTEXT: 'Some response text goes here',
}, (err) => {
if(err)
console.log('Error occurred while transferring data to ABAP!', err);
else
console.log('All fine :)');
});
}

server.start((err) => {
if (err) return console.error("error:", err);
console.log(
`Server alive: ${server.alive} client handle: ${server.client_connection} server handle: ${server.server_connection}`
);

// Expose the my_stfc_connection function as RFM with STFC_CONNECTION pararameters (function definition)
const RFM_NAME = "STFC_CONNECTION";
Expand Down
91 changes: 68 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"preinstall": "npm install cmake-js prebuild-install prebuild node-addon-api",
"install": "prebuild-install --tag-prefix -r napi || cmake-js rebuild",
"addon": "prebuild --backend cmake-js -r napi --force --strip --verbose",
"debugo": "prebuild --backend cmake-js -r napi --force --debug --verbose",
"ts": "tsc -p src/ts",
"upload": "prebuild -r napi -u --verbose",
"test": "reuse lint && jest --testPathIgnorePatterns throughput --testTimeout 30000",
Expand Down Expand Up @@ -66,17 +67,17 @@
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"async": "^3.2.0",
"cmake-js": "^6.1.0",
"cmake-js": "^6.2.1",
"decimal.js": "^10.3.1",
"eslint": "^7.30.0",
"jest": "^27.0.6",
"prebuild": "^10.0.1",
"prebuild-install": "^6.1.3",
"prebuild-install": "^6.1.4",
"random-bytes": "^1.0.0",
"typescript": "^4.3.5"
},
"dependencies": {
"bluebird": "^3.7.2",
"node-addon-api": "^4.0.0"
"node-addon-api": "^4.2.0"
}
}
Loading