Integration into BSP Applications


As of SAP Release 6.10, the architecture of the SAP system has changed fundamentally. The application server in this architecture can act as a Web server and as a Web client. The new architecture is called SAP Web Application Server.

BSP applications (BSP stands for Business Server Page) are based on this new architecture. They allow you to develop Internet applications with scripting on the server side in ABAP or JavaScript. Since BSP applications run directly on SAP Web Application Server, the developer can access all the resources of the application server (such as database accesses and function module calls).

Access to these resources is driven by events. To allow activities such as data selection, initialization, or input processing before or after displaying a Web page, a BSP application provides several standard events.

To implement BSP applications, you use the Web Application Builder.

Displaying a Web Form in SAP Web Application Server

With the formatted XSF output you can use the SAP Web Application Server to send forms to the client by using an HTTP response. This means that you can display them in the Web browser:

Process Flow

1.       The BSP page is called by the user or by a preceding BSP page. The Web Application Server forwards the HTTP request to the BSP runtime environment.

2.       The BSP runtime environment triggers the Initialization event. In the relevant event handler OnInitialization you can now select data for your form - usually based on the entries the user made on the previous BSP page.

3.       To generate HTML (with embedded CSS), specify the parameters of the Smart Forms function module and call it (see Output in HTML Format).

4.       The function module returns HTML as a table in RAW format.

You can encapsulate the last two steps in a method or in another function module.

5.       To display the form in the browser, use the SET_DATA method to fill the response object provided by the BSP runtime environment. This method expects the data as XSTRING. Convert the XSF output appropriately and pass the string to the response object:

* Variables for formatted XSF and conversion

data: ls_xmloutput type ssfxmlout,
      lt_html_raw  type tsfixml.

data: l_xstring      type xstring,    "needed for HTTP response
      l_xlength      type i,
      l_html_xstring type xstring.

* ls_xmloutput has been returned by Smart Form

ls_xmloutput = ls_output_data-xmloutput.
lt_html_raw  = ls_xmloutput-trfresult-content[].

* Convert RAW to XSTRING

loop at lt_html_raw into l_xstring.
   concatenate l_html_xstring l_xstring into l_html_xstring
                                                  in byte mode.

* Set header of response

response->set_header_field( name  = 'content-type'
                           value = ls_xmloutput-trfresult-type ).

* Fill response object

l_xlength = xstrlen( l_html_xstring ).

response->set_data( data   = l_html_xstring
                     length = l_xlength ).

In the BSP application SF_WEBFORM_01 you can display three different forms that have not been specially adapted to Web use.


The Web Application Server sends the XSF output to the browser.