SAP::Rfc XS Package
Copyright (c) 1999 - 2006 Piers Harding.
All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of either:
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License" which comes with this Kit.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
the GNU General Public License or the Artistic License for more details.
You should have received a copy of the Artistic License with this
Kit, in the file named "Artistic". If not, I'll be glad to provide one.
You should also have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
For those of you that choose to use the GNU General Public License,
my interpretation of the GNU General Public License is that no Perl
script falls under the terms of the GPL unless you explicitly put
said script under the terms of the GPL yourself. Furthermore, any
object code linked with perl does not automatically fall under the
terms of the GPL, provided such object code only adds definitions
of subroutines and variables, and does not otherwise impair the
resulting interpreter from executing any standard Perl script. I
consider linking in C subroutines in this manner to be the moral
equivalent of defining subroutines in the Perl language itself. You
may sell such an object file as proprietary provided that you provide
or offer to provide the Perl source, as specified by the GNU General
Public License. (This is merely an alternate way of specifying input
to the program.) You may also sell a binary produced by the dumping of
a running Perl script that belongs to you, provided that you provide or
offer to provide the Perl source as specified by the GPL. (The
fact that a Perl interpreter and your code are in the same binary file
is, in this case, a form of mere aggregation.) This is my interpretation
of the GPL. If you still have concerns or difficulties understanding
my intent, feel free to contact me. Of course, the Artistic License
spells all this out for your protection, so you may prefer to use that.
One last thing - The SAP RFCSDK is a prerequisite for this perl package to work. The RFCSDK is proprietrary software owned by SAP AG. For this reason I will not supply ANY component part of the RFCSDK with this perl package, and further more you must obtain it through the normal channels with SAP AG - ie. you must have a licensed SAP R/3 installation at your disposal.
After all the legal stuff - Hello!
Welcome to the SAP::Rfc perl package. This package is intended to facilitate RFC calls to an SAP R/3 system of release 3.1x and above. It may work for earlier versions but it hasn't been tested.
The fundamental purpose of the production of this package, is to provide a clean object oriented interface to RFC calls from within perl. This will hopefully have a number of effects:
(1) make it really easy to do RFC calls to SAP from perl in an object oriented fashion (Doh!)
(2) promote perl as the interface/scripting/glue language of choice for interaction with SAP R/3.
(3) make the combination of Linux, Apache, and perl the killer app for internet connectivity with SAP.
(4) Establish a small fun open source project that people are more than welcome to contribute to, if they so wish.
As of April 2003 (VERSION 1.11), SAP::Rfc has had another large chunk of functionality added.
The ability to perform registered RFC calls where ABAP code in SAP can call out to your Perl
code. See the description of accept() in perldoc SAP::Rfc.
With this in mind - this package has been developed under Linux, so the installation is therefore focused on this. This does not mean that it will not work on other UNIX like flavours - to the contrary it probably will, it just hasn't been tested. The package has been compiled and run under Win32 - special attention needs to be paid to the options found in the Makefile.PL file.
Failing this - for Win32 people Olivier Boudry has kindly supplied me (so every win32 slave out there, should be very grateful to him) with a PPD based install package from Version 1.17 onwards - these can be found at http://www.piersharding.com/download/win32/ .
Furthermore - if you still need to build your own win32 version then Olivier has given additional instructions on doing this with the "free" Visual Studio version called VS Express 2005.
This can be found at:
http://www.piersharding.com/download/win32/Build_SAP-Rfc_with_VSE2005.pdf
Many thanks go to Olivier.
As VSE 2005 and above MS compilers require that a MANIFEST be embedded in the compiled binary, the build process is slightly modified - you must add a command line parameter:
perl Makefile.PL EMBED_MANIFEST=yes
After the fundamental RFC interface has been developed, the intention is then to extend this to add interface discovery, and a BAPI abstraction layer - but this is down the track.
SAP have kindly provided the RFCSDK for Linux on the OSS ftp service. This can be retrieved from sapserv3, currently in the "unsupported directory" - this should change before the end of 1999 to being fully supported. See OSS note 53459 for details.
*Note: 29.11.2002 - this is old info from circa 1999 - I am currently using RedHat 8.0 and either the librfc or librfccm from R3 4.6C.
This must be installed before you continue. I use Redhat 6.1 or Slackware 7.0 - other distributions will probably work, but take heed of the instructions provided with the rfcsdk rpm files.
Once you have the rfcsdk installed carry on!
Make sure that the LIBS and INC directive in the Makefile.PL points to the correct location of your OS's version of the rfcsdk -without this linking correctly nothing is going to work.
Thanks to Achim Grolms who supplied the following information :-
- where to get the required SAP files for the RFCSDK:
Archive program needed to exratct the archives
Dynamic libraries and headers
-This is how to extract
(Like ./SAPCAR -xvf librfc_mt_so_dbg.CAR)
-and where to put them
(libs to $RFCSDKHOME/lib and headers to $RFCSDKHOME/include)
where RFCSDK should be /usr/sap/rfcsdk as a standard
After you have unpacked The SAP::Rfc module, you should have all the files listed
in MANIFEST.
Installation
In brief, the following should work on most systems:
perl Makefile.PL
make
make test << provide all your host routing information.
make install
Help on the build process is available by doing:
perl Makefile.PL --help
and it says:
The whole trouble with the build process is one
of determining what your OS is, and which RFC
library needs to be linked in, and where that
library lives.
To help with this there are two command line
options that you can use to point me in the
right direction:
(1) --source /usr/sap/rfcsdk
This tells me where to look for your installed
RFCSDK. This must be the directory that contains
the ./lib and ./include directories of the RFCSDK
In the include directory must be saprfc.h etc.
By default, this looks in /usr/sap/rfcsdk
(2) --addlibs ' -lm -ldl -lpthread '
This tells me what additional libraries need to
be passed in at link time - this can be anything
that you would put in LDFLAGS.
By default this is ' -lm -ldl -lpthread '
(3) --unicode
This tells me that you want to compile in unicode
support - to do this you must have the unicode version of the RFC
library specifically librfcum.xx or librfcu.a and the libsapu16
library.
(good luck!!).
Example:
perl Makefile.PL --source /opt/rfcsdk --addlibs '-lsomethingwacky'
UNICODE
========
If you really really really need it - unicode support can be built
BUT it must be done using the librfcum eg. the special unicode version
of the RFCSDK.
Get the latest as provided by service.sap.com/connectors => see OSS
note 413708.
This has only ever been tested on Linux, and is only ever likely to work
on systems that have iconv and are Little Endian in its current form.
To build it you need something like:
perl Makefile.PL --source=/usr/sap/rfcsdk-640-unicode --unicode
Please email directly if you have problems, and are willing to help
with testing (especially for other platforms) => piers@cpan.org.
VERSION Info supplied by Others
================================
Mark Förster writes:
On HP-UX (11.X) use the ANSI C compiler or gcc,
extract the RFCSDK 4.6C 32bit e.g. to /usr/sap/rfcsdk.
If you get error messages like:
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local
Storage: /usr/lib/libcl.2
then try the following solution:
export LD_PRELOAD=/usr/lib/libcl.2
Cheers - Piers Harding - R/2 R/3 BASIS, IFACE, JAPH, whatever ...
email: piers@cpan.org