cancel
Showing results for 
Search instead for 
Did you mean: 

sapnwrfc a PHP extension for the NW RFC SDK

Former Member
0 Kudos

Hello all -

I am looking for help with testing and improving a new PHP RFC extension, sapnwrfc.

This is designed to take advantage of the NetWeaver RFC SDK, and hopefully will help deal with unicode issues.

The code is available at http://www.piersharding.com/download/php/sapnwrfc/

And the primary problems are with:

  • determining the build process for win32

  • robustly testing the parameter calling interface.

In the source archive available above, there are sketchy build instructions in INSTAL, and in the unit_tests directory, are examples.

A starting point would be to get the build going and just run those tests.

Cheers,

Piers Harding.

Accepted Solutions (0)

Answers (23)

Answers (23)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

hello,

first, I would like to thank Piers for his excellent work.

and now, I would like to ask if there is some sort of documentation for sapnwrfc functions,

like there was for old saprfc [http://saprfc.sourceforge.net/]?

I went through that one example, and phpunit tests, but I would prefer something more newbie friendly

cheers,

former_member249154
Discoverer
0 Kudos

Hi all!

I have the last version of file sapnwrfc.dll but it's parameters are the next:

CompanyName : SAP AG

FileVersion : 7200, 103, 19, 28729

LegalCopyright : Copyright (c) SAP AG 1992 - 2011

ProductName : mySAP.com

ProductVersion : 720, patch 103, changelist 1273913

SpecialBuild : optU

Platform : NTAMD64

Creation Date : 17/02/2012 13:24:11

Last Modif. Date : 08/09/2011 01:30:59

Last Access Date : 21/02/2012 13:41:25

FileSize : 5004288 bytes ( 4887.000 KB, 4.772 MB )

FileVersionInfoSize : 1388 bytes

File type : Application (0x1)

Target OS : Win32 API (Windows NT) (0x40004)

File/Product version : 7200.103.19.28729 / 7200.0.0.103

I don't understand how to use this file in Windows XP?

In file parameters there are 2 strings (bold) with different information!

Where is a truth?

Former Member
0 Kudos

Someone can provide me with the SAP NetWeaver RFC SDK??

mail:eulerss[at]hotmail.com

Thanks

gregorw
Active Contributor
0 Kudos

Hi Euler,

please check out [Note 1025361 - Support and Availability of the SAP NetWeaver RFC Library|https://service.sap.com/sap/support/notes/1025361] where the path to the download is described.

It should be http://service.sap.com/patches

-> Support Packages and Patches - Entry by Application Group

-> Additional Components

-> SAP NW RFC SDK

-> SAP NW RFC SDK 7.11

-> <platform>

-> NWRFC_3-20004xxx.SAR

Best regards

Gregor

Former Member
0 Kudos

Hi Gregor, thanks for your reply, i checked the link that you provide me but when i clicked on Additional Components, the only option that appears is Upgrade Tools, and page info that shows info like:

**********************

Upgrade Tools

Transition to Maximize Your Return on IT Investment

General Information

To ensure stability and high performance of the upgrade tools, we provide upgrade correction packages for all upgrades.

We recommend that you replace the R3up delivered with your upgrade CD with the newest version provided here at SAP Service Marketplace. Additionally you should use the correction packages which are provided here also.

etc

*************************

Thanks in advance for your help. Any ideas?

Euler

Former Member
0 Kudos

Hi, Piers thanks for your reply, unfortunately i can´t download following the link that provide from the market place, it seems that the links doesn´t work anymore, by the way, someone can help here?

Thanks in advance

Euler

Edited by: Euler Sánchez Gómez on May 5, 2010 5:59 PM

Former Member
0 Kudos

Hi Piers Harding,

1) i was cheking this post and this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12898, so, i decided to install the connector but with no much success, i was reading the install instructions, and in this point

"You must obtain and install the NW RFC SDK from SAP for this extension to work."

i checked this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6519 but i couldnt download it, so, can you give me some different link? by the way, in the route ": Download -> Support Packages and Patches -> Entry by Application Group -> Additional Components -> SAP NW RFC SDK -> SAP NW RFC SDK 7.10 -> SAP NW RFC SDK 7.10 ." didnt work for me.

2) this connector is different that this one?

http://saprfc.sourceforge.net/

thanks in advance

Euler

Former Member
0 Kudos

Hi -

Yes - you must get hold of the NW RFC SDK from service.sap.com - I, unfortunately, don't have a an account so I cannot tell you how to find it (it sounds like the paths have changed since I last could see) - perhaps someone else can help you here. It would also be useful if SAP made the NW RFC SDK available on SDN - anyone?

saprfc is the original RFC connector for SAP - it requires the previous RFC SDK (not NW) so you would still need to get this from service.sap.com some how.

Cheers,

Piers Harding.

0 Kudos

Hi Piers,

Thanks for all your hard work!!! I really appreciate it!!!

We're going to migrate our SAP system from 6.4 to ECC6 this year.

We just installed a test ECC6 system and I'm planning on testing your PHP module.

Just some questions....

Can the module be used in a production environment already, you think?

We don't use that many critical RFC calls on our PHP¨system, but only a few.

But ofcourse, if you say the module is really unstable at th moment, maybe it's better to not use it yet?

Are you going to further develop the module (in the near future), or have you stopped developing it?

Do you have some kind of roadmap on when you would like to have a stable version ready?

Anyway, we're going to test it for a few months. Maybe we can draw our own conclusions.

Many, many thanks in advance.

Former Member
0 Kudos

Hi Guy -

