GRC
HR
SCM
CRM
BI


Article

 

A Guided Tour of the New ABAP Workbench

by Karl Kessler and Joachim Jakob | SAPinsider

June 1, 2000

by Karl Kessler and Joachim Jakob, SAP AG SAPinsider - 2000 (Volume 1), June (Issue 1)
 

With the development of ABAP Objects, ABAP Workbench Release 4.6A/B, and its Object Navigator, SAP has focused on creating a powerful new environment for developers that offers some major benefits in both look and function.

In its early years, SAP's R/3 system was primarily transaction-oriented, designed for rich functionality and high performance. Now, with the development of ABAP Objects and the new ABAP Workbench, SAP has focused its efforts on creating a powerful new environment for developers that offers some major benefits in both look and function. The Release 4.6A/B Workbench and its Object Navigator (transaction SE80) gives developers a new, Web-like visual framework that allows developers to:

  • Display object lists, such as ABAP programs, by means of controls so that you can simultaneously view their overall structure, as well as specific details about their make-up
  • Easily access reusable ABAP classes
  • Navigate from one development object to another
  • Explore multiple development objects simultaneously
  • Move from one tool to another without using transaction codes

     These features are designed to streamline your development efforts and help you produce more reliable code.

     In this article, we take you through the steps you can use to access and navigate objects via the Object Navigator, with a brief description of how the Object Navigator integrates the functions of the ABAP Editor and the SAP Class Builder. Finally, we turn our attention to the Web Application Builder, which, as of Release 4.6C, offers the functionality of the former SAP@Web Studio. The Web Application Builder is now an integral part of this new visual framework. (For more information on ABAP Workbench, see www.sap.com/solutions/ technology/abapover.htm.)

Control Technology and ABAP Objects

It is now common to find that the best approach to creating a powerful user interface with various control elements (such as tree and grid controls) and sophisticated user interaction techniques (like drag and drop) is best implemented using object technology. User interface elements are naturally perceived as programmatic objects that respond to method invocations based on user interaction. The advent of ABAP Objects, SAP's extension of its 4GL ABAP/4, has allowed developers to set up a control framework and infrastructure that is platform-neutral - i.e., it executes without code change in a Windows, Java, or pure HTML environment.

     Many R/3 applications have used the control framework to add navigation support in tree controls or to replace old-fashioned, full-screen lists with SAP's new ABAP List Viewer (ALV) grid control. The use of control technology does not force developers to rewrite the application code in object syntax, but simply offers developers a hierarchy of reusable ABAP classes. You can easily access those classes if you dynamically create objects and later invoke methods on them. Event handling is done using event handler classes that react to user interaction, such as a mouse-click or keystroke.

Exploring the Object Navigator

In this section, we take you step-by-step through the Object Navigator, from accessing objects, to working with multiple objects, and finally to some of the shortcuts and features that you can use to speed up development time and increase efficiency.

Starting the Object Navigator

When you first start the Object Navigator (transaction SE80), the system displays the initial Workbench screen that you see displayed in Figure 1. In this example, since no object has been selected so far, the default Workbench graphic appears in the window on the right. (You can change that graphic by customizing your personal user settings as described in the section user setting dialog options on page 69.)

Figure 1 Start Screen of the Object Navigator

     On the left of the Workbench screen you will find a resizable docking container that is separated into two areas. The upper area offers a field where you can select an object list. The lower area displays the selected object list. (The dropdown menu at the top of the selection area, shown in Figure 2, displays valid object list types to choose from, such as Program, Development class, etc.) To open an object in Object Navigator, follow these four steps:

Figure 2 Available Object List Types
  1. Select the object type. In this case, we select Program from the object list.
  2. Type the name of the program, in this case SAPMSDM1, in the field displayed in Figure 3.
  3. Press the Display button (the eyeglasses icon) to the right of the program name, as highlighted in Figure 3. The structure of the program appears in the lower area as a tree control, as shown in Figure 4.
  4. To further expand the structure, select an item - for example, the screen 0100 - and right-click. A dropdown menu will appear, as shown in Figure 5. These menus are context-specific, so you will encounter different menus depending on the type of program element (screens, GUI status, etc.).
Figure 3 The Display Button in the Program Dialog

Figure 4 Tree Controls in the Object Navigator

Figure 5 Context Menus in the Object Navigator

