OpenERP can connect to SAP through the RFC gateway using sapnwrfc (SAP NetWeaver R/3 RFC Connector for Python)
The below tutorial is based on the experiance in configuring sapnwrfc in ubuntu 10.04 . There might be changes in other distros and versions. Its is assumed that the commands given below will be run as root user.
You have to download the following
- nwrfcsdk - SAP Netweaver RFC SDK. Download recent version appropriate to your architecture(32bit, 64bit ...) from SAP Marketplace.
- sapcar - Archive manager. The downloaded nwrfcsdk will be a .SAR archive. We need sapcar to extract the downloaded .SAR archive. Download from SAP Marketplace recent version appropriate to your architecture(32bit, 64bit ...)
- sapnwrfc - From http://www.piersharding.com/download/python/sapnwrfc/. Download the latest release
Extract the SDK which will be something like NWRFC_1-20004565.SAR using sapcar (SAPCAR-32bit.exe) You will get a folder named nwrfcsdk.
- chmod +x SAPCAR-32bit.exe
- ./SAPCAR-32bit.exe -xv -f NWRFC_xxxxxxxxxx.SAR
Create a folder /usr/sap and copy this folder(nwrfcsdk) to it.
- mkdir /usr/sap
- cp -r nwrfcsdk /usr/sap
Now create a file sap.conf(name can be anything ending with .conf) under the directory /usr/sap/nwrfcsdk/lib
- echo "/usr/sap/nwrfcsdk/lib" > /etc/ld.so.conf.d/sap.conf
To load the libraries run
- ldconfig -v
SAP RFC Gateway will listen on port 3300 by default. If not check on which port it is listening.
Make sure you can reach the port on sap server. For example check if you can connect telnet to it by
- telnet SAP_SERVER_IP 3300
- apt-get install python-yaml
Extract sapnwrfc, and change directory to the extracted folder and install sapnwrfc
- tar -zxf sapnwrfc-xxxxxx.tar.gz
- cd sapnwrfc-xxxxx
- python setup.py install
Make sure this finishes with no errors.
Now everything is ready to connect to SAP.
Check the examples coming with sapnwrfc(folder examples). The examples check for the configuration file inside the directory examples/examples. So you have to create a directory examples(mkdir examples/examples) and create a yml file with the connection settings similer to the sap.yml file given in examples.
Tags: Integrating OpenERP and SAP, synchronizing OpenERP and SAP, OpenERP, SAP, sapnwrfc , connecting to SAP using python, connecting to SAP RFC gateway from linux, SAP and python