Using Rfc Connector from PHP

You can use Rfc Connector from PHP5 using the built-in COM()-Extension.

 // set up connection
 $rfc = new COM("RfcConnector.RfcSession");
 $rfc->RfcSystemData->ConnectString = "SAPLOGON_ID=N4S";
 // ...
 
 // connect to SAP
 $rfc->Connect();
 
 // import function call
 $fn = $rfc->ImportCall("BAPI_FLIGHT_GETLIST");
 
 // set parameters
 $fn->Importing["AIRLINE"]->value = "LH";
 
 // call the function
 $rfc->CallFunction($fn, True);
 
 // print the result
 foreach($fn->Tables["FLIGHT_LIST"]->Rows as $row)
 {
 	print $row["AIRLINE"].", ".$row["FLIGHTDATE"].", "
 	print $row["CITYFROM"].", ".$row["CITYTO"]."<br/>";
 }

Example Source


icon Rfc Connector PHP Example PHP_RfcConnector.zip | 1.61 kB | Date: 2012-02-14

Example how to use Rfc Connector with PHP5


Limitations

Since there is not yet a 64-bit Rfc Connector available you need a 32-bit version of PHP, either running from the command line, with Fast CGI or with 32-bit Apache and mod_php. Regarding the availability of 64-bit Rfc Connector, please refer to Knowledgebase Entry #0005.