Context Menus

The dropdown context menu gives a quick indication of the functionality that a particular development object supports. Note that the context menus in Object Navigator have taken on much of the functionality that was available in the application toolbar in previous releases.

Displaying an Object

To display an object, simply point and click. For example, if you select the program name SAPMSDM1 in the object list, you find the display shown in Figure 6, which moves you automatically into the ABAP Editor. Once there, the system displays the structure of the program and the program's code simultaneously. This improves on previous releases, which force you to switch between detail and overview using the BACK (F3) button. Even if you choose to display the code via transaction SE38, you can later attach the structure display using the Hierarchy button, highlighted in Figure 7.

Figure 6 Overview and Detail of an Object

Figure 7 The Hierarchy Button in the Application Toolbar

Using Object Lists to Quickly Find Development Objects and Leverage Reusable Classes

As we have shown, if you select an item from the object list, or select Display or Change from the available context menu, the corresponding object will be displayed in the detail screen to the right of the navigational frame. However, the Object Navigator not only can display the entire structure of a single object, it also allows you to work with several object lists in parallel. Browsing and navigating object lists allows you to quickly find your development objects or leverage reusable software components such as the control framework classes.

     To give you a better understanding of this feature, we will take you through a scenario that uses the Workbench's Class Builder to take advantage of these control framework classes. (For a brief overview of the object architecture of the ABAP Workbench, see the sidebar "Object-Oriented Architecture of the New Workbench" on page 62. For a thorough analysis, the complete framework is documented in our book Controls Technology, available at http://shop.sap.com. See the description at the end of this article.)

Object-Oriented Architecture of the New Workbench

The navigation and user interface architecture of the new ABAP Workbench is an object-oriented framework where new tools can be quickly integrated. An example is the Web Application Builder, which is an integral part of the ABAP Workbench.

The Workbench Manager

The framework of the ABAP Workbench is built around a central component, the Workbench Manager (see Figure 8). The Workbench Manager is the mediator between the various types of Workbench tools, such as browsers (e.g., Object Navigator); editors (e.g., Class Builder and ABAP Editor); and GUI builders (Screen and Menu Painter). Because linking the Workbench tools directly would lead to a very inflexible architecture, the Workbench Manager is used instead. It controls every navigation operation inside the Workbench. Each navigation step is stored on the Workbench Manager's navigation stack and can be traced back to the very beginning of the Workbench session. The Workbench Manager is also responsible for finding and launching the desired tool whenever a navigation operation is executed.

Figure 8 Object-Oriented Workbench Architecture

Workbench Requests

All tools that participate in the Workbench navigation framework must be registered in the Workbench registry, which appears in Figure 8. To communicate with the tools in a uniform way, the Workbench Manager carries out navigation operations that are implemented as Workbench requests. A Workbench request is characterized by three elements:

  • An object type - e.g., Program

  • An object name - e.g., SAPMSDM1

  • An operation - e.g., DISPLAY

The various tools create Workbench requests to tell the Workbench Manager to launch another tool.

Request Processing

A typical control flow for processing a request is depicted in Figure 9. Imagine an end user who selects a form routine from a program structure while the dictionary transaction is still active. In this case, the Object Navigator creates a Workbench request (the target request) to display the include that contains the desired form routine. Taking this request, the Workbench Manager looks up the registry and determines the appropriate tool (the ABAP Editor, in our example).

Figure 9 Typical Control Flow in the Object Navigator

      Next, the Workbench Manager recognizes the currently active tool (the dictionary) and collects all information necessary for traceback. This includes the current Workbench request (edit dictionary object) plus some additional context information (cursor position). This information is stored on the navigation stack. Then, the Workbench Manager tells the active tool to terminate itself. The tool gains control to send a Save or Cancel dialog. Upon completion, the Workbench Manager launches the ABAP Editor and tells it to display the form.

Workbench Implementation and Interfaces

