Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PHP ABAP Connection

Former Member
0 Likes
3,948

Hey, Guys
Is there any possible way to connect PHP with our ABAP?How?
just like PHP with my MYSQL.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,168

Hello Darshan & Mike,

Please write a Function Module as RFC then try with follwing code.

Write into notepad saveas 'php2abap.php'

$host = "dessrv011"; // DEV 00 666 

$sysnr = 00; 

$client = 666; 

$user = "phpusr"; 

$passwd = "port#ph1"; 

$codepage = 1404; 

$login = array ( "ASHOST"=>"$host",                  

                 "SYSNR"=>"$sysnr",                  

                 "CLIENT"=>"$client",                  

                 "USER"=>"$user",                  

                 "PASSWD"=>"$passwd",            

                 "CODEPAGE"=>"$codepage");


//Try to connect to SAP using our Login array  

$rfc = saprfc_open ($login );

if (!$rfc) { echo "The RFC connection failed with the following error:".saprfc_error(); exit; }



//Discover interface for function module YMT_TESTFI

$fce = saprfc_function_discover($rfc,"YMT_TESTFI");

if (! $fce )  {    echo "Discovering interface of function module failed";    exit;   }


after complete 'php2abap.php', you run through internet explorer as

http://localhost/test/php2abap.php

Thanks

Manob


4 REPLIES 4
Read only

Former Member
0 Likes
1,168

I'm having the same issue. Have you found any solution ?

Read only

Former Member
0 Likes
1,169

Hello Darshan & Mike,

Please write a Function Module as RFC then try with follwing code.

Write into notepad saveas 'php2abap.php'

$host = "dessrv011"; // DEV 00 666 

$sysnr = 00; 

$client = 666; 

$user = "phpusr"; 

$passwd = "port#ph1"; 

$codepage = 1404; 

$login = array ( "ASHOST"=>"$host",                  

                 "SYSNR"=>"$sysnr",                  

                 "CLIENT"=>"$client",                  

                 "USER"=>"$user",                  

                 "PASSWD"=>"$passwd",            

                 "CODEPAGE"=>"$codepage");


//Try to connect to SAP using our Login array  

$rfc = saprfc_open ($login );

if (!$rfc) { echo "The RFC connection failed with the following error:".saprfc_error(); exit; }



//Discover interface for function module YMT_TESTFI

$fce = saprfc_function_discover($rfc,"YMT_TESTFI");

if (! $fce )  {    echo "Discovering interface of function module failed";    exit;   }


after complete 'php2abap.php', you run through internet explorer as

http://localhost/test/php2abap.php

Thanks

Manob


Read only

0 Likes
1,168

Hi Manob,

Here the problem is of the usage saprfc_open like functions which RFC prvides.

I couldn't install the extension saprfc to my php version. So that I am not being able to use any of those functions.

I am using PHP 5.3.8 on windows (32bit)

I tried many ways to install saprfc extension, but it doesn't seems to be working. Due to not having the proper compilation of the extension which suits to my php version.


So if you have ever done this, please share.


Thanks Again!

Mike

Read only

Former Member
0 Likes
1,168

Hi, You can follow the link

Connecting SAP and PHP | Ramindu Deshapriya

Credits to blogger, hope this help!

Regards