Show TOC

Example documentationBSP with Layout and Initialization Locate this document in the navigation structure

 

Overview

This simple BSP contains the layout, a page attribute and event handler OnInitialization. This outputs the title, publisher and ISBN of all books in the database table BSBOOK that were published in the year 2000.

This BSP is as follows in the Web Application Builder:

Layout

Syntax Syntax

  1. <%@page language="abap"%>
    <html>
      <body>
        <h2> Buchliste </h2>
        <table border=1>
          <tr>
            <th>Titel</th>
            <th>Verlag</th>
            <th>ISBN</th>
          </tr>
          <% data: wbook like line of books.
            loop at books into wbook. %>
          <tr>
            <td><%= wbook-title %></td>
            <td><%= wbook-publisher %></td>
            <td><%= wbook-ISBN %></td>
          </tr>
          <% endloop. %>
        </table>
      </body>
    </html>
    
End of the source code.

OnInitialization

Syntax Syntax

  1. select * from bsbook into table books where publyear = '2000'.
End of the source code.

Page Attribute

Attribute Name

Automatically

Typing Kind

Reference Type

Description

Books

TYPE

BOOK_TAB

Book List

Note Note

The internal table books of type BOOK_TAB is filled in OnInitialization.

End of the note.
Process Flow

The individual steps that are followed when processing this BSP are as follows:

  • The user calls a BSP application in the browser or enters an appropriate URL.

  • An HTTP-GET request is sent to the BSP runtime.

  • The BSP runtime determines the suitable BSP application and the BSP that is called.

  • In the BSP, data is retrieved using OnInitialization. Table BSBOOK is read for those book entries that were made in the year 2000.

  • The scripting code is processed in the layout and the page is rendered: An HTML table is output and filled with content.

  • The BSP runtime then generates a suitable response

  • and sends it to the browser that displays the BSP.

    Note Note

    This example can be enhanced by adding a second BSP with navigation: BSP Application with Layout and Initialization

    End of the note.