cancel
Showing results for 
Search instead for 
Did you mean: 

Connection with SAPRFC using PHP

09-21-2020 1:31 PM
4404 views 1 comments
0 Likes
Subscribe

I want to do a connection with SAP-RFC using PHP. I have installed 'Wamp' server with PHP 5.2.8, Apache 2.0.54 and SAP-RFC 1.4.1. I am using old version of PHP because I could not find much of help for PHP version 7.2.

I have done the following steps:

1. Changed in parameters like Host/server IP, System number, R3 name, client, username and password.
2. Put DLL files in the extension folder and mentioned it in the PHP.ini file.
3. Added librfc32.dll file in the system32 directory.

$LOGIN = array ( // Set login data to R/3"ASHOST"=>"xx.xxx.x.xxx", // application server host name
"SYSNR"=>"00", // system number
"CLIENT"=>"130", // client"USER"=>"xxxx", // user
"PASSWD"=>"xxxx", // pasword
"CODEPAGE"=>"1404"); // codepage

$rfc = saprfc_open ($LOGIN);
if (! $rfc )
{
echo "RFC connection failed with error:".saprfc_error();
exit;
}

--------------------------------------------------------------------------------------------

include_once ("../sap.php");
$sap = new SAPConnection();
// Params: hostname sysnr $sap->ConnectToApplicationServer ("xx.xxx.x.xxx ", "00");
// Params: client username password language $sap->Open ("130", "xxxx","xxxxx","EN");

// Login credentials have been added in the code.
$sap->PrintStatus();
$sap->GetSystemInfo();
echo "<BR><PRE>"; print_r ($sap); echo ("</PRE>");
$sap->Close();

------------------------------------------------------------------------------------------------------

Output - "SAP RFC extension is not installed. Exiting...."

Your help would be highly appreciated.

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

cris_hansen
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sandeep,

I am not aware of any SAP official material. Looking in the internet I found this extension for PHP and this question. I didn't test, but it seems that it is what you are looking for.

Regards,

Cris