SAP / node-rfc

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

Lang params seems to be ignored #141

Closed SchroterQuentin closed 4 years ago

SchroterQuentin commented 4 years ago

I'm not sure if the problem comes from the sdk or from the server but we can't get the unit of our product in our language (FR). We were using the C# sdk with the exact same configuration for the same user and now we got different result.

It seems that there is a difference between the RFC language and the logon language as explained here but why is there a difference between the C# sdk and the javascript ? Is there a way to force the sy-langu inside the sdk ?

The only difference I can see is the use of the pool in the C# sdk when we are using one client per connection without pool in javascript. I search for similar issue but can't find one.

Exemple of the client code :

import { RfcConnectionParameters, Client, RfcObject } from "node-rfc";

var client = new Client({
    ashost: "****.pri",
    client: "300",
    sysnr: "00",
    user: "*****",
    passwd: "******",
    lang: "FR",
})

client.connect((err: any, res: any) => {
    console.log(client.connectionInfo);
   // ...
}

which print correctly

{
  dest: '',
  host: '***',
  partnerHost: '***.pri',
  sysNumber: '00',
  sysId: 'DEV',
  client: '300',
  user: '*****',
  language: 'F',
  trace: '0',
  isoLanguage: 'FR',
  codepage: '4103',
  partnerCodepage: '4103',
  rfcRole: 'C',
  type: 'E',
  partnerType: '3',
  rel: '753',
  partnerRel: '750',
  kernelRel: '753',
  cpicConvId: '27866245',
  progName: 'SAPLSYST',
  partnerBytesPerChar: '2',
  partnerSystemCodepage: '4103',
  partnerIP: '****',
  partnerIPv6: '******'
}

And we still get the unit in german.

bsrdjan commented 4 years ago

The c# and node rfc connectors work the same way in regard to languages. Are you using BAPI or custom Function Module and could you please try following.

1) Logon to ABAP system with the node-rfc user and FR language and test the Function Module in SE37, to confirm texts are returned in FR ?

2) Set the ABAP external breakpoint for the node-rfc user, at the first line of ABAP function module (in detail described here). After running the node script, the ABAP debugger should pop-up, so that sy-langu can be shown in debugger.

Per connectionInfo output, the language looks correct. The language could be changed by ABAP code or the Function Module might have an optional language parameter for selection, set to DE default?

SchroterQuentin commented 4 years ago

@bsrdjan thanks for this quick reply. My SAP boss actually did what you told and the sy-langu was good but he forgot to translate the field to this language. Actually the traduction was done in the C# code after the call with the SAP SDK ... Something so ugly that I didn't even thought about it. My bad for this issue.

bsrdjan commented 4 years ago

Just for my understanding, the problem was that the language parameter field, send from node to ABAP, was sent as "FR", which is so called "external format" and was not correctly interpreted in ABAP RFC function module?

SchroterQuentin commented 4 years ago

I'm not exactly sure, my boss told me that when you are in SE37 and execute the BAPI, it's the interface which translate the differents value but when you are in RFC mode, the translation is not done because my boss forgot to implement that functionnality.