Show TOC

BeispieldokumentationBSPs mit Layout, Initialisierung und Eingabeverarbeitung Dieses Dokument in der Navigationsstruktur finden

 

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

Syntax Syntax

  1. <%@ 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>
    
Ende des Codes

OnInputProcessing von select.htm

Syntax Syntax

  1. * 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.
    
Ende des Codes

Layout von books.htm

Syntax Syntax

  1. <%@ 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>
    
Ende des Codes

OnInitialization von books.htm

Syntax Syntax

  1. select * from bsparticle into table books where category = '0001'.cds
Ende des Codes

Seitenattribute von books.htm

Attributname

automatisch

Typisierungsart

Bezugstyp

Beschreibung

books

TYPE

TARTICLE

list of books

Layout von cds.htm

Syntax Syntax

  1. <%@ 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>
    
Ende des Codes

OnInitialization von cds.htm

Syntax Syntax

  1. select * from bsparticle into table cds where category = '0002'.
Ende des Codes

Seitenattribute von cds.htm

Attributname

automatisch

Typisierungsart

Bezugstyp

Beschreibung

cds

TYPE

TARTICLE

list of cds