You are on page 1of 7

Structure of a BSP Application

A Business Server Page (BSP) application is an independent development project that is


created and edited in the SAP development environment (transaction SE80). External
design tools, such as Adobe GoLive, Dreamweaver, or Microsoft FrontPage 2000 can be
used to design the BSP application, as well as BSP extensions.

Analog to a classic transaction, a BSP application consists of a user interface and


business logic that is assigned to a logical unit, in this case the BSP application.
The user interface of a BSP applications includes:
• Static Web sites
• Dynamically generated Web sites, which are BSPs or templates that contain server-side
scripting that is executed dynamically at runtime to generate a static Web site BSPs can
either be pages with flow logic or views.
There can also be controllers if the MVC design pattern is used
• Various MIME objects, such as pictures, icons, sound files, style sheets, and so on, that
are parts of a typical Web application
All of these objects are integrated in the Change and Transport Organizer as parts of the
BSP application and are handled as a logical unit. This allows all objects that are part of a
BSP application to be fully and consistently transported between all the systems in an
SAP system landscape.
The business logic can be accessed from the BSP application using the typical methods,
such as BAPIs, function modules, or class libraries. In addition, the BSP programming
model provides a structuring tool, the BSP-Application class , that can be used to
encapsulate the business logic functionality in the BSP application.

A BSP application consists of the following components:


• Controller
Controllers contain business logic and application data. Controllers assess the data
of an incoming request based on a model and then select a suitable view for
rendering the response to the user, see also Model View Controller (MVC).
• Business Server Pages (BSPs)
BSPs are the Web sites that are displayed in the browser when the application is in use.
BSPs can contain static HTML code and dynamic scripting code (ABAP or JavaScript). The
scripting code is interpreted on the server. The exact structure of a BSP is described in
Building an BSP.
A page can have the following versions:
 Page with flow logic
These are simple pages with event handlers, but without much application logic or
visualization elements. It is possible to build a BSP application exclusively out of
pages with flow logic and event handlers.
 View
Views are used to visualize data, see also Model View Controller (MVC).
 Page fragment
These are created in the same way as normal BSPs, but are then marked as page
fragments. Other BSPs can also include these fragments using the
includedirective (see Include Directive).
• Navigation structures
The navigation structure determines which navigation request is used to direct the
navigation process from which page to which subsequent page.
• Application class
The business logic of a BSP application is encapsulated in an application class. This class
is realized by means of a global ABAP class which implements the access to business data
using BAPI calls, for example. Every page of a BSP application can directly reference the
components of this class (attributes, methods, and so on) using the predefined Object
application.
You can also assign several BSP applications to an application class.
For more information, see Applications Class of a BSP Application.
• MIME objects
In the SAP system, all MIMEs, such as graphics, style sheets (used to define formatting
properties of individual HTML tags), audio files, video files, and so on, are stored and
administered in a central repository, the MIME repository.
For every new BSP application, a directory of the same name is created in the MIME
repository. This directory is used as a storage location for all application-specific MIMEs.
See also:
Accessing a BSP Application
Starting and Ending a BSP Application
Building a BSP

Creating BSP Applications


You can create BSP applications only with the Web Application Builder but not with
external Web development environments.
Prerequisites
If you wish to create the BSP application in another namespace that differs from the
standard namespace, you may only use the values provided by the system as namespace
identifiers.
Procedure

Like all Repository objects, a BSP application can be created by copying it. Note
that the corresponding MIMEs are not copied to the target object when you copy
BSP applications. For each new BSP application, the system creates an identically
named directory in the MIME Repository, but it is empty.
To create a new BSP application:
1. 1. Open the Object Navigator (SE80).
2. 2. Choose the BSP Application category from the object list selection and enter the
name of the application you want to create.
If you wish to assign the new BSP application to a valid namespace XYZ that differs from
the standard namespace, you must place the namespace as a prefix in front of the actual
name of the BSP application. The complete name must then be written in this form:
/XYZ/BSPApplication.
3. 3. Click or choose ENTER to confirm your entry.
The system checks to see whether or not a BSP application with that name already exists
in the SAP System. If it does not exist already, the Create Object dialog box appears.
4. 4. Choose Yes to create the BSP application.
The dialog box Web Application Builder: Create BSP Application is displayed.
5. 5. Enter a meaningful Short Description.
6. 6. Choose Create.
The system then displays the Create Object Catalog Entry dialog box.
1. 8. Assign a package to the service.
The system displays the BSP application you have created in the object list tree structure.

Result
The BSP application has been created in the Repository as a development object.

