After reading Matthias Zeller excelent blog [Engaging User Interfaces with Adobe Flex | Engaging User Interfaces with Adobe Flex] I start my Flex learning process...So yes...I have studied Flex for the last 10 days or less...Anyway...I have come to learn and really love Flex...It's simple, nice and productive.
I download this awesome Module Flex Module for Apache and IIS in order to test my Flex experiments on my Apache Server.[
| http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS]
As I usually do when I first learn a new Scripting Language, I have developed a SE16 Emulator by using Flex, PHP and SAP...I know that you might be asking yourselfs..."Did Blag said PHP? Why?"...It's fair simple...I can't use WebServices on my laptop's MiniSAP 4.6D so I needed a way to connect to SAP and pass the information to Flex.
What we need to do? We must create a Login Class...
Login_Class.php
We need an Index php page too...
index.php<br />
<textarea cols="90" rows="20"><?php
session_start();
include("Login_Class.php");
$_SESSION["Server"] = $_POST["myServer"];
$_SESSION["Sysnum"] = $_POST["mySysnum"];
$_SESSION["Client"] = $_POST["myClient"];
$_SESSION["User"] = $_POST["myUser"];
$_SESSION["Pass"] = $_POST["myPassword"];
$Login = new Login();
$Log_Me = $Login->Log_In($_SESSION["Server"],$_SESSION["Sysnum"],
$_SESSION["Client"],$_SESSION["User"],$_SESSION["Pass"]);
$RFC_Me = $Login->RFC_Connection($Log_Me);
if(isset($RFC_Me))
{
$Return = "<connections><connection>
<value>Connected</value>
</connection></connections>";
print($Return);
}
else
{
$_SESSION = array();
session_destroy();
$Login = new Login();
$Login->Login_Page();
}
?>
</textarea>
</p><p>Now, we can build our UI in Flex.
</p><p>index.mxml
browser.mxml<br />
<textarea cols="90" rows="20"><?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="horizontal">
<mx:HTTPService id="userRequest"
url="http://localhost/SinglePath_Stuff/PHP_FLEX_SAP/SE16/SE16.php"
useProxy="false" method="POST">
<mx:request xmlns="">
<myTable>{myTable.text}</myTable>
</mx:request>
</mx:HTTPService>
<mx:Form>
<mx:Panel x="10" y="10" title="SE16 Emulator"
width="775" height="400" layout="absolute">
<mx:Label x="60" y="10" text="Table" />
<mx:TextInput x="110" y="10" id="myTable" text=""/>
<mx:Button x="280" y="10" id="ShowData" label="Show Data"
click="userRequest.send()"/>
<mx:DataGrid id="dgData" x="20" y="40" height="300" width="710"
dataProvider="{userRequest.lastResult.tables.table}">
<mx:columns>
<mx:DataGridColumn headerText="{userRequest.lastResult.connections.
connection.value}" dataField="data"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Form>
</mx:Application>
</textarea>
</p><p>In order for this to work, we need to create our last php page...
</p><p>SE16.phpP.S you can download the source code from my public box Blag's Box .