SAPRFC 连接 PHP,操作实录

来源:互联网 发布:会员卡设计软件 编辑:程序博客网 时间:2024/05/18 00:02

一、SAPRFC介绍:

SAPRFC is a extension module for PHP 4 and PHP 5. With SAPRFC is possible call ABAP function modules in SAP R/3 from PHP scripts. You can use the powerful PHP language to create a web applications or interface programs with a connectivity to the SAP R/3. You can also write RFC server program in PHP and call PHP functions from SAP R/3.Client example.Server example.

更多内容可访问其官方网站:http://saprfc.sourceforge.net/

二、下载SAPRFC,最新版本为1.4.1

http://sourceforge.net/projects/saprfc/files/saprfc/1.4.1/saprfc-1.4.1.All.zip/download

该包里面含有 php_saprfc_449.dll php_saprfc_528.dll php_saprfc_528_nts.dll php_saprfc_530.dll php_saprfc_530_nts.dll文件,请根据您的PHP版本选择相应文件复制到PHP的安装目录下ext文件夹。

修改php.ini文件,在其中加入一行:

extension=php_saprfc_528.dll

(假设您的PHP是5.2.8版本)

保存并重新启动PHP,访问phpinfo();就可以看到:

表明SAPRFC已经安装成功。

 三、实际运行:

把下载的包解压到网站目录下,打开example_userlist.php,修改其中的SAP登录代码:

可以看到其中调用了SAP标准的函数:SO_USER_LIST_READ,代码非常简单:

运行结果:

 

为了实现某些功能可用SE37定义RFC函数,然后用PHP调用,下面是个小例子:

四、存在的问题:

PHP当然是支持中文的,但SAPRFC提供的.DLL文件好像并不支持中文,非常纠结。