From an implementation point of view, every component in Figure 8 is implemented as a global ABAP class. Workbench requests and the request stack are implemented as ABAP classes as well.

     The contract between the Workbench Manager and the individual tools is defined through ABAP interfaces. The interface also allows the Workbench Manager to call the tools in a generic manner (i.e., to process a Workbench request). The interface also allows the tools to access the Workbench Manager, since a reference to the Manager is part of the interface. The Workbench Manager is primarily a background instance, although it provides layout and window management services.

     The tools that participate in the navigation framework can, of course, look different: some visualize themselves in ordinary dynpros, some live in docked control containers, and others use modal dialog boxes. The Workbench Manager puts a common abstraction layer on top of these different visualization techniques, and the tool displays itself in a prepared graphical environment. In other words, the Object Navigator creates a tree control to display the nodes of an object list, but the Workbench Manager offers the control container docked to the left of the current tool.

     The control framework is a set of reusable, global ABAP classes that are linked in an inheritance hierarchy. We'll first look at the reusable class CL_GUI_COLUMN_TREE.

     To access the control framework and to make changes using the Class Builder, take the following steps:

  1. In the object list selection field, select the object list type Class.

  2. Type CL_GUI_COLUMN_TREE and press ENTER. The system displays the structure of that class.

  3. Under Method, select ADD_ COLUMN.

  4. Press the Signature button, which we've indicated in Figure 10.
Figure 10 The Class Builder in the Object Navigator

     You seamlessly enter the Class Builder, as shown by the window's title in Figure 10. On the left are all available attributes and methods of that class. Public access is indicated by a green stoplight next to the method's name. The method's code is displayed in the lower right pane using an editor control. The list of input/output parameters in the upper right pane uses an ABAP List Viewer (ALV) grid control for display.

     The CL_GUI_COLUMN_TREE class we selected provides methods to display nodes in a hierarchy. To give some background on the control framework, several items can be associated with a node, and the items are inserted into individual columns. Hence, this class offers methods to add to columns, remove columns from a hierarchy, and set individual column properties such as text width.

     But what if we want to fill a hierarchy with data? Since the system also supports other kinds of hierarchies (e.g., list-based hierarchies, simple hierarchies) and those hierarchies also need to be filled, it would make sense to farm out this task to a common base class. By inspecting the superclasses of the class CL_GUI_COLUMN_TREE, you can investigate the inheritance relationship to identify and use a class that will handle this task. To do this, return to the Class Builder and from there:

  • Select the class CL_ITEM_TREE_ CONTROL. Under this class you will find public methods with names like ADD_NODES_AND_ITEMS. These methods allow you to fill a wide range of hierarchies using a generic method.

  • To continue to inspect the inheri- tance relationship, expand the superclasses branch and move to the class CL_GUI_CONTROL. This class is the base class for any kind of visual control attached to your dynpro and provides control-independent methods for positioning, setting keyboard focus, and the like. (See Figure 11.)
Figure 11 The Browser-Like Features in the Object Navigator

     Note that in Figure 10, the class in the navigation frame and the display frame are the same (GUI_COLUMN_TREE), but that in Figure 11, they differ from one another. When we navigate to another object list, or when we navigate to another object using traditional Workbench navigation (e.g., selecting CALL FUNCTION to launch the function builder), the navigation frame and the detail frame will be out of synch. This is designed to allow you to search for an existing class or function module without leaving your current editor session. At any time, you can synchronize the different frames by using the context menu (from object list to object) or by pressing the Hierarchy button (from object to object list) shown in Figure 7.

Helpful Shortcuts in the ABAP Editor

Within the framework of the new Workbench interface, the ABAP Editor supports a variety of shortcuts to make your work easier when editing source code. If you'd like to take advantage of these time-saving shortcuts, we offer a quick overview here. They include:

  • Windows shortcuts. The editor control is based on a standard Windows DLL. This also means that the new ABAP Editor supports Windows shortcuts, some of which are shown in the dropdown menu in Figure 12 and in the table shown in Figure 13. The complete list of available shortcuts can be found in the online help for the ABAP Editor.

  • Keyboard shortcuts. You can use the SHIFT, ARROW, and SCROLL keys to move within the text. You can also use the TAB key on marked text for source code indentation.

  • Automatic text scrolling. As the cursor reaches the editor's pane boundary, the source code scrolls automatically.

  • Context menus and toolbars. The dropdown menus and toolbars offer built-in functionality, including Find/ Restore and Comment features, as shown in Figure 12.


  • Drag and drop functionality. You are now able to move source code from one location to another within the frame, or from one object to another.
Figure 12 Editor-Specific Context Menus in the New Workbench