As with all software you need to test it for your particular situation to ensure it performs adequately, but yes, I woould use it in production.

It is only actively developed when people come to me with specific issues - which doesn't happen very often. I think the API is reasonably complete, and in line with the Perl/Python/Ruby versions.

Cheers.

Former Member
0 Kudos

Hi Piers,

your extension runs very fine but in one system I get an error popup:

uncaught exeption 'sapnwrfcConnectionExeption' with message 'Invalid RFC connection handle'

In trace file entry was added

"connection closed without message (CM_NO_DATA_RECEIVED)"

I know this is a system issue but because of the error my script interrupts...

Is there a way to avoid the error or to continue the script after?

Maybe with a change in your sapnwrfc extension?

Best Regards

EM

Former Member
0 Kudos

Hi -

This should be just a matter of catching the appropriate exceptio:


try {
...
}
catch (sapnwrfcConnectionException $e) {
...
}

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi Piers,

Thanks for the hint.

I did not know before that an encased exception handling is possible with Try and Catch.

Ok, I am a PHP rookie. But my PHP enthusiasm grows the more I lern thereof.

Now the script works perfect thanks once more.

But what can I integrate now to my script ........

Best Regards

EM

Former Member
0 Kudos

Hello Piers,

I try to test with PHP the 'Sending and Receiving Tables' example from http://search.cpan.org/dist/sapnwrfc/sapnwrfc-cookbook.pod

But I not understand how to include the table parameter OPTIONS in the PHP. (sorry for the PHP newbie question)

...

$conn = new sapnwrfc($config);

$fds = $conn->function_lookup("RFC_READ_TABLE");

$parms = array('QUERY_TABLE' => 'T000','DELIMITER' =>'|');

//-----???> OPTIONS([{'TEXT' => 'MANDT <> \'000\''}]))

$results = $fds->invoke($parms);

...

Could you give me a hint please.

Or maybe do you have a similar cookbook page for sapnwrfc for PHP ?

Best Regards

EM

Former Member
0 Kudos

Hi -

OPTIONS is a TABLE, and in the Perl example that you mention, you can see that this is represented as an array of hashes (array of records, and a record is a hash of key/values for the row fields).

Translating this to PHP is:


$options = array(array('TEXT' => 'MANDT <> \'000\''));

or the whole thing:
$parms = array('QUERY_TABLE' => 'T000','DELIMITER' =>'|',array(array('TEXT' => 'MANDT <> \'000\'')));

Cheers,

Piers Harding.

Former Member
0 Kudos

For some reason the formatting kills the &lt; and &gt;:



$parms = array('QUERY_TABLE' => 'T000','DELIMITER' =>'|',array(array('TEXT' => 'MANDT &lt;&gt; \'000\'')));

Former Member
0 Kudos

Hi Piers,

many many thanks!

little typo, whole line should be:

$parms = array('QUERY_TABLE' => 'T000','DELIMITER' =>'|', 'OPTIONS' => array(array('TEXT' => 'MANDT &lt;&gt; \'000\'')));

Best Regards

Eugen

Edited by: Eugen Mueller on Jan 21, 2010 10:49 AM (because of same reason as piers )

Former Member
0 Kudos

Hello!

I'm trying to make a connection between PHP and SAP using sapnwrfc, but I am with the following error:

Fatal error: Class 'sapnwrfc' not found in D:\www\test.php on line 33

Installation steps:

System: Windows 2000

Server API: Apache 2.0 Handler

PHP Version 5.2.4

SAP NW RFC SDK 7.10

php-sapnwrfc-win32-prebuilt.zip

1. Downloads:

- SAP NW RFC SDK from http://service.sap.com/patches/ (follow the path of: Download -> Support Packages and Patches -> Entry

by Application Group -> Additional Components -> SAP NW RFC SDK -> SAP NW RFC SDK 7.10 -> SAP NW RFC SDK 7.10.)

- sapnwrfc for PHP from http://piersharding.com/download/php/sapnwrfc/ (php-sapnwrfc-win32-prebuilt.zip)

2. Copy php_sapnwrfc-X.X.X.dll into the C:\PHP\ext folder.

3. Extract the SAP NW RFC SDK and copy all libs from the lib folder to the folder C:\WINDOWS\system32.

4. Edit the php.ini file in the C:\PHP and add the line extension=php_sapnwrfc-X.X.X.dll.

5. Stop and start the apache server and recheck the phpinfo() page. You should now see an entry "sapnwrfc".

Anyone could help?

Thanks in advance!

Aline Sena Vaz

Former Member
0 Kudos

Hi -

It looks like what you are doing is OK, but it is likely that it can't find the extension because of some unsatisfied dependency. When you restart Apache2 do you get anything in the error log?

I think the latest binary build that I have for download is for PHP 5.2.8 so there maybe a version mismatch problem there?

http://www.piersharding.com/download/php/sapnwrfc/php_sapnwrfc-0.06-5.2.8_win32-prebuilt.zip

If anyone has a more recent one that they can supply me, I'll put it up for download.

Also - have you tried the XAMP install instructions from https://wiki.sdn.sap.com/wiki/display/EmTech/RunXAMPPonWindowswithsapnwrfcfor+PHP (it looks like you may have - but just checking).

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi,

I tested o 'php_sapnwrfc-0.06-5.2.8_win32-prebuilt.zip' but without success...

I can not use XAMP software because they already have a PHP configured in the company ...

When i restart Apache2 i get a warning in the error log:

