on 05-08-2006 2:42 PM
Hello,
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";
exit();
}
else
{
echo "Interface of function module".$rfc_function_name." successfully discovered";
}[/code]
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]
...
[code]saprfc_function_free($fce);
saprfc_close($rfc);[/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
hi there,
you can simply see if the data really gets there by
+) looking into the respective tables or
+) let your function module return a good answer telling you if everything worked fine or not
+) view transaction ST11, file dev_rfc to see your data being communicated
regards,
anton
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Most of these functions will return a bool result code. Check the result codes. Everyting should work as expected.
You could also check saprfc_error or saprfc_exception for a status report.
Also in your code sample where is $rfc_rc getting its result code from?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.