How to connect to SAP with C # through the SAP NetWeaver RFC library (sapnwrfc.dll)?

Our software is written in C # and must be connected to SAP. Because some of our customers use older versions of SAP, while others do not have SAP PI, we cannot connect through web services.

I tried connecting to SAP through the SAP NetWeaver Remote Function Call Library (sapnwrfc.dll) as follows:

  • Add sapnwrfc.dll and other dlls from NWRFC_6-20004550.SAR (being icudt34.dll, icuin34.dll, icuuc34.dll, libicudecnumber.dll and libsapucum.dll) to C: \ WINDOWS \ system32 to make sure they can be found.
  • In my C # code, add the following to the class definition:
        [DllImport ("sapnwrfc.dll", CharSet = CharSet.Auto)]
        public static extern void RfcInit ();
    and the following in the method that should do the job:
        RfcInit ();

Running this code gives a DllNotFoundException:
Failed to load DLL 'sapnwrfc.dll': this application could not be started because the application configuration is incorrect. Reinstalling the application may fix the problem. (Exception from HRESULT: 0x800736B1)

Running the standard connect-to-C ++ example - from-C #
    [DllImport ("user32.dll", CharSet = CharSet.Unicode)]
    public static extern int MessageBox (IntPtr hWnd, String text, String caption, uint type);
    MessageBox (new IntPtr (0), "Hello World!", "Hello Dialog", 0);
works great.

Any suggestions on how to make this work fine (so we don’t need to get around this problem by writing a Java proxy using JCo)?

+3
source share
2 answers

, DLL? rfc ( , ), , rfc. , , . () .

unicode ( , ), , ...

- , : http://www.theobald-software.com/en/products/erpconnect.htm

, , , , - .

+2

SAP ".NET Connector" (NCo3)? . SAP 856863 .

+1

Source: https://habr.com/ru/post/1734558/


All Articles