'[Fri Jan 01 12:28:00 2010] [notice] Parent: Created child process 1376

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ \ Program Files \ \ PHP \ \ ext \ \ php_sapnwrfc.dll' - The specified module could not be found. \ R \ n in Unknown on line 0 '

Thanks in advance!

Aline Sena Vaz

Former Member
0 Kudos

HI,

is the file php_sapnwrfc.dll in the directory C:\Program Files\PHP\ext?

Best regards,

Peter

Former Member
0 Kudos

Yes!...

hm ... My system is a Windows 2000 SERVER, can be the problem?

Thanks in advance!

Aline Sena Vaz

Former Member
0 Kudos

Hi -

I looks like you have put the the PHP extension in the correct place as you are seeing the attempt to load it in the log.

It still looks like unsatisfied dependencies at load time, or an incompatibility with the version of PHP - are you able to compile it yourself?

Cheers.

Former Member
0 Kudos

Never did it! : /

Could you help me?

Thanks in advance!

Aline Sena Vaz

Former Member
0 Kudos

I'm sorry - I can't - I don't have a compiler for any windows system. Other generous people have taken the time to build the extensions that are available for download and given them to me, as I only use Linux - maybe you could try Ubuntu?

Cheers.

Former Member
0 Kudos

I do not know anything of these things ...

I'll try to compile a new version of 'php_sapnwrfc.dll' ... I will research how to do this ...

Thanks...

Aline Sena Vaz

Former Member
0 Kudos

Aline,

Did you ever fix your problem?  I have the same issue, I was hoping you could share your solution.

Jon

0 Kudos

Hi all,

I'm starting to feel a little desperate: I did everything as described in

https://wiki.sdn.sap.com/wiki/display/EmTech/RunXAMPPonWindowswithsapnwrfcfor+PHP

but I do not get any hint of an extension "sapnwrfc" anywhere. In fact, on startup I get an error message saying that

"Unable to load dynamic library [such and such] - This application could not be started because its configuration is not correct. Re-install the application."

So, what is wrong?

My System:

XAMPP for Windows, version 1.7. with PHP 5.2.8

php_sapnwrfc-0.06-5.2.8_win32-prebuilt

I do not have any SAP software installed on my computer. I got the relevant DLLs (sapnwrfc.dll and libsapucum.dll) from a colleague of mine and put them where the instructions said: into the folder apache\bin\ of my XAMPP installation. (And also to Windows/system32 but nothing happened.)

I renamed the extension from php_sapnwrfc-5.2.8.dll to php_sapnwrfc.dll and back again (and, yes, I also changed the correct php.ini everytime), but nothing happened.

Do I have to actually install the SAP NW RFC SDK on my system? Do I need anything else running on my machine?

What am I doing wrong?

(The old version, phpsaprfc, I got up and running on the same system, but this new one is a real hassle for me.)

Grateful for any hint or shove into the right direction.

Cheerio

Anja Henkelmann

Former Member
0 Kudos

Hi Anja,

