Entering content frame

Procedure documentation Modifying the Results Page Locate the document in its SAP Library structure

Use

When displaying results, such as the books and authors that you have been searching for, you may want to use caching for performance reasons.

Note

You can find additional information about caching in the reference documentation in Caching BSPs.

In this example we have selected a very simple example: we assume that users frequently search for books from the author Plattner.

Background documentation 

Without caching, the request would be sent to the SAP Web AS for every search with the author name Plattner; the SAP Web AS would then execute the ABAP coding that searches for the relevant books in the database and then writes the results dynamically to the response BSP, which is then sent to the client. If caching is used, this process runs with the first search only. All subsequent requests for books from Plattner are responded to directly from the ICM server (provided that the validity period of the cache entry has not expired); the SAP Web AS is not occupied (work process, database). You can find an overview of this architecture in Structure linkServer Roles.

Now we are going to change the coding so that each time you search for Plattner, the results list is taken from the cache (this takes place once a day at 18.00) and the cache is invalidated.

Procedure

For results page results.htm change the event handler OnInitialization by adding a short coding section with a caching query:

* books matching the query are elements of isbn_tab;
* get details on books matching the query

CALL METHOD cl_book_shop=>get_book_data
            EXPORTING isbn_tab = isbn_tab
            IMPORTING bookcat_tab = bookcat_tab
           EXCEPTIONS empty_input_table   = 2
                      invalid_isbn        = 4.

* cache result page in case Plattner's books are searched

if  'PLATTNER' cp author.
  response->server_cache_expire_abs( expires_abs_time  = '180000'
                                     browser_dependent = 'X' ).
endif.

This graphic is explained in the accompanying textNow change the Search Page.

 

 

Leaving content frame