SAP / node-rfc

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

Results values truncated #88

Closed mryiiiii closed 5 years ago

mryiiiii commented 5 years ago

Hi,

I got only partial results from calling FM "RFC_GET_TABLE_ENTRIES" with node-rfc: The same test (with same parameters in SE37) works fine and all content is displayed in SE37.

Executed in Linux x86 with latest SDK 7.50 SP3.

`
var invoke_options = { MAX_ENTRIES:10, TABLE_NAME: 'FPLAYOUTT' };

client.invoke('RFC_GET_TABLE_ENTRIES', invoke_options , function(err, res) { if (err) { // check for errors (e.g. wrong parameters) return console.error('Error invoking:', err); } res.ENTRIES.forEach(x => console.log('line:', x['WA'] )) console.log(res.NUMBER_OF_ENTRIES) }) `

Result is:

line: /BCV/QVIEWS_PRINTING_LANDSCAPEAD X line: /BCV/QVIEWS_PRINTING_LANDSCAPEAE line: /BCV/QVIEWS_PRINTING_PORTRAIT AD X line: /BCV/QVIEWS_PRINTING_PORTRAIT AE line: /BOFU/DEMO_CUSTOMER_FORM AD X line: /BOFU/DEMO_CUSTOMER_FORM AE line: /BOFU/F_PPF_DEMO_PRODUCT AD X0 line: /BOFU/F_PPF_DEMO_PRODUCT AE line: /BOFU/F_PPF_DEMO_SO AD X0 line: /BOFU/F_PPF_DEMO_SO AE 452

bsrdjan commented 5 years ago

My SE37 tests with the same parameters ended with ASSIGN_CASTING_ILLEGAL_CAST shortdump, in two test systems. Could you please post the screenshot of the SE37 result and what is exactly truncated when running from the nodejs?

mryiiiii commented 5 years ago

Hi,

Thanks for your reply. hope this can help:

Here is the screen shot of SE37.

FPLAYOUTT_SE37

Here is the screen shot of nodejs:

FPLAYOUTT_NODEJS
mryiiiii commented 5 years ago

Hi Srdjan, I believe the different results (dump on your side) is due to some unicode character from the content of your table as I have seen that this FM has limitations relative to UNICODE. Maybe you can try to limit to 1 record, or choose another table. Thanks.

bsrdjan commented 5 years ago

According to RFC_GET_TABLE_ENTRIES documentation, the fist 512 bytes of each table record should be returned. With FPLAYOUTT all 10 records are returned but each truncated possibly because of the Unicode, correct?

With 1 record I got the same shortdump and testing with CTXTLAY table, the SE37 looks like this:

SE371

SE372

and the node-rfc like this:

const input = {MAX_ENTRIES: 10, TABLE_NAME: 'CTXTLAY'};

client.open().then(() => {
    client
        .call("RFC_GET_TABLE_ENTRIES", input)
        .then(result => {
            let ENTRIES = result.ENTRIES;
            console.log(ENTRIES.length);
            console.log(ENTRIES);
        })
        .catch(e => {
            console.error("Error:", e);
        })
        .finally(() => {
            client.close();
        });
});
$ node ci/issue.js
10
[ { WA: '620S_ACT_HD            DLinienarbeitsplankopf' },
  { WA: '620S_ACT_HD            EROUTING HEADER (LINE)' },
  { WA: '620S_ACT_HD            J作業手順ヘッダ (ライン)' },
  { WA: '620S_ACT_HD            NLijnroutingkop' },
  { WA: '620S_ACT_HD            SCabecera de hoja de ruta de línea' },
  { WA: '620S_ACT_MOD           DModus-Detailpflege (Linie)' },
  { WA: '620S_ACT_MOD           EMODE DETAIL MAINTENANCE (LINE)' },
  { WA: '620S_ACT_MOD           Jモード詳細更新 (ライン)' },
  { WA: '620S_ACT_MOD           NModusdetailverzorging (lijn)' },
  { WA: '620S_ACT_MOD           SActualización detallada de modo (línea)' } ]

