SAP - Flex Interfacing using BSP and Function Module

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


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.