
When a BSP application is being processed, the individual BSPs and their components are run, and the corresponding processing steps are executed according to the code.
If an HTTP request is sent to a BSP, that is, if a page (in stateless case: for the first time) is called, the page in instantiated in OnCreate. Next, OnRequest is called.
After OnRequest, the handler is then run that is most appropriate for the request, that is, OnInitialization for URL input, OnInputProcessing for HTML input.
If it hasn't already, OnInitialization is run, so that the initialization phase data is assessed. Data in the SAP system, such as table contents or BAPIs, can be accessed in this phase. Then, the layout part (the hidden part of the event handler OnLayout) is processed, which determines the design and presentation logic of a page. This code consist of static parts (for example, HTML) and scripting code. To ensure clean programming, no business logic or data retrieval is carried out in the layout part. The manipulation part becomes important if the HTTP data stream should be modified later. The manipulation code should likewise contain no business logic or statements for data retrieval functionality. If there are no subsequent changes, the manipulation part is not required.
On the basis of all this data, the first page is built and sent to the user.
Next comes the user interaction phase, in which the user inputs data. The user input is sent back to the BSP. This input triggers an additional HTTP request.
You can specify for every page whether stateful or stateless mode is required. This is done in the input processing part. For example, incorrect input can be checked, data can be read from the database, and the succeeding page can be determined.
The subsequent page for the navigation request is determined in the navigation part of the application. If no succeeding page is set, the first page is reprocessed.
Then, processing of the initialization part continues.
For more information, see Control Flow of BSPs.