It looks correct, or?

Are you using the latest node-rfc@next (rc10) and is the your SAP system the unicode system?

mryiiiii commented 5 years ago

Thanks! Yes the SAP system is unicode and the version of node rfc is "node-rfc@1.0.0-rc9". I don't have CTXTLAY table active in my system but is working fine in your case! Not really sure about the root cause of this behavior.

bsrdjan commented 5 years ago

According to similar issue, the # in SE37 stands for unprintable characters, which could be a RFC_GET_TABLE_ENTRIES or system configuration issue. Could you post hex values from the debugger, to see the content replaced by #s ?

mryiiiii commented 5 years ago

Here is one of the line from the debugger in plain text and hex:

In SAP:

/BCV/QVIEWS_PRINTING_PORTRAIT AE e###쀀#### Text for Placeholders in List Headers SYST TVAR6 E0149SYCHAR20 SYST_TVAR 10203020Variab

2F004200430056002F005100560049004500570053005F005000520049004E00540049004E0047005F0050004F00520054005200410049005400200041004500200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000650014000000030000C0140000000100000020005400650078007400200066006F007200200050006C0061006300650068006F006C006400650072007300200069006E0020004C006900730074002000480065006100640065007200730020002000200020005300590053005400200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020005400560041005200360020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020004500300031003400390053005900430048004100520032003000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200053005900530054005F00540056004100520020002000200020002000200020002000200020002000200020002000200020002000200020002000200031003000320030003300300032003000560061007200690061006200

In NodeJS:

worker@worker:/app/engines/test$ node rfc.js line: /BCV/QVIEWS_PRINTING_LANDSCAPEAD X line: /BCV/QVIEWS_PRINTING_LANDSCAPEAE line: /BCV/QVIEWS_PRINTING_PORTRAIT AD Xr line: /BCV/QVIEWS_PRINTING_PORTRAIT AE e line: /BOFU/DEMO_CUSTOMER_FORM AD X line: /BOFU/DEMO_CUSTOMER_FORM AE line: /BOFU/F_PPF_DEMO_PRODUCT AD X line: /BOFU/F_PPF_DEMO_PRODUCT AE line: /BOFU/F_PPF_DEMO_SO AD X0 line: /BOFU/F_PPF_DEMO_SO AE 452

thanks

bsrdjan commented 5 years ago

The line: /BCV/QVIEWS_PRINTING_PORTRAIT AE e is truncated because the content after AE e is not convertible to unicode:

Screenshot 2019-06-19 at 11 18 20

The RFC_GET_TABLE_ENTRIES parameter ENTRIES, of plain CHAR512 ABAP type, is designed for the plain unicode text and cannot export non-unicode (binary) content. You could check if the content could be eventually fixed or if there is another way (function module?) available, exporting this content as ABAP XSTRING type for example (binary strings). The node-rfc can't help much here.

Here also the plain output from unicode converter:

/BCV/QVIEWS_PRINTING_PORTRAIT AE e###쀀#### Text for Placeholders in List Headers SYST TVAR6 E0149SYCHAR20 SYST_TVAR 10203020Variab

utf16 little endian

2F004200430056002F005100560049004500570053005F005000520049004E00540049004E0047005F0050004F00520054005200410049005400200041004500200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000650014000000030000C0140000000100000020005400650078007400200066006F007200200050006C0061006300650068006F006C006400650072007300200069006E0020004C006900730074002000480065006100640065007200730020002000200020005300590053005400200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020005400560041005200360020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020004500300031003400390053005900430048004100520032003000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200053005900530054005F00540056004100520020002000200020002000200020002000200020002000200020002000200020002000200020002000200031003000320030003300300032003000560061007200690061006200

/BCV/QVIEWS_PRINTING_PORTRAIT AE e쀀 Text for Placeholders in List Headers SYST TVAR6 E0149SYCHAR20 SYST_TVAR 10203020Variab
mryiiiii commented 5 years ago

Ok, very clear. Thanks a lot for your help Srdjan! I'll try to find another way then. issue can be closed