Show TOC

BSPs mit Layout, Initialisierung und EingabeverarbeitungLocate this document in the navigation structure

Verwendung

In diesem Beispiel gibt es nicht nur eine Bücherseite, sondern auch eine CD-Seite. Letztere soll von ihrer Ausgabe her an CDs angeglichen werden. Außerdem kommt eine Benutzereingabe hinzu, bei der anhand der eingegebenen Kategorie auf der Auswahlseite entsprechend die Buchseite oder die CD-Seite ausgegeben wird.

Überblick

Im Web Application Builder sehen diese BSPs folgendermaßen aus:

Layout von select.htm

<%@ page language="abap" %>
<html>
  <body>
  <h2> Select CDs or Books! </h2>
  <form method="post" >
    <select name="sel_category">
      <option value="0001"> Books
      <option value="0002"> CDs
    </select>
    <input type="submit" name="OnInputProcessing(select)" value="Select">
  </form>
  </body>
</html>

                           

OnInputProcessing von select.htm

* event handler for checking and processing user input and

* for defining navigation

 data: cat type string.

 case event_id.

 when 'select'.

    cat = request->get_form_field( 'sel_category' ).

    if cat = '0001'.

     navigation->goto_page( 'books.htm' ).

   elseif cat = '0002'.

     navigation->goto_page( 'cds.htm' ).

   endif.

 endcase.

                           

Layout von books.htm

<%@ page language="abap" %>
<html>
  <body>
    <h2> All books </h2>
    <table border=1>
    <tr>
      <th></th>
      <th>Title</th>
      <th>Author</th>
      <th>Publisher</th>
      <th>ISBN</th>
    </tr>
    <% data: wbook like line of books.
       loop at books into wbook. %>
    <tr>
      <td><img src="../../bookstore2/<%=wbook-category%><%=wbook-id%>_s.jpg"></td>
      <td><%= wbook-title %></td>
      <td><%= wbook-author %></td>
      <td><%= wbook-publisher %></td>
      <td><%= wbook-id %></td>
    </tr>
    <% endloop. %>
  </table>
  </body>
</html>

                           

OnInitialization von books.htm

select * from bsparticle into table books where category = '0001'.cds
                           

Seitenattribute von books.htm

Attributname

automatisch

Typisierungsart

Bezugstyp

Beschreibung

books

TYPE

TARTICLE

list of books

Layout von cds.htm

<%@ page language="abap" %>
<html>
  <body>
  <h2> All CDs </h2>
  <table border=1>
    <tr>
      <th></th>
      <th>Title</th>
      <th>by</th>
      <th>Label</th>
      <th>number</th>
    </tr>
    <% data: wcd like line of cds.
       loop at cds into wcd. %>
    <tr>
      <td><img src="../../bookstore2/<%=wcd-category%><%=wcd-id%>_s.jpg" border=1></td>
      <td><%= wcd-title %></td>
      <td><%= wcd-author %></td>
      <td><%= wcd-publisher %></td>
      <td><%= wcd-id %></td>
    </tr>
    <% endloop. %>
  </table>
  </body>
</html>

                           

OnInitialization von cds.htm

select * from bsparticle into table cds where category = '0002'.
                           

Seitenattribute von cds.htm

Attributname

automatisch

Typisierungsart

Bezugstyp

Beschreibung

cds

TYPE

TARTICLE

list of cds