SAP / node-rfc

Asynchronous, non-blocking SAP NW RFC SDK bindings for Node.js
Apache License 2.0
251 stars 73 forks source link

Passing table data type in RFC from linux not working while working fine on windows #175

Closed PatroxGaurab closed 3 years ago

PatroxGaurab commented 3 years ago

Hi I've been using nwrfcsdk on linux, rest of the FMs are getting called perfectly, but when the input parameter is table type it's giving the following error.

{ alive: true, name: 'RfcLibError', code: 20, codeString: 'RFC_INVALID_PARAMETER', key: 'RFC_INVALID_PARAMETER', message: "field '' not found" }

Still it's running fine on Windows.

Both having version 2.1.0. Also tried downgrading to 1.2.0, resulting in same problem.

Help is highly appreciated.

bsrdjan commented 3 years ago

Do you know which table exactly is affected? Can you create a NodeJS script to reproduce the issue, showing how the table input data?

PatroxGaurab commented 3 years ago

hi @bsrdjan Yes I've debugged it to trace which all FM calls are causing problem, following is the code

`const pool = new rfc.Pool(rfcSettings);
        pool.acquire().then(client => {
            console.log("connection opened..")
            client.call('ZRFC_INVOICE_PREVIEW',{IM_VBELN:id}).then((data)=>{
                console.log(data);
                if(data.EX_INV.length>0){
                    res.json({
                        status : true,
                        msg : "delivery details fetched.",
                        result : data.EX_INV
                    })
                }
                else{
                    res.json({
                        status:false,
                        msg : "Please provide a valid delivery no array."
                    })
                }

            }).catch((err)=>{
                console.log(err);
                res.json({
                    status : false,
                    msg : "server error."
                })
            }).finally(()=>{
                console.log("closing ...")
                pool.release(client, function(){});
            })`

In the above code "id" is an array of strings Also sharing a trace -

1|server | [ '2319134941', '2319134940' ] 1|server | got ids 1|server | connection opened.. 1|server | { 1|server | alive: true, 1|server | name: 'RfcLibError', 1|server | code: 20, 1|server | codeString: 'RFC_INVALID_PARAMETER', 1|server | key: 'RFC_INVALID_PARAMETER', 1|server | message: "field '' not found" 1|server | } 1|server | closing ...

You can check, in those FM calls that accept an array are causing problem. Strangely working fine on Windows.

Pls guide me what all parameters/versions etc I need to check.

Thanks

bsrdjan commented 3 years ago

Table parameters handling should work the same way on all platforms and the latest node-rfc version is recommended.

Did you check if SAP NWRFC SDK versions are the same on Windows and Linux?

What is the IM_VBELN ABAP data type?

Depending on data type the table can be passed as array of strings or array of single key-value pairs.

Could you please post the rfmcall output of your ABAP function module (npm install rfmcall)?

PatroxGaurab commented 3 years ago

I was finally able to resolve it by updating the SAP NWRFC SDK version on ubuntu to 750.

Thanks