on 01-04-2007 4:49 PM
Hello,
I just start with SAP and PHP Integration. I bought the book from Craig Cmehil "SAP Developers Guide for PHP" and now I have a problem with an own function. (of course the example with SO_USER_LIST_READ from the book works)
I am not an ABAP programmer, so my knowledge in this area is quite low.
The function module should read all entries of a table where infromation aboput the employees are stored.
[code]FUNCTION YB2_AUFW_PRO_PROJEKT.
*"----
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(RPROJEKT) TYPE YE_RPROJEKTX
*" EXPORTING
*" VALUE(MITAUF) TYPE YTYB2_FUC_MITAUFX
*"----
select * from ytb_fuc_mitaufx
into table mitauf
where rprojekt = rprojekt.
ENDFUNCTION.[/code]
in PHP I call the function with this
[code] $result=$sap->callFunction("YB2_AUFW_PRO_PROJEKT",
array( array("IMPORT","RPROJEKT","E0000"),
array("EXPORT","MITAUF",array())
));[/code]
But there is nothing in the result. When I try with print_r I get an empty array, not even the table fields are included:-(
Result with print_r: Array ( [MITAUF] => )
When I try it in the MiniSAP I get results, but not in PHP.
The FM is remote enabled.
Does anybody know what it is wrong?
Greetz
Enrico
> I just start with SAP and PHP Integration. I bought
> the book from Craig Cmehil "SAP Developers Guide for
> PHP" and now I have a problem with an own function.
> (of course the example with SO_USER_LIST_READ from
> the book works)
That's the problem -:P Just kidding -;) I want to buy that book myself....I promised Craig that for a long time....Hope I can buy it soon -:(
Anyway...As for you problem...I use a different approach when doing PHP/SAP programming....I should do it like this -;)
[code]
$LOGIN = array ("ASHOST"=>$_SESSION['Server'],
"SYSNR"=>$_SESSION['Sysnum'],
"CLIENT"=>$_SESSION['Client'],
"USER"=>$_SESSION['User'],
"PASSWD"=>$_SESSION['Pass'],
"CODEPAGE"=>"1404");
$rfc = saprfc_open ($LOGIN);
saprfc_import ($fce,"YB2_AUFW_PRO_PROJEKT","E0000");
saprfc_table_init ($fce,"MITAUF");
$rfc_rc = "";
$rc = saprfc_call_and_receive ($fce);
$field_row = saprfc_table_rows ($fce,"MITAUF");
[/code]
In $field_row you got the results -;)
Greetings,
Blag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alvaro,
thank you for your quick reply, but unfortunatly it doesn't work.
I tried to use this:
[code] $rfc = saprfc_open ($LOGIN);
if (! $rfc )
{
echo "RFC connection failed with error:".saprfc_error();
exit;
}
$fce = saprfc_function_discover($rfc, "YB2_AUFW_PRO_PROJEKT");
saprfc_import ($fce,"RPROJEKT","E0000");
saprfc_table_init ($fce,"MITAUF");
$rfc_rc = "";
$rc = saprfc_call_and_receive ($fce);
$field_row = saprfc_table_rows ($fce,"MITAUF");
print_r ($field_row);[/code]
When I run this script I get an error in the line with saprfc_table_init.
<i>Warning: CALDBG: Can't find interface name MITAUF, __cal_refresh_internal_buffer()</i>
Seems like the same problem I had yesterday. the import param is OK but the export param caused problems...:-(
Best Regards
Enrico
I searched how to export the structure but i didn't found it.
It is a simple table with 19 colums.
e.G.
FIELD**DATA ELEMENT**DTYP
-
MANDT | MANDT | INT
NLFDAUFW | YE_NLFDAUFW | NUMC
both are KEYS and INITIAL VALUE
Than there are 17 other fields.
I found in SE11 that the table maybe is not active.
When I try to acticate the table I get an error in 2 fields.
RPROJEKT | YE_RPROJEKT | CHAR
RTPROJEKT | YE_RPROJEKT | CHAR
The error log shows me this error:
E- Search field YTB_FUC_MITAUFX-RTPROJEKT of search help attachment: search help YE_RTPROJEKT not active.
Maybe this caused the problem but when I test the function module in MiniSAP...I got a result.
Greets
Enrico
I solved the problem with rewriting the function module. Now i use table instead of export parameters and it works fine.
thanks for contribution
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.