Applies to:
SAP Netweaver 2004s Business Intelligence
Author Bio

I have 4+ years experience in Data Warehousing.
Objective
- In this tutorial we are going to retrieve data from SAP to FLEX 3 Application.
- First we will create a function module which will export data from a SAP Table.
- Then we will apply that function module in a BSP page. This BSP page will return a XML list of the retrieved data from the function module
- Create a Flex 3 application that will read the XML output from the BSP page.
Data in the SAP..

Our output will look like

We have selected only three fields in the output
| Step 1 Go to SE37. Create a normal function module. |

| Step 2 Import parameters will be blank. And add below parameter in Export parameter ZSCENE_TAB is a Table Type. You can create this table type in SE11 |

| Step 3 In the source code of the FM add below lines of code. Please note that You can use any Table in SAP to run this example. You only need to change the name of the table and associated parameters. Base line procedure will be same. |

| Step 3 Now go to SE80. Here from drop down box Select "BSP Application". Enter the BSP application name. Press Enter. On asking the "Create new BSP application" press yes. And enter the description of the BSP Applcation. Then select as local object. |

| Step 4 Right Click on the BSP application and create a new Page |

| Step 5 Make sure to enter the page name with XML extension |

| Step 6 In the Page Attributes tab add below parameters |

| Step 7 On Event Handler Tab select the OnInitialization Event and add your function module here. So when this page will be called Z_SCENE_FM function module will be invoked. And it_scene internal table will be filled with data. ![]() |
| Step 8 Activate the BSP Application and run. You should see below kind of output ![]() |
| Step 9 Now we will create the Flex 3 Application which will call this page via HTTPService. First create a table in Visual Design Panel in Flex Builder 3 Please note that Flex Builder is freely available in Adobe site. ![]() |
| Step 10 In the source Please add below piece of code. You can get help of using HTTP Service in Adobe Flex Live docs ![]() |
| Step 11 Call the HTTPService in the Action Script Function ![]() |
| Step 11 Now run the Flex Application. You should see this output ![]() |






Comments (6)
Feb 05, 2009
anand babu says:
Hi, I Tried the sample. I BSP page when i test it. It shows error as fol...Hi,
I Tried the sample.
I BSP page when i test it. It shows error as follows
The XML page cannot be displayed
XML document must have a top level element. Error processing resource 'http://xyz:8000/sap(bD1lbiZjPTAwMQ==)/bc/b...
I need an another example to pass a XML String to a flex
Thanks in advance.
Regards,
Anand Babu R
Apr 06, 2009
Arun Varadarajan says:
You cannot do it the way it is described here - you will need to import the webs...You cannot do it the way it is described here - you will need to import the webservice the way Matthias Zeller has given in the RIA Wiki
Jun 23, 2009
Deepak MS says:
Hi, I too am getting the same message: The XML page cannot be displayed Canno...Hi,
I too am getting the same message:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'http://eccserver.mindtree.com:8001/sap/bc/bsp/sap/z_...
can you please let me know where am I going wrong?
Warm regards,
Deepak
Jul 21, 2009
Daniel Sperling says:
Hi, for the Problems before: You have to add an XML Layout like mine: &...Hi,
for the Problems before:
You have to add an XML Layout like mine:
<%@page language="abap"%>
<% LOOP AT it_scene INTO wa_scene. %>
<% DATA: rule(20) Type c VALUE '&<>_'. %>
<% TRANSLATE wa_scene-TEXT USING rule.%>
<%=wa_scene-uname. %>
<%=wa_scene-report. %>
<%=wa_scene-SAP_GUID. %>
<%=wa_scene-parent_id. %>
<%=wa_scene-object_id. %>
<%= wa_scene-TEXT. %>
<% endloop. %>
The second thing: The http call is wrong.
The third thing: The sourcecode pics for the securitycall says absolutly nothing.
Aug 11, 2010
Milan Thaker says:
Hi, I have worked on ABAP and flex and looking fwd to develop an i...Hi,
I have worked on ABAP and flex and looking fwd to develop an interface that involves both. This document really helped me to get most of the answers, however I was not able to figure out the structure for wa_scene. Could you please share the structure so that I can complete the interfacing.
Regards,
Milan Thaker
Dec 22, 2010
Mustafa YILMAZ says:
Hi to the sharer of these tutorials and all comment writers here. I'm facing wi...Hi to the sharer of these tutorials and all comment writers here.
I'm facing with a little different error from issues that were told in comment areas above. My issue is just to not achieve viewing the ".xml" page (scenerio.xml) on the browser without getting any error mesage. Could it be about some settings onSAP server or somethings are wrong in tutorials ,as Daniel have explained above?
Thanks in advance for responses.
Regards.
Mustafa YILMAZ