Entering content frame

Procedure documentation Defining Layout for the Results List Locate the document in its SAP Library structure

Use

The results list results.htm displays all the books by the author the user selected.

If no matching entries are found, an error message is to be displayed. Otherwise a results list is to be displayed in a table with details of the ISBN, title and author.

Procedure

  1. For the results.htm page choose the Layout tab page.
  2. Define the layout:
  3. <%@ page language="abap" %>

    <html>

      <body BGCOLOR="#B5E1D2">

      <h2> Your Book Search Results </h2>

      <% if books is initial.

        %>

        <h3> Sorry, we found no matches for <%= authorlname %>,
        <%= authorfname %>.
    </h3>

      <% else.

        %>

        <h3> The matches for this search are: </h3>

        <table border=1>

              <tr>

            <td> ISBN </td>

            <td> Title </td>

            <td> Author </td>

          </tr>

          <% data: wa_book type bsbookline.

            loop at books into wa_book.

            %>

              <tr>

                <td> <%= wa_book-isbn %> </td>

                <td> <%= wa_book-title %> </td>

                <td> <%= wa_book-authfnam %> <SPACE>
                 
     <%= wa_book-authlnam %> </td>

              </tr>

            <% endloop. %>

        </table>

      <% endif.

        %>

      </body>

    </html>

    This page uses the same background color as the first page and the list of authors.

    An if – else statement comes after the heading:

      <% if books is initial.

        %>

        <h3> Sorry, we found no matches for <%= authorlname %>,
        <%= authorfname %>.
    </h3>

      <% else.

        %>

    The internal table authors contains the names of the authors that correspond to the user input. If the table is empty, the system outputs a message stating that no results were found that matched the user input for first name and surname.

    Otherwise, the results are represented in the form of a table. The table lists the ISBN, the title of the book, and the name of the author. The table structure is defined by the following HTML statement:

        <table border=1>

              <tr>

            <td> ISBN </td>

            <td> Title </td>

            <td> Author </td>

              </tr>

    The following ABAP code fills the table by using a loop statement to read out the fields from the database table:

          <% data: wa_book type bsbookline.

            loop at books into wa_book.

            %>

              <tr>

                <td> <%= wa_book-isbn %> </td>

                <td> <%= wa_book-title %> </td>

                <td> <%= wa_book-authfnam %> <SPACE>
                  <%= wa_book-authlnam %> </td>

              </tr>

            <% endloop. %>

        </table>

  4. Save your entries.

 

Now define the event handlers for the results list.

This graphic is explained in the accompanying text Event Handlers for the Results List

Leaving content frame