看來,你用這個 - https://github.com/sensational/php-saprfc/blob/php7/saprfc.php - PHP callFunction實施到用戶定義的函數ZMM_(一個SAP功能是在Z_命名空間中,哪些是你自己在SAP中實現通話 - 對於ZMM_在系統中並不存在,並且所有現有的ZMM *都不是遠程啓用的),其中包含SAP over SAP rfcsdk的SAP表。
你遠程啓用此功能(例如像在PIC1 RFC_READ_TABLE所示的是),您將自己在SAP建?如果沒有,它不能與SAP一起工作rfcsdk
如果是 - 您的參數不能正確。這是一個例子,用於在該框架中調用現有的rfc函數,看起來!!(我只能猜測它,因爲你沒有解釋它)使用。
PS: 如果不使用E. Koucky的saprfc 1.4.1擴展DLL一個PHP框架(你!!似乎!!使用),可以使用直接調用,這意味着直接調用編譯後的擴展[php_functions]。我用**** .... ****表示了直接電話。您可以直接調用這樣的:
...
// router string
$LOGIN = array ("ASHOST"=>"/H/xx.xx.xx.com/S/port/W/xx/H/localhost",
"SYSNR" =>"00",
"CLIENT" =>"800",
"USER" =>"xxxxxxxx",
"PASSWD" =>"xxxxxxxx",
"LANG" =>"E");
...
$table="T100";
$criteria="SPRSL EQ 'E' AND TEXT GE 'Must e' AND TEXT LT 'N'";
$options=array("TEXT"=>$criteria);
...
$rfc = ****saprfc_open**** ($LOGIN);
$fce = ****saprfc_function_discover****($rfc,"RFC_READ_TABLE");
...
// set import parameters
saprfc_import ($fce,"DELIMITER","*");
saprfc_import ($fce,"NO_DATA","");
saprfc_import ($fce,"QUERY_TABLE",$table);
saprfc_import ($fce,"ROWCOUNT","");
saprfc_import ($fce,"ROWSKIPS","");
saprfc_table_init ($fce,"FIELDS");
saprfc_table_init ($fce,"OPTIONS");
saprfc_table_init ($fce,"DATA");
// options look at the top -> $criteria
****saprfc_table_append**** ($fce,"OPTIONS", $options);
...
for($i=1; $i<=$data_row;$i++)
{
$DATA[$i] = ****saprfc_table_read**** ($fce,"DATA",$i);
$ex = explode("*",$DATA[$i]["WA"]);
...
你可以找到一個工作saprfc擴展與SAPGUI 7.4(rfcsdk 7.4)的php-7.1.11-NTS-X32聚集在這裏 https://sourceforge.net/projects/saprfcsdk/files/PHP%207.1.11%20NTS%20VC14%20%20SAP%20GUI%207.4%20-%20x32%20%20NUC/
可以搶通過使用
$extensions= get_loaded_extensions();
$functions=array();
foreach($extensions as $ext)
{
if($ext=="saprfc-gimba")
{
echo "<font size='4' color='green'>".$ext."</font><font size='2' color='green'> ist geladen<br></font>";
echo "<font size='1' color='green'>vorhandene Funktionen:<br></font>";
$functions = get_extension_funcs($ext);
}
}
foreach($functions as $text)
{
echo "<font size='1' color='green'>$text<br></font>";
}
直接調用擴展函數然後你得到這一結果
這裏有一個表TFDIR表,它返回系統中的所有RFC_ *函數。如果您設置了FMODE EQ'R',您可以獲得遠程調用系統的所有功能。
$table="TFDIR";
$criteria="FUNCNAME GE 'RFC_' AND FUNCNAME LT 'RFC_ZZZZ'";
$options=array("TEXT"=>$criteria);
$LOGIN = array ("ASHOST"=>"/H/sapx.x.x.com/S/port/W/x/H/localhost",
"SYSNR" =>"00",
"CLIENT"=>"800",
"USER" =>"xxx",
"PASSWD"=>"xxx",
"LANG" =>"E");
$rfc = saprfc_open ($LOGIN);
$fce = saprfc_function_discover($rfc,"RFC_READ_TABLE");
if (! $fce)
{
echo "Discovering interface of function module failed";
exit;
}
saprfc_import ($fce,"DELIMITER","*");
saprfc_import ($fce,"NO_DATA","");
saprfc_import ($fce,"QUERY_TABLE",$table);
saprfc_import ($fce,"ROWCOUNT","");
saprfc_import ($fce,"ROWSKIPS","");
saprfc_table_init ($fce,"FIELDS");
saprfc_table_init ($fce,"OPTIONS");
saprfc_table_init ($fce,"DATA");
saprfc_table_append ($fce,"OPTIONS", $options);
$rc = saprfc_call_and_receive ($fce);
if ($rc != SAPRFC_OK)
{
if ($rfc == SAPRFC_EXCEPTION)
{
echo ("Exception raised: ".saprfc_exception($fce));
}
else
{
echo ("Call error: ".saprfc_error($fce));
}
exit;
}
$data_row = saprfc_table_rows ($fce,"DATA");
$field_row = saprfc_table_rows ($fce,"FIELDS");
echo "<div align='center'><p style='font-size:22px;color:midnightblue'>SAP - QUERY TABLE - TFDIR - PHP 7.1.11</p>".
"<table><tr bgcolor='#dddddd' style='font-size:15px; color:midnightblue;'>".
"<td>FUNCNAME</td><td>PNAME</td><td>INCLUDE</td><td>FREEDATE</td><td>APPL</td><td>MAND</td><td>FMODE</td><td>HOST</td><td>U_TASK</td><td>PNAME_MAIN</td><td>STEXT</td>";
for($i=1; $i<=$data_row;$i++)
{
$DATA[$i] = saprfc_table_read ($fce,"DATA",$i);
$ex = explode("*",$DATA[$i]["WA"]);
echo "<tr style='font-size:12px;'>";
for ($n=0;$n<=sizeof($ex);$n++)
{
if($ex[$n] != '')
{
echo "<td id=".$i."_".$n.">".$ex[$n]."</td>";
}
if(sizeof($ex) == 4 && $n==3)
{
echo "<td id=".$i."_".$n."> </td>";
echo "<td id=".$i."_".$n."> </td>";
echo "<td id=".$i."_".$n."> </td>";
}
}
echo "</tr>";
}
echo "</table></div>";
//saprfc_function_debug_info($fce);
saprfc_function_free($fce);
saprfc_close($rfc);
結果是:
如果需要,例如德國等Unicode支持您在此處插入此:
$rfc = saprfc_open ($LOGIN);
// enabling the same codepage as SAPGUI - unicode - for ö,ü,ä etc.
saprfc_set_code_page ($rfc,"4110");
或者,如果您使用E.Koucky框架:
$rfc->SetCodePage("4110");
問候 阿克塞爾·阿諾德班格特