You are on page 1of 9

Development and Extension Guide SAP E-Commerce 5.

Introduction to SAP J2EE

The SAP J2EE architecture consists of a multi-tiered distributed application model. This means that the application logic is divided into different components according to function. These various application components are installed on different machines depending on which tier in the multi-tiered SAP J2EE environment the application component belongs to. SAP J2EE multi-tiered applications are generally considered to be three-tiered applications because they are distributed over three different locations: Client machines SAP J2EE application server Database or legacy systems at the backend The next figure shows a SAP J2EE three-tier architecture described in the bullet list below. First tier Client components run on the client machine; serves as a user interface. Middle tier Web container and EJB container run on the SAP J2EE application server; offers different services. Third tier Enterprise information system (EIS) software runs on the EIS server (ERP systems, database systems, and so on)

Figure 1: SAP J2EE three-tier architecture

The main benefits of the multi-tiered distributed application model are: Components can be reused Availability of a unified security model Flexible transaction control September 2006 20

Development and Extension Guide SAP E-Commerce 5.0

SAP Web Application Server Java

The SAP Web Application Server Java is part of the SAP Web Application Server platform and consists of the Web container, the EJB container, and services. The Web container is responsible for server-side presentation and for flow control. It contains Java Server Pages and Servlets. The EJB container is responsible for server-side business logic and therefore contains Enterprise Java Beans. The EJB container is not used by our Internet Sales application, because in our case the business logic is included in the SAP CRM (ERP) system. SAP J2EE based services, for instance resource pooling, security, naming, and so on, are offered by the service component of the SAP J2EE application server.

Figure 2: Components of the SAP J2EE Application Server

Web Container
As mentioned before, the Web container consists of Servlets and JSPs. Servlets are Java programming language classes. A Servlet can be thought of as an applet that runs on the server side, without a user interface. Java Servlets allow clients to execute programming code on the SAP J2EE Application Server. Servlets are request/ response oriented. HTTP Servlets receive a request in the form of an HTTPServletRequest object and return a response in the form of an HTTPServletResponse. JSP pages are text-based documents that execute as Servlets, but allow a more natural approach to creating static content. Java Server Pages cleanly separate Web content (HTML and XML) from programming code by allowing Web developers to move programming logic into components. This means that Web application developers can concentrate on developing components while content developers build the HTML presentation. Furthermore, Java Server Pages simplify dynamic page development with tags. Java Server Pages technology encapsulates much of the functionality required for dynamic content generation in easy-to-use, JSP-specific XML tags. These tags can be used to access components, download applets and perform other functions that would be difficult to develop with programming code. Additionally, you can create a set of custom tags, for instance, that access database functions or some other business logic. Our Internet Sales application uses these custom tags for certain purposes, for example, translation, completion of a URL, iteration, and so on.

September 2006


Development and Extension Guide SAP E-Commerce 5.0

E-Commerce Framework
E-Commerce 5.0 is based on the SAP J2EE platform designed to support the requirements of modern, extendable, e-business oriented, enterprise application systems. SAP J2EE provides component-based, scalable application architecture. This chapter gives you a rough overview of the E-Commerce Framework to help you to understand the main framework concepts. This is a prerequisite for the following paragraphs, in which each layer is discussed in more detail. You need this information to understand the programming model of the ECO application, as well as possible customer-extensions to the standard application.

September 2006


Development and Extension Guide SAP E-Commerce 5.0

E-Commerce Architecture Overview

The picture below shows the architecture of SAP E-Commerce for mySAP CRM 2005. . SAP E-Commerce for mySAP CRM TREX


CRM System XI BW IPC Engine Web AS ABAP ABAP Stack

Web Server Web Browser

CRM Java Components SAP EP Web AS Java


Java Stack




Optional Backends

Figure 3: Architecture of SAP E-Commerce for mySAP CRM 2005.

September 2006


Development and Extension Guide SAP E-Commerce 5.0

The picture below shows the architecture of SAP E-Commerce for mySAP ERP 2005.

SAP E-Commerce for mySAP ERP TREX


ERP System XI BW IPC Engine Web AS ABAP ABAP Stack

Web Server Web Browser

ERP Java Components SAP EP Web AS Java


Java Stack



Figure 4: Architecture of SAP E-Commerce for mySAP ERP 2005

In case you use an older ERP or R/3 release, the architecture of SAP E-Commerce for mySAP ERP might be different, since the IPC Engine has to be installed in an SAP Web Application Server ABAP 7.0, which has to be installed seperately.

The ECO architecture pictures above containe some components that are only required for special processes or are optional. It might be possible that some components are not required in your system landscape.

September 2006


Development and Extension Guide SAP E-Commerce 5.0 With SAP J2EE the presentation of data in E-Commerce is carried out exclusively on the client layer via the Web Browser. The HTML data is dynamically generated via Servlets and Java Server Pages (JSPs). A SAP J2EE Servlet Engine processes the dynamic generation of the HTML data as a server-side process. The Web browser is merely responsible for presenting the generated data. The server-side interaction layer processes user requests and calls the server-side business logic and the respective business applications. The resulting data is then forwarded to the server-side presentation layer, which generates the pages to be displayed by the browser. Communication between the SAP J2EE platform and the SAP CRM (ERP) system takes place via the SAP Java Connector. As mentioned above, Java technology is limited to the front-end area, that is, to layout design and the interaction logic of the Web shop. Business logic (such as order processing with partner determination, text determination, and so on) remains in the SAP CRM (ERP) system. Internet Sales is a full SAP J2EE compliant application but has been released on SAP J2EE Engine only. Other runtime environments have not been tested and are therefore not supported.