Please make sure that you have got the MS Visual C++ 2008 Runtime installed on your machine. You can download it directly from the Microsoft site ([Link|http://www.microsoft.com/downloads/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2]).

Regards

Joachim

0 Kudos

Hi Joachim,

do I need to install this software that I'll never ever use, or is it enough to have some of its DLLs in my windows/system32?

I'm a bit reluctant to install MS stuff on my working machine only to try out sapnwrfc.

Cheerio

Anja

Former Member
0 Kudos

Hi Anja,

Manually copying the DLLs to your windows/system32 folder is not recommended and may screw up your system or third party applications.

It may be possible to copy the DLLs (msvcr80.dll, msvcp80.dll, msvcm80.dll) together with their corresponding manifest files to the application folder (i.e. location of apache.exe or php.exe - depending on whether PHP is loaded as a module or being run in CGI mode) and get php_sapnwrfc successfully loaded. I haven't given it a try as of now, so I can't tell if it's supposed to work at all.

Personally I wouldn't worry about installing the redistributable package as mentioned above. Chances are, that somedays the C++ runtime will get installed by some third party application (e.g. Nero), anyway.

Regards

Joachim

0 Kudos

Hi Joachim,

thank you, that was the encouragement I needed. So I installed the package and my apache could not be started. I uninstalled the package and my apache can be started.

I give up.

Cheerio

Anja

Former Member
0 Kudos

Hi Anja,

Can you provide me some information about the software you're using? XAMPP? Which version exactly?

Regards

Joachim

Edited by: Joachim Dorner on Oct 8, 2009 2:17 PM

0 Kudos

Hi Joachim,

XAMPP for Windows, version 1.7. with PHP 5.2.8

on a Windows XP machine which gets regular SP etc. via our central software service. This is just my regular working machine.

I work with SAP via Citrix SAP Logon, so no SAP software is installed.

Cheerio

Anja

Former Member
0 Kudos

I have the same problem.

Did you solved it?

Thanks.

Mario

Former Member
0 Kudos

Hallo.

I have the same problem.

"""

Hi Joachim,

XAMPP for Windows, version 1.7. with PHP 5.2.8

on a Windows XP machine which gets regular SP etc. via our central software service. This is just my regular working machine.

I work with SAP via Citrix SAP Logon, so no SAP software is installed.

Cheerio

Anja

""""""""""

Did you solve it?

Thanks.

Mario

Edited by: Ferruccio Galli on Jun 1, 2010 12:20 PM

Former Member
0 Kudos

Solved with NW RFC SDK 7.11

But, for example,

how to call BAPI_DOCUMENT_CHECKOUTVIEW2 ?

Thanks.

Mario

Former Member
0 Kudos

Furthermore, I wolud like to test sapnwrfc_528.dll using the ConnTest.php, FuncDataTest.php

but I always obtain errors:

Warning: require_once(PHPUnit/Framework.php) [function.require-once]: failed to open stream: No such file or directory in C:\Temp\xampp-win32-1.7.1\xampp\htdocs\sapnwrfc\ConnTest.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'PHPUnit/Framework.php' (include_path='.;C:\Temp\xampp-win32-1.7.1\xampp\php\pear\') in C:\Temp\xampp-win32-1.7.1\xampp\htdocs\sapnwrfc\ConnTest.php on line 2

Where to find Framework.php ?

I haven't it on my system...

Thanks

gregorw
Active Contributor
Former Member
0 Kudos

Did anyone ever solve this? I have the same problem.

Former Member
0 Kudos

Hi -

You should just need to install PHPUnit as Gregor pointed out - it's required for Unit tests to run.

Cheers.

Former Member
0 Kudos

Hi Piers, i've a question, how the RFC manage the pool conections on SAP? Or How it works? Some examples or idea?

Thanks

Euler Sánchez G.

Former Member
0 Kudos

Hi Piers,

are you planning to release an updated prebuilt windows version? Not that I am complaining

I'm having big issues making it work on a Windows 7 Ultimate 64-bit operating system.

Xampp works fine, but when I add php_sapnwrfc-5.2.8.dll as an extension, Apache crashes.

Checked with Dependency Walker and it complains about php5ts.dll, sapnwrfc.dll and libsapucum.dll, that it can't find them.

Guvenc

former_member249154
Discoverer
0 Kudos

I have the same error messages with php_sapnwrfc-0.0.10-5.3.4.dll

hschaefer123
Participant
0 Kudos

Hallo Piers,

playing around with prebuild php_sapnwrfc-0.06-5.2.8_win32-prebuilt, i figured out some problems.

1) strange problems

Some functions seems to aborts php scripting without errors. there is also no output inside

the *.trc file (only open and closing connection. there is no error inside the apache log!?!

i have a rfc that works inside se37, changing on import tabel param to illegal name return

error message from sap. the normal case is, that this function call does not return any information

about the error.

how can i find out the problem for the function call?

i tried nw 7.10 and also 7.11 lib. under windows, the trace worked for me only against 7.11 lib.

2) rfc description

inside the trace i found the information about the input structure description.

is there a way to use the nwlib to get information/description about the structure of used input/import fields.

i want to autogenerate a php proxy for needed input structures like web service proxies

to make things like copy corresponding of different structures easier.

Best wishes,

Holger

Former Member
0 Kudos

Hi Holger -

can you show the PHP code, and a cut down version of the RFC that gives you the problem. It will make it easier to try and help you.

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi,

As usual I did a lot of misstakes and errors but finally I had sapnwrfc for PHP working on Mandriva 2007, just to realise that if you read and follow the install instruction, it takes about 10 minutes the first time (I used about six hours). BUT how do I use sapnwrfc?

Is there some documentation somewhere? I read the connect example and the unittests but it does not tell me very much. E.G. how do I get the export meta data?

I run BAPI_CURRENCY_GETLIST and I get a nice array of associative arrays as a result. In the result there is a field 'VALID_TO' that shows up as string(8), but it is a SAP DATE field. I can not for my life figure out how to find out the original SAP data type for the result of a function call.

Any help is highly appreciated.

Former Member
0 Kudos

Hi Lars -

The unit tests are quite a good start, but unfortunately, it does expect you to know a lot about RFC, ABAP, and SE37 in general. It would be great if people who were working and using all of the sapnwrfc connectors (PHP, Perl, Python, and Ruby), blogged about their path to enlightenment, frustrations, ideas, and triumphs.

If you want meta data for the function calls, then there are specific functions for finding this:

RFC_GET_FUNCTION_INTERFACE_P and RFC_GET_UNICODE_STRUCTURE, RFC_GET_STRUCTURE_DEFINITION_P.

You should find what you need in here.

Cheers.

Former Member
0 Kudos

Thank you very much for your answer.

The reason I need the meta data is I have an interface to the 'old' SAPRFC which can 'autoload' the result into Mysql and I need the meta-information for the SQL 'create table' statements.

I will study your reply and go through the unit tests again and read more carefully this time.

I start build my interface to sapnwrfc today and I will come back with more questions. I hope you do not mind to much.

Example how I use SAPRFC today. I have a job scheduler that controls execution of jobs like:

<job name='curRte' type='script' pgm='sap2.php' comment='Run BAPI for each row in array driver0'>

<!-- sap2.php is my interface to SAPRFC -->

<mydriver>

<name>@J_generate_driver/driver0</name>

<select>('@RATE_TYPE'=='EURO')</select>

</mydriver>

<sap>

<rfc>

<name>BAPI_EXCHRATE_GETCURRENTRATES</name>

<import>

('DATE',@TODAY)

,('DATE_TYPE','V')

,('RATE_TYPE','@RATE_TYPE')

</import>

</rfc>

</sap>

<sql>

<autoload>replace</autoload><database>@C_DB</database><truncate>yes</truncate>

<table>EXCH_RATE_LIST</table> <!-- Only load table EXCH_RATE_LIST -->

</sql>

</job>

Something different. I have recently taken a lot of interest in perl6, will you port sapnwrfc to perl6?

Former Member
0 Kudos

When Perl6 has a production release candidate, then yes, I will port it, but I still think that is some way away yet.

However - if you are interested in Perl6, then in the meantime you can always look at MooseX::Declare

Cheers.

Former Member
0 Kudos

Hi Piers,

The new sapnwrfc is simple to work with. As usual I messed up things, but I do a rewrite now that I understand sapnwrfc better. I still have some problems with chinese letters/signs, not all of them look the same when I look at them in Mysql and SAP, but most of then do so I'm on the right track

I compiled sapnwrfc into PHP 5.3 RC2. I had to comment out a 'static' declaration in sapnwrfc.c for the compile to work. Will you come out with a PHP 5.3 version when 5.3 is released?

Thanks again. SAPNWRFC is really really cool.

Former Member
0 Kudos

Sure - I'll probably do support for 5.3 when Ubuntu offer it by default.

Cheers.

Former Member
0 Kudos

Hi Piers,

I have an RFC function with no import parameters. It runs without input and returns a table. In this case, how should the invoke command be used (as it requires an array of parameters) ?

$results = $fds->invoke($parms);

Former Member
0 Kudos

Hi -

$fds should be the RFC call container - and instance of an RFC call that you have populated the parameterrs (in this case none), invoke(), and then inspect the return parameters (export/changing parameters, and tables) afterwards.

So - you should only need to do $fds->invoke() - invoke() has no arguments.

The documentation for sapnwrfc for Perl, has had a lot of work on it recently - have a look here http://search.cpan.org/dist/sapnwrfc/sapnwrfc-cookbook.pod , as it should help you understand how it is supposed to work.

Cheers,

Piers Harding.

Former Member
0 Kudos

Actually, I have tried invoke() without arguments before and I get following error:

object(Exception)#3 (7) { ["message:protected"]=> string(64) "sapnwrfc_function::invoke() expects exactly 1 parameter, 0 given" ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(34) "C:\xampp\htdocs\sap\sm04\zsm04.php" ["line:protected"]=> int(91) ["trace:private"]=> array(1) { [0]=> array(6) { ["file"]=> string(34) "C:\xampp\htdocs\sap\sm04\zsm04.php" ["line"]=> int(91) ["function"]=> string(6) "invoke" ["class"]=> string(17) "sapnwrfc_function" ["type"]=> string(2) "->" ["args"]=> array(0) { } } } ["severity"]=> int(2) } Exception message: sapnwrfc_function::invoke() expects exactly 1 parameter, 0 given

Fatal error: Uncaught exception 'Exception' with message 'Assertion failed.' in C:\xampp\htdocs\sap\sm04\zsm04.php:130 Stack trace: #0 thrown in C:\xampp\htdocs\sap\sm04\zsm04.php on line 130

0 Kudos

Hi Mr. Harding

Just out of curiosity...

Are you still working on this project?

Next year we'll do an upgrade of our SAP system.

Afer then I would like to test the NW RFC SDK with PHP to the fully.

We've already have a lot of experience with the old saprfc SDK and the SAPRFC module for PHP. It works superb! We just can't live and work without it anymore.

Many thanks in advance.

Former Member
0 Kudos

Yes - this is still supported, as are all of the connectors that I have developed for the NW RFC SDK.

Cheers.

Former Member
0 Kudos

Hi Piers, hello again,

how can we send a table parameter?

I have a rfc function which expects a table besides import parameters. Import parameters are no problem, but when I try to send the table as an array in $parms, I get:

Fatal error: RFC FUNCTION CALL ERROR: set_table_line invalid Input value type in C:\xampp\htdocs\myscript.php on line 100

Former Member
0 Kudos

Hi -

passing tables is no problem at all - have a look at the unit_tests directory that comes with the module - in there there are a number of examples - especially FuncDataTest.php.

Cheers,

Piers Harding.

Former Member
0 Kudos

>

> Hi -

> $fds should be the RFC call container - and instance of an RFC call that you have populated the parameterrs (in this case none), invoke(), and then inspect the return parameters (export/changing parameters, and tables) afterwards.

> So - you should only need to do $fds->invoke() - invoke() has no arguments.

>

> The documentation for sapnwrfc for Perl, has had a lot of work on it recently - have a look here http://search.cpan.org/dist/sapnwrfc/sapnwrfc-cookbook.pod , as it should help you understand how it is supposed to work.

>

> Cheers,

> Piers Harding.

Taking a peek at problem, I solved it by using:

$results = $fds->invoke(array());

invoke() has no arguments, but expects an array, so passing an empty array is mandatory.

Former Member
0 Kudos

> Hi -

>

> passing tables is no problem at all - have a look at the unit_tests directory that comes with the module - in there there are a number of examples - especially FuncDataTest.php.

>

> Cheers,

> Piers Harding.

Hi Piers,

I looked at the examples in the units_tests directory. I could not see an example in which you pass a TABLE as parameter, but IMPORT parameters instad. For example, in FuncTest.php, you passed IMPORT_TABLE, ROWCOUNT and OPTIONS parms, which are IMPORT parms. However, RFC_READ_TABLE accepts also a table named FIELDS and I need an example about the usage of this.

EDIT: I was mistaken, OPTIONS IS a table parameter.

And you wrap such in an additional array, like:

$parms = array( 'QUERY_TABLE' => $TABLENAME,

'FIELDS' => array(array('FIELDNAME' =>"TCODE"))

);

Thanks,

Guvenc

Edited by: Guvenc Kaplan on Dec 9, 2009 10:57 AM

Former Member
0 Kudos

It seems that I can't pass multiple FIELDNAMES.

I also want the TTEXT field in addition to TCODE. How can I do that?

Former Member
0 Kudos

I would expect that you need to do something like:

$parms = array( 'QUERY_TABLE' => $TABLENAME,

'FIELDS' => array(array('FIELDNAME' =>"TCODE"), array('FIELDNAME' =>"TTEXT"))

);

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi Piers,

exactly. It works this way (although I had discovered it by a trial-error basis )

Thanks a lot for your answer.

Former Member
0 Kudos

For your info, I get the following error message when I try to download the file php_sapnwrfc-0.06-5.2.8_win32-prebuilt.zip.

Forbidden

You don't have permission to access /download/php/sapnwrfc/php_sapnwrfc-0.06-5.2.8_win32-prebuilt.zip on this server.

Former Member
0 Kudos

Ooops! I've fixed the permissions, so you should be able to download it now.

Cheers.

Former Member
0 Kudos

This is great news. Kudos to Piers! I had almost no hope that a Unicode RFC library would come for PHP... This made my day...

What should I do to use the library under Debian Etch?

gregorw
Active Contributor
0 Kudos

Hi,

I think it should compile like a charm. I've tested it on Etch.

Best regards

Gregor

Former Member
0 Kudos

Hi Gregor, actually I have used a pre-compiled binary for Windows before and did not compile any .so files on Debian.

Do I need the SAP NW RFC SDK? Do I need the PHP Source Code?

I have downloaded:

SAP NW RFC SDK 7.11

Linux on IA32 32bit

(NWRFC_1-20004547.SAR)

from SAP Support Portal. What should I do now? I appreciate any instructions.

gregorw
Active Contributor
0 Kudos

Hi,

I've created a Wiki Page [Compile sapnwrfc for PHP on Debian Linux (Lenny) |https://wiki.sdn.sap.com/wiki/x/6YH8B]. Hope that helps.

Best regards

Gregor

Former Member
0 Kudos

Thank you Gregor, I had just discovered SAPCAR and added it to SAP Download Mngr. Will follow your instructions, let's see what happens

Former Member
0 Kudos

For people who use XAMPP, one thing worth mentioning is that XAMPP uses the php.ini in "C:\xampp\apache\bin" as default and NOT the one in "C:\xampp\php". So if you accidentally add the line "extension=php_sapnwrfc.dll" to C:\xampp\php\php.ini, it won't get loaded. You may also want to change the flag "display_startup_errors = Off" to "display_startup_errors = On".

gregorw
Active Contributor
0 Kudos

Hi,

so my description in the Wiki Page: [Run XAMPP on Windows with sapnwrfc for PHP |https://wiki.sdn.sap.com/wiki/x/9wCJB] is correct :-).

Best regards

Gregor

Former Member
0 Kudos

It is far more than correct, in fact it is perfect

Former Member
0 Kudos

Some tips for those who are running Debian and have trouble installing the nwrfcsdk itself:

- copy the nwrfcsdk folder to /usr/nwrfcsdk/

- configure phpsapnwfrc with:

./configure --with-sapnwrfc=/usr/nwrfcsdk

option.

if you get this error while trying make:

bash: make: command not found

try

apt-get install build-essential (this installs make).

create symlinks of the files in /usr/nwrfcsdk/lib/ in /usr/lib/ folder.

create symlinks of the files in /usr/nwrfcsdk/bin/ in /usr/sbin/ folder.

gregorw
Active Contributor
0 Kudos

Hi Guvenc,

you can add your tips to the Wiki Page [Compile sapnwrfc for PHP on Debian Linux (Lenny)|https://wiki.sdn.sap.com/wiki/x/6YH8B].

Best regards

Gregor

Former Member
0 Kudos

I just downloaded XAMPP today and installed it. There is no php.ini in apache\bin, but there is one in php\. I edited the php\php.ini file and it loaded just fine.

Cheers,

David.

Former Member
0 Kudos

Hi Piers,

thanks for the information.

The server is only internal and there are very much dependencies so we use safrpc for the following months.

Regards, Markus

Former Member
0 Kudos

Hi Nigel,

thanks for your answer. Because it is a linux server, it is not that easy to update. There are a lot of dependencies in compiled extensions and there are no new rpms (PHP, Apache, MySQL, ...) for SuSE 9.1. That would be a big advantage in a productive environment.

If sapnwrfc needs PHP5, we have to use SAPRFC as long as it does the job...

Regards,

Markus

Former Member
0 Kudos

We have a SuSE Linux 9.1 installation with PHP 4.3 running and compiling of SAPRFC a few years ago was no problem.

No I want to test the new sapnwrfc (thanks a lot for the creation of it!) and downloaded the new sdk 7.1 from SAP. When starting "make", there are a lot of errors and it quits with error 1.

Because there are different ZEND_* errors my question is if sapnwrfc is supported for PHP 4.x? Or can the problem be caused because of the wrong sdk files (there are only some for SLES 9), the binaries in nwrfcsdk/bin are not executable.

What can I do now?

Nigel_James
Active Contributor
0 Kudos

Hi Marcus,

I would guess not. PHP 4 support finished on 08/08/2008 and you would be well served to upgrade to PHP 5.2.8. http://php.net/downloads.php

Depending on how you have written your code it should not be too much trouble to upgrade your code to work with php 5.

Cheers,

Nigel

Former Member
0 Kudos

Hi -

As Nigel has pointed out PHP 4 is out of support, so you should upgrade as this is a liability/vulnerability for your business.

Is SUSE 9.1 out of support too?

I would strongly recommend upgrading, YaST is a perfectly reasonable upgrade tool to work with, and I hope you take up the challenge.

Cheers,

Piers Harding.

Former Member
0 Kudos

Updated version 0.06 available with exceptions, and activate/deactivate of RFC call parameters -> http://www.piersharding.com/blog/archives/2009/02/sapnwrfc_for_ph_1.html

Cheers.

former_member182779
Active Contributor
0 Kudos

Piers:

Already download the pre-build version for Win32....Going to test it tonight or tomorrow in the morning -:D

Greetings,

Blag.

Former Member
0 Kudos

Excellent! I am very interested to hear how you get on.

Infact - it would be really good if people blogged their experiences, and examples of what they are developing.

Cheers.

Former Member
0 Kudos

Hi,

I'd like to know if anybody had success using this under Windows/Apache?

I am trying to use in a devel enviroment with no luck : Windows XP (SP3) + XAMPP 1.7.0 (Apache + Php 5.2.8) + Client 7.1.0 .

I've downloaded the php-sapnwrfc-win32-prebuilt.zip and installed in c:\xampp\php\ext and updated php.ini but the module is not being loaded.

Fatal error: Call to undefined function sapnwrfc_version()

The server has been restarted and I've even enabled a random ext just to make sure it appears. Any ideas?

Former Member
0 Kudos

It sounds like you have dependency issues. Have you checked the pre-built library with a dependency walker?

Cheers.

Former Member
0 Kudos

Hi Mario,

You will need to have some files from the NW RFC SDK copied to your Windows' system directory, as well as the MS C++ 2008 runtime installed. Please refer to the readme file inside the binary package for details about the download locations.

Note, that the filename of the binary in the package contains the version number of the PHP version it has been compiled for. You will have to remove it before you're trying to load the extension according to the description in the readme.

Best regards,

Joachim

gregorw
Active Contributor
0 Kudos

Hi Mario,

have you read this Article in the SCN Wiki: [Run XAMPP on Windows with sapnwrfc for PHP|https://wiki.sdn.sap.com/wiki/display/EmTech/RunXAMPPonWindowswithsapnwrfcfor+PHP]? Where I describe the Setup of XAMPP with sapnwrfc for PHP.

Best regards

Gregor

Former Member
0 Kudos

Hi Gregor,

Thanks for the reply.

No I did not read you wiki page. I've read it and seems that I skipped the part that copies the dlls from the SAP NW RFC SDK to windows.

I assumed that the old librfc32.dll was enough or that the SAP GUI 7.1.0 installed those dlls (sapnwrfc.dll and libsapucum.dll).

One thing that seems strange to me is that the old sap rfc php connector mentions to copy the librfc32.dll to windows\system32 and your wiki mentions to copy the dll to c:\xampp\apache\bin. Would it work if I copied those dlls to windows\system32?

- Mario

Former Member
0 Kudos

Hi Joachin,

No I did not copy because I thought that the SAP GUI did it for me. I do not have the SAP NW SRC SDK with me so I'll have to wait until I cat get it and try again.

Is there any place where I can fetch those dlls (and just those) whithout having to login to SAP? My contractor has the user'/pass but it will take a while for him to fetch and send me the files.

Former Member
0 Kudos

sapnwrfc is a rewrite - it relies entirely on the new functionality in the NW RFC SDK, so you will absolutely need that before you can continue. You need to get it from service.sap.com.

Unfortunately, SAP has not yet seen fit to supply the NW RFC SDK in a publicly downloadable form, something that will not change unless the community brings this to their attention - after all, the likes of Oracle have supplied connector libraries free for almost a decade now.

Cheers,

Piers Harding.

Former Member
0 Kudos

Mario,

tell your contractor to visit the note 1025361 and follow steps, described there. It will take not longer than 3 minutes

gregorw
Active Contributor
0 Kudos

Hi Mario,

I've put the files in the \xampp\apache\bin folder so the xampp is still portable if you run it from a USB Stick. But windows\system32 should work as well.

Best regards

Gregor

Former Member
0 Kudos

Hi Alexander,

I've managed to get access to SAP's patches site. Where can I find this note 1025361? With the 'path' to find the required files?

gregorw
Active Contributor
0 Kudos

Hi Mario,

the link to the note is https://service.sap.com/sap/support/notes/1025361. You can use the SAP Note search at http://service.sap.com/notes to find it.

Best regards

Gregor

gregorw
Active Contributor
0 Kudos

Hi my fellows,

I've created a Page [sapnwrfc for PHP |https://wiki.sdn.sap.com/wiki/x/9QCJB] on the SDN Wiki where documentation and howto's can be published.

Best regards

Gregor

Former Member
0 Kudos

I've worked through the list of remaining (unimplemented) functions in the NW RFC SDK API, and ignoring the RFC Server specific ones, I've come up with the list below. I would be interested to get an idea of priority for implementation from people.

RfcSetIniPath();

RfcPing();

RfcGetPartnerSSOTicket();

RfcGetPartnerSNCName();

RfcGetPartnerSNCKey();

RfcSNCNameToKey();

RfcSNCKeyToName();

RfcGetTransactionID();

RfcCreateTransaction();

RfcInvokeInTransaction();

RfcSubmitTransaction();

RfcConfirmTransaction();

RfcDestroyTransaction();

RfcSetParameterActive();

RfcIsParameterActive();

RfcEnableBASXML();

RfcIsBASXMLSupported();

Cheers,

Piers Harding.

Former Member
0 Kudos

Cool. The most perfect news

I've made a build for win32. It works :).

VC2008 Express with WinDDK (from connect.microsoft.com) is used to compile. WinDDK is necessary, because PHP for Windows depends on MSVCRT.DLL. It means, PHP is builded with MSVC6. So, If building directly with VC2008 libraries, than php_sapnwrfc will depends on vc2008 runtime, which is not msvcrt.dll and than we have two different runtimes, which is dangerous for PHP.

I can provide .vcproj file to build with visual studio and dll for win32

Former Member
0 Kudos

Hi -

This sounds good, but what is the most common windows setup out there that people are likely to use? is it http://www.apachefriends.org/en/xampp-windows.html ? What I think would be ideal is to specify a common starting point like this, and then provide a drop in prebuilt module for it.

What do you think?

Cheers,

Piers Harding.

Former Member
0 Kudos

Hello Piers,

once again: nice job!

I've done a win32 build without using the DDK and it works perfectly. If you do a dependency walk over some of the extensions that come with XAMPP, you'll notice that they are linked against all possible versions of C++ runtimes. Even the current "old" saprfc extension uses msvcr90.

Additionally the NW RFC is linked against msvcr80 itself, so you will never have a homogenous environment.

Concerning the common starting point, I can't tell if it's problematic to load a "generic" extension into different types of WAMP stacks at all. My bet is, that it should work out of the box in almost all cases - assuming you're using the correct PHP version.

I have been using XAMPP for myself ever since I can remember. And I love it for development purposes but wouldn't recommend it for production use. Moreover I think that in a SAP environment IIS in combination with the standard PHP package is a common setup, too.

Best regards,

Joachim

Former Member
0 Kudos

This is great.

I'm still uncertain as to which way to go with this. It would be good if other people discussed how they put together their production environments, so we can compare. My gut feeling would be one of the LAMP stacks, is what most people use, but I have no real way of telling.

Can you supply me with the prebuilt extension, and if SAP will give me the NW RFC SDK for windows, then I'll do some testing - although, I can't test IIS.

Cheers,

Piers Harding.

Nigel_James
Active Contributor
0 Kudos

Alexander or Joachim,

Any chance you can post a visual studio project for your builds? I am attempting a build for win7 64bit and that would be a great start.

Thanks,

Nigel

gregorw
Active Contributor
0 Kudos

Hi Nigel,

have you heard about http://www.cmake.org/ it is a cross-platform, open-source build system. Perhaps the build could be migrated there and we have cross platform support.

Best regards

Gregor

Nigel_James
Active Contributor
0 Kudos

Thanks Gregor. I had a quick look. Have you had any experience with the tool?

gregorw
Active Contributor
0 Kudos

Hi Nigel,

no, I've just heard about it in FLOSS Weekly episode 111: http://twit.tv/floss111.

Best regards

Gregor

Former Member
0 Kudos

Hi Nigel -

there is a vcproj file in this archive http://www.piersharding.com/download/php/sapnwrfc/php-sapnwrfc-win32-prebuilt.zip - apologies to who ever supplied me with it, as I can't remember.

If you find that this is useful, let me know, and I will include it into the distribution.

Cheers,

Piers Harding.

Former Member
0 Kudos

I've uploaded version 0.03. This has some fixes around looking after memory after errors, and it also has started fleshing out coping with OSs other than Linux for building (please go here: http://www.piersharding.com/download/php/sapnwrfc/).

The main mechanism for controlling build in PHP is config.m4 - there is a section there allready for controlling compiler flags. If anyone has experience at building for win32, and can figure out how to make this work, then please have a crack at it, and let me know.

Cheers,

Piers Harding.

gregorw
Active Contributor
0 Kudos

Hi Piers,

what do you think of renaming the sapnwrfc-X.XX file and folder to php-sapnwrfc-X.XX? So it wouldn't conflict with your other connectors when extracting them all in /usr/local/src as I do.

Best regards

Gregor

gregorw
Active Contributor
0 Kudos

Hi Piers,

I've successfully compiled version 0.03 on my Debian Sarge Linux box. Here are some small issues I've faced:

  • the u16lit.pl file is in the subfolder tools/toos/ and not as expected by the make file in tools/. I moved it one folder up and then it compiled like a charm against NW RFCSDK 7.10 Patchlevel 2 and also 7.11 Patchlevel 1.

  • The output of method sapnwrfc_version() shows version: 0.3 and not 0.03.

  • The output of sapnwrfc_rfcversion() for 7.10 Patchlevel 2 is major: 7 minor: 11 patch: 0 and for 7.11 Patchlevel 1: major: 7110 minor: 0 patch: 0

I will continue now running some tests against my Unicode CRM 2007 IDES.

Best regards and thank you again,

Gregor

gregorw
Active Contributor
0 Kudos

What I mentioned for the tools folder apply also to /unit_tests and /examples which also have a deep structure: /unit_tests/unit_tests/ and /examples/examples/.

Former Member
0 Kudos

sure - no problem.

I've renamed the existing archives, and rebuilt 0.03.

Cheers.

Former Member
0 Kudos

There was a generic problem in the script I was using to build the archives. I've fixed this,and all the directories should now be aligned correctly.

Uploaded 0.03 again.

Cheers.

Former Member
0 Kudos

with respect to the version functions - for sapnwrfc_version(), the issue is just formating to 0 pad - this I have fixed and will be in 0.04.

for sapnwrfc_rfcversion(), this is derived from the call to RfcGetVersion(&majorVersion, &minorVersion, &patchLevel);

Is this reporting incorrectly?

Cheers.

Nigel_James
Active Contributor
0 Kudos

Thanks for this Piers,

I mostly work with Centos so I will build a VM soon and give it a spin.

Nigel