Skip to Content
avatar image
Former Member

NetWeaver RFC SDK returns strange data on RfcGetString when receiving IDocs

Hallo everyone,

I am currently writing a small C++ application for Windows in Visual Studio 2010. The application is now able to connect to SAP and retrieve the function description for IDOC_INBOUND_ASYNCHRONOUS. Afterwards it is also able to register the function on another connection and call RfcListenAndDispatch.

Whenever my colleagues send an IDoc for the registered connection, my dispatch function is triggered and tries to process the received data. The following commands are still successful:

RfcGetTable(rfcFuncHandle, cU("IDOC_CONTROL_REC_40"), &rfcControlTable, rfcErrorInfo)

RfcGetTable(rfcFuncHandle, cU("IDOC_DATA_REC_40"), &rfcRecordTable, rfcErrorInfo)

RfcMoveToFirstRow(rfcRecordTable, rfcErrorInfo)

RfcMoveToFirstRow(rfcControlTable, rfcErrorInfo)

Then I try to get data from the tables above:

RfcGetString(rfcControlTable, cU("IDOCTYP"), rfcCharBuffer, uiCharCount, &uiStringLength, pRfcErrorInfo)

This last call returns RFC_OK, but the data in rfcCharBuffer looks like Unicode in the wrong endian arrangment (server runs on AIX, client on Windows Server 2012) and there is almost nothing written inside the returned buffer... The text WMTORD can be identified at (ca.) offset 10 in the returned rfcCharBuffer, but that is not what I would have expected (WMTOID01 was expected by me).

The next call

RfcGetString(rfcControlTable, cU("DOCNUM"), rfcCharBuffer, uiCharCount, &uiStringLength, pRfcErrorInfo)

returns an incredibly high number...

Is there something that needs to be configured to ensure the correct Unicode handling between the two systems? Is this related to Unicode configuration at all?

Thanks for your help!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 03, 2017 at 05:54 PM

    Hello Stefan,

    Is the SAP system UNICODE?

    And can you provide the source code of a sample C++ program that you can use to simulate the issue?



    Add comment
    10|10000 characters needed characters exceeded

    • Hello Stefan,

      You are welcome!

      Indeed, the SDK would always use UNICODE.

      This is exactly why the destination had to be adjusted (the non-UNICODE SAP system is sending data to an external system that is UNICODE - your C++ application).

      Anyway, I'm glad that the issue is solved :-).

      Can you please close this question, then?