With the new BSP application, a service node with the same name is automatically
generated in the HTTP service maintenance (transaction SICF). As a rule, no such
entry exists for BSP applications that were created in earlier releases. In such
cases, you must create this node manually in the service maintenance transaction.
You call up the corresponding display through the menu function Goto → HTTP
Service Maintenance. Execute the steps as they are described in the section
Creating an ICF Service.
Afterwards, you can assign further attributes for the BSP applications at this point:
Property Description
Initial BSP Here you enter the name of a page that is to be used to start the BSP
application. This entry is important whenever you test the BSP application
from within the workbench.

Application class If you enter the name of an ABAP class as the application class in this
field, then this class can be directly referenced in the BSP application using
the predefined object application. You do not need to create an instance of
the application class and you can directly access its components (methods,
attributes, and events) from any BSP page.
An application class is used to transfer the business logic to a global class
that, in turn, is used to access business data using BAPI calls, for example.
You can assign application classes to more than one BSP application. (All
these applications use the same business logic.)
Note that the application class must exist in the same system and cannot be
addressed through RFC.
Stateful Activate this checkbox whenever the BSP application should be
implemented as stateful. For an explanation of this, refer to the section
Stateful BSP Applications.
See also:
Creating Pages
Creating a Controller

Creating Pages
Use
You can implement the layout for each page (often called BSP) using the script languages
ABAP and JavaScript.
BSPs can have different attributes: Therefore, when you create a page, we distinguish
formally between 3 page types:
Page with flow logic A page defined this way can implement the entire flow logic
itself (event handler-based model). The page can have event
handler and page parameters (including automatic attributes)
in addition to the layout.
Such a page is executable and can be addressed through a
URL or through navigation from other pages.
View Views are used solely for displaying application data. They
have page parameters in addition to the layout section. In
contrast to the page with flow logic, views have neither event
handlers nor automatic page attributes.
A controller class is generally assigned to a view. This class
controls the view calls and is responsible for communication
with the model.
Views are based on the MVC Programming Model and allow
you to clearly separate the application logic from the
presentation logic in BSP applications.
Page fragment Page fragments are special parts. You cannot use them as
stand-alone pages in an application. They are not executable
directly. Instead, you include them into other pages using the
include directive.

<%@ include file=' /fragment.htm'%>.

A page fragment cannot define event handlers or


parameters.
You can implement a page with flow logic or a view (or even a controller) as an error
page. See also: Creating Error Page

Prerequisites
You have already created the BSP application.
Procedure
To create a page for your BSP application from within the object list (SE80):
1. 1. Right-click the BSP application.
2. 2. From the context menu, choose Create → Page.
The system displays the Create Page dialog box.
3. 3. Provide further specifications on the page by enter the name of the page and a
short page description. Afterwards, select the required option for the page type (view
/ page with flow logic / page fragment).
4. 4. Choose Enter to confirm your entries.
The system displays the layout editor for the new page in the tool area.
1. 5. Choose Saveto save your page.
Result
The created page is assigned as subobject to the BSP application and stored in the
Repository. Besides the basic HTML structure, the page directive is pre-generated:
<%@ page language="abap" %> bzw. <%@ page
language="javascript" %>
The page directive determines the script language. The script languages supported are
currently ABAP and JavaScript.

If you have chosen the page type View, both tab pages Event handler and Type
definitions are suppressed – in contrast to a page with flow logic.
If you have chosen Page fragment as the page type, the tab pages Event handler,
Page attributes, and Type definitions are suppressed.
See also
Determining the Page Flow
Creating the Controller
BSP Directives

Creating a Controller
Use
You create a controller to use a Model View Controller design pattern in your BSP application.
You can use a controller for the initial access (see also Testing Controllers).
Prerequisites
You are in a system from SAP Web AS 6.20.

Procedure

1. Use the Web Application Builder in the ABAP Workbench (Transaction SE80) to create a
controller object as a sub-object of your BSP application.

In doing so, you determine the controller name and the class name of the controller. The
URL is automatically inserted from the name of the BSP application and the controller
name.

2. In the Class Builder (Transaction SE24), create the class that is derived from
CL_BSP_CONTROLLER2.

If you create your class directly from the Web Application Builder by double-clicking on
the class names, then the inheritance of CL_BSP_CONTROLLER2 has already been
configured.

3. Overwrite some of the methods of your class, especially DO_REQUEST.

You can find additional information about these methods in


CL_BSP_CONTROLLER2 and Process Flow.

4. Save and activate your class and your controller.

Example
You can find examples of controllers in BSP application ITMVC2.

You might also like