on 01-05-2006 3:34 AM
Happy New Year,
In server.php still got problem.
Warning: RFC Error Info : Key : RFC_IO5 Status : CODE=CM_PRODUCT_SPECIFIC_ERROR STATUS=??? DATA=??? ID=??? Message : connection closed Internal: IO HANDLE=1 DRV=??? LINE=1483 CODE=5 in C:\Inetpub\wwwroot\INTAN\server.php on line 99
My web server configuration : Windows 2000 & Apache. I've written extension=php_saprfc.dll in php.ini. I still have no idea to call php function from SAP (SM49).
hi everyone,
just tested it too, and have two comments (instead of cents ).
1) what Gregor described is correct but you have to be in the directory where server.php resides
(I assume you haven't server.php's directory on your path)
2) I think php-cgi.exe is the correct executable for this. It's per default in the same directory as php.exe.
3) I've modified the server program for me, so that it doesn't close after every call and to make it a little
more understandable, here it is:
[code]
<?
$interface[0] = array (
"name"=>"GREETING",
"type"=>"EXPORT",
"optional"=>"0",
"def"=> array (
array("name"=>"","abap"=>"C","len"=>13,"dec"=>0)
)
) ;
$rfc = saprfc_server_accept ($argv);
$fcl["CALL_ME"] = saprfc_function_define(0,"CALL_ME",$interface);
while (true)
$rc = saprfc_server_dispatch ($rfc, $fcl);
function call_me($fce) {
saprfc_server_export ($fce,"GREETING","HELLO HUGO!!!");
return (true);
}
?>
[/code]
from abap you call it like
[code]
REPORT ZTW_CALLPHP.
data l_greeting type string.
CALL FUNCTION 'call_me' destination 'PHPCONNECTOR'
IMPORTING GREETING = l_greeting.
write l_greeting.
[/code]
Obviously the php-connection in SM59 is
PHPCONNECTOR/Connection Type T'/Registered Server Program'
4) It's advisable to set maximum execution time in php.ini to whatever large number otherwise the php
script dies quickly
Oops, a lot more than two comments. I'll delete the last two. Better not.
regards,
anton
Message was edited by: Anton Wenzelhuemer
Message was edited by: Anton Wenzelhuemer
why doesn't it do correct line breaks? Hmmm...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Budi,
what where your exact command to call server.php? What SAP Server do you use? What hostname/IP does it have? What is the instance number? Have you used the SAPRFC Module to call RFC Enabled function modules in your Backend sucessfully?
Regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Gregor,
I've made php script to calling SAP Function, successfully. Modify it from saprfc_test.php generator, that is easy.
But I don't know how to call server.php?From SM59 or CLI command on web server or what?
Is this command :
$argv="./server.php -a phpgw -g 10.1.2.254 -x sapgw00";
$rfc = saprfc_server_accept ($argv);
THX
Hello Budi,
1. you have created a TCP/IP Connection in SM59 for registering with the Program ID phpgw?
2. Find out where on the Webserver the File php.exe is located. On my system it is in C:\php\php.exe
3. Open cmd on the Webserver change to the Directory where your server.php File is located and run:
C:phpphp.exe server.php -a phpgw -g 10.1.2.254 -x sapgw00
Now it should be possible to do a connection test from SM59. But the connection test does 4 pings and the server does not create a new instance after the call so you have to start it again and again to complete the connection test. I would suggest to use SAP Java Connector (JCo) for a external server. I've described this in my Weblog: <a href="/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection">Setup and test SAP Java Connector outbound connection</a>.
Regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.