Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Programming an PHP-Interface to SAP


i've read a lot in this Forum, and i'am happy to see a good community around SAP&PHP and SAPRFC.

But my Problem is, that i haven't got a clue about SAP.

Last year i wrote an Web-application(PHP, Oracle) where about 1.000 employees from our client use to enter their worktime ... where and when they worked for which project.

At the beginning of a month some unit managers simulate an SAP-export and the Web-application prints out a summary-list of hours worked (and marked the evaluated data as exported), which they manually entered into SAP.

Now they want an 'automagically' export of the data to SAP. So i installed the SAPRFC-extension and i can connect to the SAP-System (thanks to the good descriptions about this here). Another Worker programmed an function module which should be responsible for the Import of the data ... i will post some code i wrote:

[code]$LOGIN = array ( // Set login data to R/3

"ASHOST"=>"***", // application server host name

"SYSNR"=>"02", // system number

"CLIENT"=>"610", // client

"USER"=>"***", // user

"PASSWD"=>"***", // password

"CODEPAGE"=>"1404"); // codepage

$rfc_function_name = "/RWEF/ZI_EIGELEISTUNG_CREATE";

$rfc = saprfc_open ($LOGIN);

$fce = saprfc_function_discover($rfc, $rfc_function_name);

if (! $fce )


echo "Discovering interface of function module ".$rfc_function_name." failed";





echo "Interface of function module".$rfc_function_name." successfully discovered";


the saprfc_test.php told me something like this to do:

[code]saprfc_table_init ($fce,"ZI_EIGENLEISTUNG_IN");

saprfc_table_append ($fce,"ZI_EIGENLEISTUNG_IN", array ("AUFNR"=>"1","VORNR"=>"1","RUECK"=>"1","ARBPL"=>"1","ISMNW"=>"1","LEARR"=>"1","AUERU"=>"1","LTXA1"=>"1","BUDAT"=>"1","WERKS"=>"1","ISSD"=>"1","ISDZ"=>"1","IEDD"=>"1","IEDZ"=>"1"));$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; [/code]




now my question: is this the right way to insert the data into SAP, and how can i see if the data really gets there

i hope i gave enough information and this question is not too stupid

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question