Background documentationIntegration 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.

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.

Note Note

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

End of the note.
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

  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.

    Note Note

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

    End of the note.
  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:

Syntax Syntax

  1. * 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.
    endloop.
    
    * 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 ).
End of the code.

Note Note

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

End of the note.

Result

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