Event Handlers for the Results Page
Two event handlers are required for the processing procedure of the results page (results.htm), OnInitialization and OnInputProcessing.
data: isbn_tab TYPE isbn_tab.
CALL METHOD cl_book_shop=>search_book
if sy-subrc = 4.
IF sy-subrc = 0.
The data statement sets the data transfer for the ISBN table.
The methodsearch_book of the class cl_book_shop is used to search for book titles that match the user input. When this happens, the method search_book gets the page parameters author, title, publisher, isbn and keyword, and the parameter isbn_tab is returned with the results of the search. The following exceptions or errors are defined in search_book:
This scenario is already taken care of by OnInputProcessing on the search page. Therefore, it cannot occur here.
In this case, the ISBN error page (invalid_isbn.htm) is called.
In this case, the general error page (error.htm) is called.
If no errors occur, the methodget_book_data of the class cl_book_shop is called, which finds suitable results. Sometimes, no suitable results are found, that is, isbn_tab is empty. In this case, get_book_data returns sy-subrc = 2, and the table bookcat_tab is empty. The layout part checks for this scenario.
navigation->set_parameter( 's_cata_id' ).
Based on the user input, the book page is opened for the book with thes_cata_id that was specified in the layout with the statement below:
<a href="showbook.htm?s_cata_id=<%= bookcat-cata_id %>">
Layout for the Book Page