Layered Architecture
The ISA application architecture consists of the following layers: Server-side interaction and presentation layer Business Object layer Provides business functionality backend Business Objects not aware of backend system details. Business Logic Service layer (BLS) Manages the backend depended part of the application. Additional generic services are used throughout all layers: Loggon/Tracing Extended Configuration Management Used for configuration of the various layers. For example, connection parameters, backend object implementation classes, and so on.

Internet Sales Application

Internet Sales Framework

JSPs Actions Business Objects Backend Objects Connection Handling JCo

UI / Interaction / Custom Tags BO-Layer BLS-Layer Backend Objects Socket JDBC


Logging / XCM

CRM / R3 Catalog




Figure 5: Layered Architecture

September 2006


Development and Extension Guide SAP E-Commerce 5.0

Interaction and Presentation Layer

This layer is responsible for providing the user interface as well as the navigation within the application. This layer represents the view and the controller in a Model-View-Controller programming model. The user interface is realized using Java Server Page technology. The Interaction and Presentation Layer is realized using the Struts framework (see [3] Struts documentation: is an open source controller framework providing the Model-View-Controller programming model in a JSP/Servlet environment. It acts as an interface between the HTTP world and the business logic, which is not aware of any user interface.

Interaction Layer

Controller ActionServlet (Servlet)
r u eq t es

Business Object Layer

dispatch Actions BO


te da up




re s po


View JavaServer Pages

JSPs "View"
retrieve BO

Figure 6: Internal processes within the interacton and presentation layer

The above diagram gives an overview of the internal processes within the interaction and presentation layer when an HTTP request is sent to the ISA application by a client (usually web browser). All client HTTP requests are routed through the central controller Servlet ActionSevlet. This Servlet acts as a central dispatcher, routing all incoming requests to appropriate Actions. The dispatching mechanism is configured externally. Actions represent a server-side processing unit and are accessed via a common interface. They act as a mediator between the HTTP world and the Business Objects. After calling the appropriate Business Object(s) the process control returns to the ActionServlet. Depending on the return value of the called Action and the external configuration, an appropriate JSP (or other Action) is called, in order to present the result of the calculation to the user. After mixing the static HTML content with the dynamic content the result is sent back to the client.

Business Object Layer (BO Layer)

The Business Object layer hosts Java-based Business Objects used by the Interaction and Presentation layer. Business Objects provide business functionality via well-defined interfaces in a backend-independent manner. Business functions are either completely provided by these objects or are located in an Enterprise Information System (EIS). An EIS is never accessed directly from the BO layer, because Business Objects are not aware of any backend-specific details. If they have to communicate with a backend they do so using a set of generic interfaces provided by corresponding Backend Objects. The implementation of these interfaces is backend-specific but the interfaces themselves are not.

September 2006


Development and Extension Guide SAP E-Commerce 5.0

Business Objects are managed by Business Object Managers (BOM). A BOM is used as a central access point for accessing Business Objects. When Actions are accessing a Business Object they have to obtain a reference to it from the BOM.

Session Context


BO Layer
Business ObjectManager





Figure 7: BO Layer and the Business Object Manager

Business Logic Service Layer (BLS Layer)

This layer provides access to business functions located in the various Enterprise Information Systems (EIS) (e.g. CRM, ERP) Many Business Objects (for example, basket) in the Business Object layer have a corresponding Backend Object in the BLS layer. The functionality of a Backend Object is accessed via a well-defined Java interface (for example, BasketBackend). The implementation of such an interface is backend-dependent (for example, BasketCRM). A Business Object obtains a reference to a backend object from the Backend Object Manager (BEM). The BEM takes care of the lifecycle of backend objects and returns their references to the BO layer. The ISA Framework can handle communication to various backend systems simultaneously. Depending on the used backend, different backend object implementations have to be instantiated (for example, BasketCRM, or BasketR3). Additionally, the framework takes care that the correct connection data is used. All this is configured in Extended Configuration Management.

September 2006


Development and Extension Guide SAP E-Commerce 5.0

Business Object Layer BO Basket


Business Logic Service Layer XCM Backend Object Manager BEM

<<configure>> <<reference>>

<< interface >> BasketBackend




Connection Management JCo Enterprise Application System CRM R3

Figure 8: Business Logic Service Layer (BLS Layer)

Presentation Layer Details

The Presentation layer is a relatively thin layer in the ISA framework. It consists basically of the SAP J2EE compliant JSP functionality and some ISA specific custom tags.

Struts tags are not used and are not supposed to be used in customer projects.

This chapter covers the server-side aspects of the ISA framework. Besides custom tags there are no ISA specific extensions which can be discussed here.

Custom ISA Tags

Since the ISA tags are not supposed to generate HTML code (to facilitate UI adjustment), the ISA application will not use this group of tags. Non UI tags, however, are provided. These are described in the following section. The functions of all the tags described are packaged as static functions in the class This means that you can use the functions of the tag library from any Scriplets.

September 2006