!--a11y-->
The application class is an ABAP class that is created with the Class Builder and then assigned to the BSP application (see also
Application Class of a BSP Application).CL_BSP_TUTORIAL
Class
CL_BSP_TUTORIAL is used as an application class for the BSP Tutorial 4. This implements a small bookshop and the class provides the methods for maintaining the shopping basket.The cornerstone of this class is the method DO_MAINTAIN_BASKET. This method calls all other methods. User activities determine what methods are called and when. The steps are as follows:
This method creates an instance of the shopping basket application from the cookie, that is, it turns the serialized form of the application back into the structured form.
This method is a mirror image of
DO_INSTANTIATE_BASKET; that is, it serializes the shopping basket structure to produce a cookie.This method adds a particular number of books to the shopping basket (the input parameters are the quantity and the catalog ID of the item).
This method is more general than
DO_ADD_TO_BASKET. DO_UPDATE_BASKET updates the shopping basket if, for example, the user changes the number of items in the basket.This method deletes a specific item from the shopping basket. Any number of articles can be deleted.
This method restores the shopping basket when the page is called. To do this, it gets the cookie from the browser and calls the method
DO_INSTANTIATE_BASKET.Maintaining the Shopping Basket with DO_MAINTAIN_BASKET
The input parameters for this method are as follows:
Catalog ID of the book in question
Quantity; that is, how many books with the CATID in question are to be placed in the basket
User action. This can be
add, update, delete, clear or doorder.BSP runtime
DO_MAINTAIN_BASKET
uses a cookie to create an instance of the shopping basket. The method gets the cookie by calling the method runtime->server->request->get_cookie. The method makes changes to the basket in accordance with the instructions specified by the user action, and uses runtime->server->request->set_cookie to send the data back to the browser in the form of a cookie.