Shortcut Description Shortcut Description
Ctrl+Z Undo Shift+Page Down Select one screen down
Ctrl+Y Restore Shift+Home Select to the begining of a line
Ctrl+Home Move cursor to the first fully Shift+End Select to the end of a line
  visible character to the entire text Ctrl+F Call the find and replacing dialog
Ctrl+End Move cursor to the last fully visible character of the entire text Ctrl+G Find next
  character of the entire text Backspace Delete characters backward, any
Ctrl+A Select entire text   selected text is deleted
Shift+up arrow key Select one line up Ctrl+Backspace Delet words backward
Shift+down arrow key Select one line down Delete Delete characters forward, any
Shift+left arrow key Select one character to the left   selected text is deleted
Shift+right arrow key Select one character to the right Ctrl+Delete Delete words forward
Shift+Page Up Select one screen up    
Figure 13 Common Windows Shortcust Used in the New ABAP Editor

Improvements to the ABAP Editor

Of course, ABAP developers spend most of their working time in the ABAP Editor. SAP's Release 4.6 was designed to make this development time more efficient. Block mode is a good example: in previous releases the ABAP Editor was especially cumbersome to work with, given the local processing power on a developer's PC or workstation. Although some developers may work over a low-bandwith communication line with the backend system, the majority of users are connected to a LAN. Taking this into account, we integrated an editor control with plenty of nice desktop functions without losing the strong backend integration.

     You will also notice some changes onscreen. For example, in earlier releases only the visible lines of an editor session were transferred to the frontend; now you download the whole include in one step. While this may add a little time to the process, it certainly pays off, since you can now scroll the complete include locally at the frontend without having to wait for an empty server slot. Many text operations like cut and paste, search and replace, drag and drop, and upload and download are also carried out locally. Even commenting out source code and reverse are done immediately, and the local editor control keeps an undo/redo buffer for fast error correction.

     This means that you now access the server only when you save your work, check the syntax, or navigate to another object. For best processing performance, the ABAP Editor displays the program text the way it is stored in the database, without any special formatting according to your settings. To change the format, run a pretty print before saving.

New Features in the ABAP Workbench

User Settings Dialog Options

The user settings dialog (see Figure 14) helps you to define your preferences in the ABAP Editor, Workbench, and Class Builder. For example, in the ABAP Editor, it offers the option to move from edit control mode to table control mode. This is useful if, for example, you encounter performance problems in a WAN using the control-based editor and you want to switch to a table control-based editor that works in block mode. You can also set the options to change the default graphic from the Workbench screen by selecting Utilities ->Settings, choosing the tab Workbench (General), and unchecking the background image option. We also recommend using the table control editor mode for applying SAP source code modifications. "Web Browser" Navigation Features As you select objects or move along the inheritance relationship, the system maintains a navigation stack that you can examine and use for fast selection. The navigation toolbar also includes:

  • Buttons for forward and backward navigation

  • Bookmarks that you can set to each object list being displayed

  • The ability to navigate from class to class
Figure 14 Your Personal Workbench Settings

The Other Object Icon

This feature allows you to quickly move between different modes. For example, imagine that during program editing you discover that you need to look up a table definition. In previous releases, you would close the editor mode, open up a new external mode, launch the dictionary transaction, and display the table. In the new Workbench, the process is much faster. Simply select the Other object icon shown in Figure 15. A dialog pops up that allows you to work with any development object. The system also automatically puts the selected object into the navigation history for easy access. Using Other object is much faster than creating a new mode, and you don't have to remember the transaction codes or menu position - which is especially useful when you are working with more exotic development object types like authorization objects.

Figure 15 The Other Object Icon

Using Drag and Drop in the Workbench

One benefit of the new Workbench user interface is that you can enhance existing applications using controls technology. For example, what if you want to add some intranet pages to an application that provides ad hoc information? The system offers the class CL_GUI_HTML_VIEWER for that purpose. Follow these steps:

  1. Determine a screen to attach the HTML viewer by using the Screen Painter.

  2. Reserve some space on the screen (use the Screen Painter to position and name a custom control container).

  3. Define two reference variables, one for the container and one for the control, by using the appropriate ABAP Editor.

  4. In the Object Navigator, display the class CL_GUI_HTML_VIEWER by following the steps listed in the previous sections.

  5. Select the class name CL_GUI_ HTML_VIEWER and drag and drop it into your program. This inserts the pattern CREATE OBJECT.

  6. Select the SHOW_URL method and drop it into your program. This inserts the CALL METHOD pattern into your program, as shown in Figure 16.
