Programming Web Applications with Ease

October 19, 2004 by admin

Web applications are becoming ever-more significant in the SAP environment. These applications run on a client in a browser and offer numerous advantages. They don’t require complicated installation, they can be stored centrally on a server, and the data is always available everywhere in its most up-to-date form. For the most part, Web applications also run independently of the operating system and do not require next-generation computers. These features mean that thin clients can be easily used. But Web applications can realize these advantages only when they offer at least as much functionality and ease of use as normal applications or the SAP graphical user interface (SAP GUI).

SAP offers a portfolio of tools to develop full-service Web applications and embed them in the application landscape. The portfolio included the SAP Internet Transaction Server (SAP ITS) that was originally available with SAP R/3 4.6. But application development was complex and placed great demands on the hardware. The programming model of Business Server Pages (BSP) that SAP introduced with SAP Web Application Server (SAP Web AS) 6.10, greatly reduces this complexity.
Using BSPs, developers can create dynamic Web content with SAP Web AS. With SAP Web AS 6.20, SAP expanded the technology to include abstraction techniques for BSP extensions and the Model View Controller (MVC) design pattern that separates design, flow control, and business logic. With its Web Dynpro development environment, SAP Web AS 6.40 delivers an additional key technology.

Strengths and weaknesses of the BSP programming model

A BSP application consists of various Web pages created with Hypertext Markup Language (HTML), the ABAP programming language, and JavaScript. HTML defines the appearance of the application, ABAP scripts its dynamic content (such as the display of internal tables), and JavaScript enriches HTML with interactive features. Page fragments offer an option to encapsulate reusable sections of code to save time when developing new BSPs. Users can execute HTML pages in a fixed order or as desired.
BSP applications thus fulfill the same requirements that users expect from applications that run in normal operating system environments. But the Web applications run independently of the operating system and require no additional programs or libraries other than the client browser.
When a user calls a BSP from a client browser, the ABAP runtime environment of SAP Web AS dynamically generates a current version of the page. The process interprets ABAP scripting sections and interweaves them with the static HTML code. The client browser can understand and display the resulting, final HTML code.
But BSPs also have their weaknesses. Mixing HTML code and ABAP scripting is prone to error and difficult to maintain because the runtime environment offers only inadequate support for the code. The more complex the coding, the more complex is the search for errors that only laborious effort can resolve. The server cannot determine if the HTML coding is syntactically correct; easily read formatting of the coding as is familiar from Pretty Printer is impossible. The display of ABAP types is also difficult and must reoccur for each field to format currencies correctly, for example.

The layout and uniform design of a BSP application demand discipline and care from developers. Of course, some options exist for standardization, such as Cascading Style Sheets (CSS), a markup language that is also available to HTML. Nonetheless, the developer’s task is to apply the layout to the page at hand. Changes in the GUI can require reapplying the changes to all BSPs.
Developers must also consider the differences between the various browsers on the market. Without browser-specific coding, a Web application is displayed and behaves differently in each browser. This situation means a great deal of administrative effort, especially in a heterogeneous client environment. Despite all the advantages of the BSP programming model, developers still need some time to handle repetitious programming tasks, avoid errors, and search for errors.

More flexibility with BSP extensions

The BSP extensions that SAP introduced with SAP Web AS 6.20 overcome all the weaknesses of the BSP programming model. BSP extensions are an abstraction technique that developers can use to express both the syntax and semantics of specific HTML coding sections with less time and effort. This enhancement of the BSP programming model is structured so that it can be used not only with HTML, but also with Extensible Markup Language (XML) or Wireless Markup Language (WML).
BSP extensions are containers for BSP elements. At runtime, each element makes an object or a specific functionality available. A BSP element has attributes and is assigned to an ABAP class that realizes the elements’ functionality, such as the width of entry fields. The attributes are also input parameters for the class, which also normally generate the dataflow for rendering on the Web site. This approach guarantees a high level of flexibility. For example, developers can easily handle the display for XML or WML and convert it into browser-specific coding. The call occurs in XML notation in the layout of the BSP.

Predefined and company-specific extensions

BSP element

BSP element

SAP provides a number of predefined BSP extensions with SAP Web AS. For example, the HTML for Business (HTMLB) BSP extension has an appropriate equivalent for each HTML object. And many attributes of BSP elements are identical to their opposite numbers in HTML elements. A series of powerful BSP elements have no direct equivalent in HTML. These elements support complex displays and the navigational behavior of complex applications. Such elements include the tableView element to display internal tables and the tree element that enables display of and navigation through tree structures.
Additional predefined BSP extensions, such as eXtended HTMLB (XHTMLB), pattern for HTMLB (PHTMLB), BENCHMARK, Extensible Stylesheet Language Transformation (XSLT), and BSP offer additional options for benchmarking or user interface patterns. They can be tailored to specific requirements. You can also write your own BSP extensions so that you can create a standardized portfolio of objects and functionalities for a special project.

Code comparison

Code comparison

The design of BSP extensions makes it easier to obtain an overview of layout coding and do so more quickly, as shown in the illustration. It shows two listings, each of which generates an HTML table with data from an internal table when called in a Web browser. An additional advantage of using BSP extensions is that you can use formatting utilities and check the layout coding. At the latest, the development environment checks the correctness of BSPs when they are called. Changes generally require intervention in only one location; the changes are then transferred directly to all the affected BSPs or BSP applications. BSP extensions are easy to work with because they are completely integrated into the SAP development environment for ABAP and Java. For example, users can move BSP elements directly into BSPs with drag and drop. The attributes are automatically populated with the default setting. The Pretty Printer rounds out the function to enable good manageability of coding in the layout portion.
For a comprehensive overview, see the book “SAP Web Application Server”, from SAP Press.

Frederic Heinemann

Frederic Heinemann

Tags: ,

Leave a Reply