
Overview
This simple BSP applications contains two BSPs with layout, page attributes and the event handler OnInitialization.
Depending on the user input for the year of publication, the next page displays various lists of books in table form.
These BSPs are as follows in the Web Application Builder:
|
Layout of startpage.htm |
<%@page language="abap"%>
<html>
<head>
<link rel="stylesheet" href="../../sap/public/bc/bsp/styles/sapbsp.css">
<title> Auswahlseite </title>
</head>
<body class="bspBody1">
Erscheinungsjahr:
<form method="post" action="page2.htm" >
<select name="sel_publyear">
<option value="2000"> Jahr 2000
<option value="2001"> Jahr 2001
</select>
<input type="submit" value="Select">
</form>
</body>
</html>
|
|
Layout of page2.htm |
<%@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>
|
|
OnInitialization of page2.htm |
data: year type int.
year = request->get_form_field( 'sel_publyear' ).
select * from bsbook into table books where publyear = year.
|
|
Page attributes of page2.htm |
||||
|
Attribute Name |
Automatically |
Typing Kind |
Reference Type |
Description |
|
Books |
TYPE |
BOOK_TAB |
Book List |
The internal table books of type BOOK_TAB is filled in OnInitialization.
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: startpage.htm.
The layout is assessed, since this page only has layout.
The BSP runtime generates the page and sends it to be displayed at the browser.
In the pulldown menu, the user selects the required year of publication and selects the pushbutton.
An HTTP-POST request is now sent to the BSP runtime.
This POST request requests a different page, page2.htm.
Event handler OnInitialization is assessed by this second page. 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.