Figure 16 Drag and Drop in the New Workbench

And That's Not All!

The new Workbench comes with a number of other helpful functions:

  • Traditional Workbench navigation is still supported. For example, you can monitor the navigation stack by pressing the Stack button (see Figure 17).

  • The Workbench offers a personalized work list window where you can keep a library of your favorite objects.

  • Multiset functions like mass transport are available through context menus. Simply select several objects and right-click (see Figure 18). Alternatively, you can drag object items from any given object list and drop them into your work list window.

  • The syntax check displays error messages in a docking container attached to the bottom of the screen. Red stoplights indicate errors, while yellow stoplights indicate warnings. The sys-tem corrects some misspellings automatically if you activate the hotspot that precedes the error.

  • Selecting the Full-Screen button, shown in Figure 19, will hide all navigation containers.

  • The Screen Painter in Release 4.6 comes with two new wizards to help you create tab strips and table controls more quickly. The wizards lead you through the creation process and explain every step in detail, as shown in the example in Figure 20.
Figure 17 Stack Button

Figure 18 Multi-Set Operations

Figure 19 The Full-Screen Button

Figure 20 A New Screen Painter Wizard

Integrating Web Applications with the Workbench

The Workbench, along with all its new features and its integration with tools such as the Class Builder and the ABAP Editor, also has the advantage of being highly integrated with the Web appli- cation functions found in the Web Application Builder. A detailed discussion of the Internet Transaction Server (ITS) is beyond the scope of this article. However, SAP offers direct support for the development of Easy Web Transactions (formerly called Internet Application Components) inside the ABAP Workbench.

     Easy Web Transactions are driven by a standard SAP GUI session where the ITS sends the user's input from a Web browser to a running SAP transaction. When the follow-up screen of the current transaction arrives, the ITS merges the SAP GUI's output into HTML templates and sends the result to the Web browser.

     Since R/3 Release 3.1, the development of suitable HTML templates has been done via SAP@Web Studio. Now, with Release 4.6C, developers can take the HTML templates inside the R/3 system and associate them with an Internet service name (in most cases, the name of the underlying SAP transaction). You now can also generate HTML templates from dynpros and attach MIME objects to your Web application.

Using the Workbench for Web Applications

How do Web applications work in the new Workbench? In some ways, a Web application is like any ordinary ABAP program, as you can see in Figure 21. In the Object Navigator, the application is displayed in tree form with suitable context menus. After entering the Object Navigator, you then move automatically into the Web Application Builder. From there, you can publish the whole Web application to the ITS and launch the service in a Web browser. The integration allows you to attach flow files to your service if you decide to decouple the flow logic from the underlying transaction and call BAPIs instead.

Figure 21 Business Functions and Business HTML in SAP's ABAP Development Workbench.

     One example of the ease of integration is found in a BAPI browser application developed in Web Application Builder, shown in Figure 22. The Object Navigator's ability to work so easily with the Web Application Builder (along with the other tools discussed earlier), is one of the best examples of how controls technology and objects allow us to quickly integrate Internet technology into a single, integral Workbench for SAP.

Figure 22 BAPI Application Designed with Web Application Builder

Conclusion

As we have shown in this "tour," the new ABAP Development Workbench has more than just a new look - the newly designed interface also brings with it some powerful functionality on a number of development fronts. The Object Navigator provides a new interface that allows you to more easily browse and navigate various applications and tools. The improvements to the processing capabilities, the ability to access reusable software components, and the integration features in the new Workbench are designed to take the high-performance tools available in SAP R/3 and make them easier to use. Each feature and improvement is designed to streamline the development process and lead to more reliable code. By taking advantage of the features that the Workbench has to offer, you can accelerate your development work and make your applications more enjoyable for end users.


Karl Kessler joined SAP in 1992. He is the product manager of the ABAP Workbench and responsible for all rollout activities. You can reach him via e-mail at karl.kessler@sap.com.

Joachim Jakob is a software development architect at SAP. He is responsible for the design and implementation of the new Workbench.


An email has been sent to:






More from SAPinsider



COMMENTS

Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!


SAPinsider
FAQ