Information to an output file
Posted: Mon Oct 15, 2007 1:46 am
Hi gurus,
I need your help. I really do not understand nothing about PHP scripting.
I have one PHP script which connects to one SAP system and retrieve an information from it and displays it on a Web page ...I want to have this displayed information to go into a file instate of displaying on the Web
Below you will see the script that we used to extract data from the SAP system. Is it possible for you to point me or show me how can i redirect the output from this script to a file? When we execute this script a "put in" box appear and we put there a name of a table which we want to see the contents of and click button "show table" and the table if exist is displayed on the web page ...i want to have this output also in a file and it doesnt matter if its with the correct structure as it shown on the web I just need to have this output in a file then i will manipulate the file like i want.
Thank you very much in advance for you help ....i really appreciate this!!!
If you need any additional information that i must provide please tell me!
***** PLEASE USE THE
I need your help. I really do not understand nothing about PHP scripting.
I have one PHP script which connects to one SAP system and retrieve an information from it and displays it on a Web page ...I want to have this displayed information to go into a file instate of displaying on the Web
Below you will see the script that we used to extract data from the SAP system. Is it possible for you to point me or show me how can i redirect the output from this script to a file? When we execute this script a "put in" box appear and we put there a name of a table which we want to see the contents of and click button "show table" and the table if exist is displayed on the web page ...i want to have this output also in a file and it doesnt matter if its with the correct structure as it shown on the web I just need to have this output in a file then i will manipulate the file like i want.
Thank you very much in advance for you help ....i really appreciate this!!!
If you need any additional information that i must provide please tell me!
***** PLEASE USE THE
Code: Select all
AND OTHER TAGS WHEN POSTING CODE *****[/color]Code: Select all
<?php
Class SE16
{
var $fce;
function Ask_for_Table($Choose_Mode)
{
ECHO "<CENTER>";
PRINT("<FORM ACTION='Operation.php' METHOD='POST'>");
PRINT("<INPUT TYPE='TEXT' NAME='Table'><BR>");
PRINT("<INPUT TYPE='HIDDEN' NAME='Choose_Mode' VALUE='$Choose_Mode'><BR>");
PRINT("<INPUT TYPE='SUBMIT' value='Show Table' NAME='Show_Table'> ");
PRINT("</FORM>");
ECHO "<A HREF='index.php'>Log Out</A>";
ECHO "</CENTER>";
}
function Show_Table($Table,$RFC_Me)
{
$this->fce = saprfc_function_discover($RFC_Me, "RFC_READ_TABLE");
IF (! $this->fce )
{
ECHO "The function module had failed.";
EXIT;
}
$Table = STRTOUPPER($Table);
saprfc_import ($this->fce,"QUERY_TABLE",$Table);
saprfc_import ($this->fce,"DELIMITER","/");
saprfc_table_init ($this->fce,"OPTIONS");
saprfc_table_init ($this->fce,"FIELDS");
saprfc_table_init ($this->fce,"DATA");
$rfc_rc = "";
$rfc_rc = saprfc_call_and_receive ($this->fce);
if ($rfc_rc != SAPRFC_OK)
{
if ($rfc == SAPRFC_EXCEPTION )
echo ("Exception raised: ".saprfc_exception($this->fce));
else
echo ("Call error: ".saprfc_error($this->fce));
exit;
}
$data_row = saprfc_table_rows ($this->fce,"DATA");
$field_row = saprfc_table_rows ($this->fce,"FIELDS");
ECHO "<BR>";
ECHO "Table: " . $Table;
ECHO "<BR><BR>";
ECHO "<TABLE BORDER='1' BORDERCOLOR='BLUE'>";
ECHO "<TR>";
for($i=1; $i<=$field_row ; $i++)
{
$FIELDS = saprfc_table_read ($this->fce,"FIELDS",$i);
ECHO "<TD BGCOLOR='#4D80F6'>";
ECHO $FIELDS['FIELDNAME'];
ECHO "</TD>";
}
ECHO "</TR>";
for ($i=1; $i<=$data_row; $i++)
{
$DATA = saprfc_table_read ($this->fce,"DATA",$i);
$TEST = SPLIT("/",$DATA['WA']);
$rem = $i % 2;
if($rem == 0)
{
ECHO "<TR BGCOLOR='#ADDEF7'>";
}
else
{
ECHO "<TR BGCOLOR='#FFFFFF'>";
}
for($j=0; $j<$field_row; $j++)
{
ECHO "<TD>";
ECHO $TEST[$j];
ECHO "</TD>";
}
ECHO "</TR>";
}
ECHO "</TABLE>";
ECHO "<CENTER>";
PRINT("<FORM ACTION='index.php' METHOD='POST'>");
PRINT("<INPUT TYPE='HIDDEN' NAME='LOG_IN'><BR>");
PRINT("<INPUT TYPE='SUBMIT' value='Back' NAME='Back'> ");
PRINT("</FORM>");
ECHO "</CENTER>";
}
}
?>