Python SAP RFC module

Author: Klavdij Voncina (klavdij.voncina at siol.net)

Hosted at SourceForge.net Logo

Introduction
Motivation
Requirements
Download
Installation
Documentation
Licence


SourceForge.net Logo

Introduction

Pysaprfc is a wrapper around SAP librfc (librfc32.dll on Windows, librfccm.so or librfc.so on Linux). It uses the excellent ctypes extension package by Thomas Heller to access librfc and to define SAP compatible datatypes.

In times I started developing pysaprfc module there was no publicly available interface to access SAP from within Python. Things has changed lately as there is now a saprfc.py module written by the author of saprfc Perl and Ruby modules, Piers Harding. Being in an early development stage (as is my module), it currently provides basic mechanisms to access and manipulate SAP data structures and perform remote function calls using a small C wrapper around needed routines defined by librfc. Using ctypes my module has a small advantage over saprfc.py by having access to the whole of the librfc (almost, some ctypes limitations apply) without having the need to write (and compile) C wrappers. By examining Piers Hardings code (he's much greater SAP expert as I am) I also got some ideas how to generalize data and interface querrying to make my module more flexible. Other than that both projects are using different strategies and are developed independetly of each other - it's your choice which one suits your needs better.

Motivation

My main goal is to make Python a first class citizen of the SAP world - usefull both for client and server side (remote functions implemented in Python) programming. Currently only the client side is supported though.

In my opinion Python with its agile nature, fast development cycles and rich library of extension modules and packages is ideal companion to SAP system offering connectivity to external systems (web servers, external applications, RDBMs via Python DB API etc).

Requirements

Mandatory:

  • Python (v 2.2 or newer)
  • librfc by SAP AG suitable for your platform

    You must have access to SAP Market Place or OSS to be able to download it (you have to be registered as user/developer with SAP for that).

    It comes also with SAPGui (Windows version).

  • ctypes by Thomas Heller (v0.6.0 or newer)
Optional:

As of version 0.2.1 all RFC-enabled SAP systems should be supported by pysaprfc.

Download

Downloads are available here.

Installation

Just copy pysap.py somewhere on your PYTHONPATH (site-packages for example). You can also use distutils, just cd to the folder where you unpacked the archive and type python setup.py install at command prompt.

Documentation

Documentation is available from SourceForge project site.

Acknowledgments

Thomas Heller - for the ctypes package
Piers Harding - the source of his saprfc.py module showed me which SAP functions to use for interface and data-definiton querrying in order to generalize my module (which was at first destined to be one-off tool).

Licence

Python SAP RFC module is licensed under Python licence.