Les escribo a ver si alguien me puede ayudar:
Necesito Conectarme con SAP a traves de RFC,estoy trabajando con el php 5.0.5 y Apache/2.0.54 (Win32)
- El php_saprfc.dll, lo puse en c.../php/ext/ y tambien en c.../php (a sugerencia de algunos amigos de la red).
- aumente la siguiente linea de codigo en el php.ini: extencion = php_saprfc.dll
- tambien puse el librfc32.dll en la carpeta system del window.
¿RFC funciona con php 5.0.5?
Alguien tiene un ejemplo , el ejemplo es este pero me falta la configuracion del php.ini ,cambiar de version seria un parto , ya que hay sistema que utilizan la version de php 5.0.5.
<html>
<head>
<title> Get the user list (SM04) using RFC and SOAP</title>
</head>
<body>
This is an example of getting the user list similar to the transaction SM04.
<p>
The example first get the data using SAPRFC and then using the PHP5 SOAP extension.
<?php
// Create the login data for the RFC Connection
$login = array (
"ASHOST"=>"ld0108.wdf.sap.corp",
"SYSNR"=>"18",
"CLIENT"=>"220",
"USER"=>"ASTILL",
"PASSWD"=>"Password",
"R3NAME"=>"LSR",
"GROUP"=>"PUBLIC",
"LANG"=>"EN",
"CODEPAGE"=>"1100");
// Open the connection to the R/3 Server
$rfc = saprfc_open ($login );
if (! $rfc ) {
echo "<b>RFC connection failed</b><br>";
} else {
//Discover interface for function module TH_USER_LIST
$fce = saprfc_function_discover($rfc,"TH_USER_LIST");
if (! $fce ) { echo "Discovering interface of function module failed"; exit; }
//Fill internal tables
saprfc_table_init ($fce,"LIST");
//Do RFC call of function TH_USER_LIST, for handling exceptions use saprfc_exception()
$rfc_rc = saprfc_call_and_receive ($fce);
if ($rfc_rc != SAPRFC_OK) {
if ($rfc == SAPRFC_EXCEPTION ) {
echo ("Exception raised: ".saprfc_exception($fce));
} else {
echo (saprfc_error($fce));
exit;
}
}
//Retrieve export parameters
$rows = saprfc_table_rows ($fce,"LIST");
echo "<p><table border='1'>";
echo "<tr><td>Count</td><td>Client</td><td>Username</td><td>TID</td><td>Time</td><td>Terminal</td><td>Type</td></tr>";
for ($i=1;$i<=$rows;$i++) {
$LIST[] = saprfc_table_read ($fce,"LIST",$i);
}
// Get a key value pair for each row
while(list($num,$row) = each($LIST)) {
// Extract the variables from the array into the current symbol table
extract($row);
echo "<tr><td>$num</td><td>$MANDT</td><td>$BNAME</td><td>$TID</td><td>$ZEIT</td><td>$TERM</td><td>$TYPE</td></tr>";
}
echo "</table>";
saprfc_function_free($fce);
saprfc_close($rfc);
}
flush();
echo "<p>Now use SOAP to make the call to the Web Service<br>";
// Same call using the PHP Web Service
try {
$client = new SoapClient("wsdl11.xml",
array( "login" => "ASTILL",
'trace' => 1,
"password" => "Password") );
// Create the complex array to match the structure defined in the WSDL.
// The function __getTypes() can help describe this structure.
$res = array( "LIST" => array( "UINFO"=>array("TID"=>"",
"MANDT"=>"",
"BNAME"=>"",
"TCODE"=>"",
"TERM"=>"",
"ZEIT"=>"",
"MASTER"=>"",
"HOSTADR"=>"",
"TRACE"=>"",
"EXTMODI"=>"",
"INTMODI"=>"",
"TYPE"=>"",
"STAT"=>"",
"PROTOCOL"=>"",
"GUIVERSION"=>"",
"RFC_TYPE"=>"")));
$res = $client->TH_USER_LIST($res);
// At this point we have an object.
$lst = $res->LIST->item;
echo "<br><table border='1'>";
echo "<tr><td>Count</td><td>Client</td><td>Username</td><td>TID</td><td>Time</td><td>Terminal</td><td>Type</td></tr>";
// Get a key value pair for each row
while(list($num,$row) = each($lst)) {
// Extract the variables from the array into the current symbol table
echo "<tr><td>$num</td><td>$row->MANDT</td><td>$row->BNAME</td><td>$row->TID</td><td>$row->ZEIT</td><td>$row->TERM</td><td>$row->TYPE</td></tr>";
}
echo "</table>";
} catch (SoapFault $exception) {
echo "<p>Exception<br>";
echo $exception;
echo "<p>Request :<br>", htmlspecialchars($client->__getLastRequest()), "<br>";
echo "Response :<br>", htmlspecialchars($client->__getLastResponse()), "<br>";
}
?>
<p>
If both calls were successful you will see that the connection for the user differs in type. Type 32 for the RFC call and type 202 for the Web service.
</body>
</html>