Layout for the Results Page
The layout for the pageresults.htm, which you set using the tab page Layout, looks like this:
<%@ page language="abap" %>
<%@ include file="head.htm" %>
<% IF bookcat_tab IS INITIAL. %>
No books were found to match your query.
<% ELSE. %>
<table width="590" cellpadding="3">
<% DATA bookcat TYPE bsbookdata.
LOOP AT bookcat_tab INTO bookcat.%>
<td><a href="showbook.htm?s_cata_id=<%= bookcat-cata_id %>">
<%= bookcat-title %><br><small><%= bookcat-subtitle %></small></a></td>
<td><small><% DATA author_wa TYPE bsauthors.
LOOP AT bookcat-authors INTO author_wa.%>
<%=author_wa-authfname %> <%=author_wa-authlname %>
<td><%= bookcat-delivery %></td>
<% ENDIF. %>
The page fragmenthead.htm is also included in this page.
First, this code checks whether there are any entries in the structurebookcat_tab that match the search criteria. If there are not, an error message is output. The user can then click on a link on the error page to return to the search page.
If there are matching entries in thebookcat_tab structure, the results are output in a four-column table.
The output is then processed in detail:
Aloop statement writes the content of the internal table bookcat_tab line by line into a help variable. When this happens, the title and sub-title for each book are stored along with a link. The variable ?s_cata_id is included in the link after the page details.
<a href="showbook.htm?s_cata_id=<%= bookcat-cata_id %>">
Next, the first name and surname of the author, the delivery time, and the price are retrieved, and all this data is written to the table. The variables_cata_id contains the unique ID number of a book in the catalog. This ID number is the primary key of the database table bscatalog in the SAP System (see Data Model).
Attributes for the Results Page