© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
Ł. PęgielABAP in Eclipsehttps://doi.org/10.1007/978-1-4842-6963-3_2

2. Views

Łukasz Pęgiel1  
(1)
Tychy, Poland
 

Views are the single tabs (windows) that you can see inside your Eclipse perspective. For example, when you created your first project, you saw the project in the Project Explorer view. This view has a tree of projects and objects. There are many different types of views, such as form base views, table views, browser views, etc.

There are built-in standard Eclipse views and many others that you installed with the ABAP Development Tools. This chapter covers the most important views for ABAP developers. When I describe the standard views, I describe how they work with ABAP. This does not mean they will act the same way in other programming languages. The behavior of the view depends on the Editor view, which is different for each language supported by Eclipse.

Project Explorer

When Chapter 1 described the creation of the ABAP and ABAP Cloud projects, the Project Explorer view was introduced. This is the base view that will probably stay open in most of your perspectives, as it allows you to navigate through all the objects using the package or object type folders.

As you might remember, each ABAP project is a virtual representation of the SAP instance, with a fixed client, user, and language. There are on-premise ABAP projects and ABAP Cloud projects. As you can see in Figure 2-1, these project types display different content, as the systems are also different.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig1_HTML.jpg
Figure 2-1

Project Explorer with ABAP and ABAP Cloud projects

ABAP Repository Trees

When you expand the project on a system that’s based on SAP NetWeaver release lower than 7.51 and/or without the SAP HANA database, you will see the following repositories: Favorite Packages and System Library. Favorite Packages can be added during the creation of the project as well as by using the context menu of the Project Explorer. The System Library contains all the packages of the current SAP instance. Each package in this view can contain zero or several subpackages and folders assigned to the current package objects. Its hierarchy is very similar to the SE80 one, which you can see in Figure 2-2. As in SE80, using the context menu on a folder, package, or object will allow you to create or delete new objects, activate them, or change the package assignment.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig2_HTML.jpg
Figure 2-2

Comparing E80 and Project Explorer

The default Favorite Packages folder contains the $TMP package with the user’s local objects linked to the project. By using the context menu (right-click the Favorite Packages node), you can add other packages to your favorites as well as add other users’ local objects to your favorites. To do so, use the context menu, then choose Add a Package… or Add Local objects of User….

The Add a Package action will open a separate popup window, which you saw when creating the project. It will allow you to search for the packages by name.

Add Local Objects of User will also open a separate popup window, but only to select the user whose local objects you want to see in your favorites.

The Favorite Packages folder is extremely helpful if you work on a larger development, and if you use one or several packages only for the purpose of this project. When you have huge packages in your company that contain development objects for one big module, for example, it’s no longer useful to use the Favorite Packages folder. Too many unconnected objects make it difficult to navigate through.

Systems that already work on SAP NetWeaver 7.51 or higher and with the SAP HANA database have a different structure. By default, they have Favorite Packages, Favorite Objects, and Released Objects repositories. Of course, the Favorite Packages node works exactly the same as before.

Favorites Objects works very similarly to Favorite Packages, but it contains only the single repository objects, not the packages. This means you can add function groups, function modules, classes, programs, and other repository objects there, but not packages. You can add objects to the favorites by selecting them from the Project Explorer, either from Favorite Packages, Released Objects, or any other ABAP Repository Tree.

Released Objects contains all released objects in the cloud environment. These objects can be released by SAP or by anyone else from your company.

There are some more repositories that you could use. To use one, right-click the project and choose New ➤ ABAP Repository Tree.. Or, if that option is not available in your installation, choose New ➤ Other ➤ ABAP ➤ ABAP Repository Tree. A new window will appear with all the possible repository templates for the current system, as you can see in Figure 2-3.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig3_HTML.jpg
Figure 2-3

New ABAP Repository Tree

Those repositories are much more powerful than the ones in older SAP releases, as they allow additional filtering by type and name. If you choose, for example, the My Objects template, you will get the property filter set to your username. As you can see in Figure 2-4, the tree structure can be defined in here. It is preconfigured for the My Objects template that the structure will be Package ➤ Object Type. But if you want to, you can remove one or both and choose any other tree level from the available levels found on the left side of the window.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig4_HTML.jpg
Figure 2-4

My Object template for the ABAP Repository Tree

All the available property filters can be found in Figure 2-5. It can be extremely helpful to combine filters together. For example, you can filter the repository by package, owner (creator), and type (like class or CDS).
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig5_HTML.jpg
Figure 2-5

Property filters of the ABAP Repository Tree

The property filter, together with the naming filter, allows you to create useful repositories for your daily work.

Caution

Although you may be able to add GUI transactions to the Favorite Objects, or see them if you add one of the standard SAP packages to your favorites, you will not be able to use the GUI transactions in cloud projects, as GUI is not allowed with ABAP Cloud projects.

Context Menu Actions

There are many actions you can do from Project Explorer’s context menu. Some of them are obvious, and some of them call other views. Let’s take a look at Table 2-1, where the most important actions for ABAP developers are described.
Table 2-1

Project Explorer Context Menu Actions

Action

Usage

Duplicate

This action can be triggered not only on ABAP repository objects, but also on the projects themselves. It will copy the chosen object under the new name.

Open With

Expand this action to see the possibilities to open an object in SAP GUI (for on-premise systems), Data Preview, Activation Graph, Dictionary Log, Active Annotations, Annotations Propagation, or Dependency Analyzer views.

Open in Project

Choose in which of the ABAP projects the object should be opened.

Open ABAP Type Hierarchy

Open the selected object in ABAP Type Hierarchy view.

Coverage As

When you expand this action and you see ABAP Unit Tests, this means you can run a unit test for the selected objects and open the ABAP Unit & ABAP Coverage views at the same time.

Run As

You will use this action to run the object in the SAP GUI (ABAP Application), call ABAP Test Cockpit with default or selected check variant, and run ABAP Unit Test or ABAP Application in Console (for cloud development).

Get Where-Used List

With this function, a use of the selected object will be shown in the Search view.

Share Link

You can share the object using HTTP Link or ADT Link. HTTP Link will display the object in any browser for display only purposes, and ADT Link will be opened by Eclipse.

Profile As

Activate the profiling of the object using one of the three methods—ABAP Application for GUI or Console and as ABAP Unit.

Change Package Assignment

A very useful function to switch the package of the objects.

Change API State

Change the API state for example to released.

Compare With

You can compare the selected object with the previous revisions (versions) or between systems. The compared source code will be displayed in a separate view.

Export

Export the ABAP Doc documentation into HTML files. It is very similar to JAVA Doc. Just run the action, expand the ABAP folder, and select ABAP Doc.

Expand Folder By

Available only on the releases in which you can create your own ABAP Repository Trees. Allows you to switch the type of expansion from current one to owner, object type, API state, and some more.

Configure Tree

Available only on the releases in which you can create your own ABAP Repository Trees. Gives you the possibility to customize the current tree.

SQL Trace

You can activate or deactivate SQL Trace from here.

SQL Console

You can launch SQL Console view for the current project, which allows you to test SQL statements outside of ABAP objects.

Properties

Run the project specific configuration.

Toolbar and View Menu

If you thought we were done covering Project Explorer, then you were wrong. There are still a few important functionalities that you can run from the toolbar and the View menu.

The toolbar can always be found close to the view tab. If there is enough space, it is visible on the right side of the view tab name; in other cases, it can be found below the tab. This behavior is the same for any view.

Besides the toolbar it is common to have the View menu, which is accessible from the toolbar. You can see the toolbar and the View menu in Figure 2-6.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig6_HTML.jpg
Figure 2-6

Project Explorer toolbar and View menu

In the Project Explorer view, the toolbar consists of Collapse All, Link with Editor, Filter, View menu, and the Minimize and Maximize buttons.

Collapse All is helpful when you have opened several projects during the day and you want to collapse every node. When this is used, all tree nodes will be collapsed.

The Link with Editor function is quite common in Eclipse views. The behavior can be a bit different between the views, but basically the content of the view will change to show information linked to the active editor. In the Project Explorer, the aim of the linking is to navigate through the whole structure of the project to the currently opened object.

It may not be clear to you yet that you can open objects in several ways, not only from the Project Explorer. That is why, when you open the object using other ways, the Project Explorer can show you the place where the object is placed. Depending on whether I am working from home using VPN or at office, I switch this option on or off, as it can be very frustrating on a slow network connection.

The filter is not useful in ABAP projects, but it can be with other ones. Here you can set up what kind of content you want to see in your project.

The View menu, in the case of ABAP Projects, could be shortened only to the working sets part and the top-level elements. I mentioned working sets during the creation of the projects. You can group projects in them, and select which workings sets should be displayed. To use working sets, just go to the View menu and choose Select Working Set. The window shown in Figure 2-7 will be displayed.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig7_HTML.jpg
Figure 2-7

Selecting working sets

There are no built-in ABAP working sets, so you need to create your own. To do so, just click the New… button and select Resource as the working set type. In the next step you will be able to give it a name and select which projects should be included in it.

In my example, I created two working sets. On-premise, which contains the project NPL, and Cloud, which contains TRL. You can create different working sets, and the split and grouping depends only on you. In order to display your working sets, you need to select the checkbox close to their names from the working sets list.

You may be surprised that nothing has changed in the Project Explorer after you confirm all the steps. In order to display working sets, you need to go to the View menu and choose Top Level Elements ➤ Working Sets. Now your Project Explorer view should look similar to the one shown in Figure 2-8.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig8_HTML.jpg
Figure 2-8

Project Explorer with working sets

Outline

This view is available in the ABAP perspective from the beginning and is one of the most commonly used (Figure 2-9). It helps you navigate through the code of the currently opened objects. It allows you to see all the members of the currently opened object.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig9_HTML.jpg
Figure 2-9

Outline view

This may be strange, but you should know it from the start: you will not see the components of the includes here if your editor currently handles the main object (program). But of course you will see the list of the includes and you will be able to navigate to them. You will see types, variables, local classes, events, friends, forms, and methods, but only for the current object. This might seem a disadvantage, but in most cases, it is not. After more than 20 years of availability of the object orientation in ABAP, I hope that you are familiar with it and will miss only inherited members on this view, in comparison to SE80.

When you select any of the object members from the Outline view, the code editor will navigate to the position of the selected member.

You can choose to sort the displayed members. By default they are sorted by type, visibility, and placement in the code, but you can use the Sort button on the toolbar to sort them by type and name only.

You can also show only public members of the object using the Hide Non-Public Members button.

By default, this view is linked to the editor, which means when you switch the editor tab to another object, it will be refreshed and members of the selected object will be displayed. You can unlink it from the View menu.

Problems

This view is also one of the basic. It is helpful during programming, as all messages will be visible here. You will see syntax errors and warnings here, as well as error messages found when activating an object (Figure 2-10).

When you double-click the message, you will be navigated to the problem line. When you right-click and select Problem Description, a new view called ABAP Problem Description will open with additional information. Once you fix the problem, it will disappear from the list.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig10_HTML.jpg
Figure 2-10

Problems view

By default, this view shows all the errors of the objects opened in the workspace. You can customize it by clicking the Filters button on the view toolbar or selecting it from the View menu. You can customize the filters, as shown in Figure 2-11, by choosing the scope of the view, setting the severity of the messages, and setting the types of the issues. This can be quite useful when you work with several systems and are mainly in maintenance mode, or when you use Eclipse to create Java or another type of application and you keep all of them in one workspace.

There are four predefined configurations:
  • Errors/warnings on project

  • Errors/warnings on selection

  • Warnings on selection

  • All errors on workspace

../images/504993_1_En_2_Chapter/504993_1_En_2_Fig11_HTML.jpg
Figure 2-11

Filters of Problems view

You can switch between this configuration using the Show action of the View menu, where all configurations will be listed. You can also create your own configurations using the New button on the Filters area.

One last thing you can do, besides sorting and grouping, is create an additional Problems view. You can do this by using the View menu and choosing the New Problems View action. You will be able to give the view a name and set up its configuration, but this additional view will only be available in the current perspective.

Properties

Usually , we do not make many changes to the attributes of ABAP objects, but if you need to change the object description or some specific object type settings, you need to use the Properties view.

Figure 2-12 shows the General tab, which you will always find inside that view. It displays basic information about the object, such as its package, activation status, description, creation, and update information. With most of the objects, you will be able to change the description. Depending on the object type and system version, you may also see tabs like Specific, API State, or Chart.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig12_HTML.jpg
Figure 2-12

General tab of properties for the ABAP class

The Specific tab shows different attributes for different object types. For example, in the case of classes, it will show ABAP Language Version, Fix Point Arithmetic, Shared Memory Enablement, Status, and Message Class. For function modules, you will find Processing Type (Normal, RFC, Update) and Release State here. In the case of programs, it will show the ABAP Language Version, Fix Point Arithmetic, Start Using Variant, Status, Authorization Group, Logical Database, and Selection Screen Number. Unfortunately, the visibility of the attributes depends on the NetWeaver stack.

The API State will be visible in classes, CDS views, and function modules, but only if your system is using a HANA database.

It’s the same with the Chart tab: if you’re using systems with a HANA database, you can see the graphical representation of the object type differentiation. This tab will be visible if you select a package or any of its subfolders in the Project Explorer.

Templates

When you are reusing parts of your code, but naming objects and variables differently, and you want to speed up the code-writing process, you can use templates. They allow you to prepare code snippets and containers for quick refactoring.

SAP prepared some default templates, but you are free to create some on your own. I bet you will create at least one—a program or class signature that your company or client wants to have at the beginning of each object.

Figure 2-13 shows an example of the template called lcl, which is used to create local classes more quickly. In order to use it, just double-click it and it will appear in the last place of the cursor in the active editor. (There is a quicker way to insert a template directly from the editor, but I will explain that later.)
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig13_HTML.jpg
Figure 2-13

Templates view

Creating new templates is quite simple; you need to click the Create New Template button on the view toolbar, then fill out the name, description, and pattern. The pattern can be simple, static text, or you can use variables that enter some default values for you or allow you to rename them after inserting the template into your object.

Listing 2-1 shows a very simple template of an object signature, which will add comment lines with the object name, creation date and time, current user, and original system. It allows you to enter a description.
***********************************************
* ${enclosing_object}
* Created on : ${d:date('YYYY-MM-dd')} ${time}
* Created by : ${user}
* Original system: ${system_id}
*
* Purpose: ${Description}${cursor}
***********************************************
Listing 2-1

Sample Template for Object Signature

This template will give the result shown in Figure 2-14. As you can see, the variables were directly replaced during inserting, the description was highlighted and will be overwritten upon pressing any character on your keyboard. And last but not least, when you press the Enter button, the cursor will move to the end of the description. If you had more than one variable that is not automatic, you can switch between them using the Tab key.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig14_HTML.jpg
Figure 2-14

Template after inserting it into the code

If you want to use your own variables in the template, just give them a name that is not the same as one of the built-in variables (see Table 2-2). In this example, ${Description} was my own variable. In the standard template lcl, it was ${lcl_} and ${private}. Also notice that the variable ${lcl_} appears twice in the standard template. Renaming the variable in one place will likewise rename the other.
Table 2-2

Possible Eclipse Variables in Templates

Variable

Description

${date}

Enter the date. When used in short form ${date} it will put it in default system locale, but you can force the format using any of the java.text.SimpleDateFormat. For example, ${iso:date('yyyy-MM-dd HH:mm:ss Z')} will insert the date in the format 2020-10-19 23:12:15 +0200,

${d:date('EEEE dd MM yyyy', 'en_GB')} will insert Monday 19 10 2020

${time}

Insert the current time.

${year}

Insert the current year.

${user}

Insert the current user name (sy-uname).

${enclosing_object}

Insert the current object name, for example class or program name.

${enclosing_package}

Insert the package of the current object.

${system_id}

Insert the system ID (sy-sysid).

${word_selection}

You can also use a selected piece of code as a part of your template. To do so, use ${word_selection} in the template, and before inserting, select the code that you want to include and insert the template. If you want to have some default text inserted if the selection is not done, use the following syntax ${currentWord:word_selection('"Default text"')}

${line_selection}

It works exactly the same as ${word_selection}, but for multiple lines. If you want to use this with a default text value, you need to use the following syntax ${currentLine:line_selection('"Default text"')}

${cursor}

Specify where the cursor will be placed after you leave edit mode of the inserted template.

$$

Insert a $ sign .

Bookmarks

When I was describing the Project Explorer, I mentioned a context menu function called Add Bookmark, which you could use to store the object for later use. They are stored in Bookmarks views, which can be used as a kind of favorites list.

You can add each object from the Project Explorer as a bookmark. They will be added with the name that matches the resource name. When you right-click the bookmark entry and choose Properties, you will be able to change the description. When you double-click the bookmark entry, the object it points to will be opened in the associated editor.

You can also create bookmarks directly from the Editors vertical ruler, by using the context menu. That link will point directly to the selected line of an object. Figure 2-15 shows an example of Bookmarks view with five entries, including links to classes, a table, and a SAP GUI transaction.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig15_HTML.jpg
Figure 2-15

Bookmarks view with a few items

As it was with the Problems view, you can set up filters to change the scope of the view, or you can create several Bookmarks views, each with a different configuration.

This view is handy with small numbers of entries. However, because there is no search functionality and no way to group entries, it is very difficult to handle many entries in this view.

Search

Using the where-used list is very common task in a developer’s life. There are many use cases for it and it is nice to have a good tool for it. You can call it from the Project Explorer view or from the editor by using the Get Where-used List function.

As a result, you receive a tree with all occurrences of the selected object or its part (field of table, attribute of class, etc.). The Tree view is a nice solution here, as it shows the objects in which at least one occurrence of the searched object was found. You can expand the object to see the next level, which can be a method, a function module, an include, or the place of occurrence.

Figure 2-16 displays the results of a search for the ZCL_FALV class. These results are expanded on this example only in the first occurrence. You can see that there are five matches in the three lines of the CHANGE_SETTING method and there are a few more in other parts of the ZCL_FALV_COLUMN class.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig16_HTML.jpg
Figure 2-16

Where-used list of the ZCL_FALV class

When you double-click the line with the occurrence, the editor will open the place of occurrence. You can also navigate through the results using the up and down arrow buttons from the view toolbar, or using the Ctrl+, and Ctrl-. keyboard shortcuts. Using them will switch to the next/previous result and directly open the result in the editor.

If you want to scroll down quickly through all of the results, you can use the Expand All button. It will call the SAP backend to get details for all results and will expand the tree to the last level, giving you information about the total number of occurrences.

You can filter the results by package, object type, and creator. To do so, click the Filter button and add your criteria to the filter window. In Figure 2-17, you can see that I set up a filter for the $FALV package and CLAS/OC object type. You can find the description and possible entries by using the Ctrl+Space shortcut on the input fields. After the filter is applied, only the classes from the local $FALV package are displayed.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig17_HTML.jpg
Figure 2-17

Search view filter settings

One more useful functionality of the Search view is the search history. It keeps the last where-used lists, so you do not have to do the search again. This option can be found under the Search History button on the toolbar, as shown in Figure 2-18. You can set the number of searches to keep by choosing Search History ➤ History… ➤ Configure…. By default, it keeps 10 entries.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig18_HTML.jpg
Figure 2-18

Search history

By using the Pin button, you can ensure that the current results stay in the current view when you use the where-used functionality again. The results for the new search will be opened in a separate view.

History

Say you want to check the last changes in the object, to see if part of the code was removed. In SE80, you used Version Management for that purpose, but in Eclipse you use the History view. Like the Outline view, it can be linked to the editor, so whenever you change an active editor tab, the view will be updated with the history of the active object. As with the Search view, it allows you to pin it and to see the previously displayed results.

As it is presented in Figure 2-19, the view contains a list of all versions, release dates, linked transport requests, and descriptions. Once you choose the version to open, just double-click it. A new tab will appear in the editor area.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig19_HTML.jpg
Figure 2-19

History view for the ZJSON2ABAPTYPE program

Figure 2-20 shows the comparison tab with current version on the left and the historical version on the right. You can navigate through the changes using the toolbar buttons or the overview ruler. What can be really helpful is that in the current version part, you can edit your code. When you find a part of the code that was deleted in the past and you want to put it back in, you can simply copy and paste it. Or you can use Copy Current Change From Right To Left button.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig20_HTML.jpg
Figure 2-20

Comparing two revisions

Debug

This view is very small, but it’s always used during debugging. It will always show up when an ABAP breakpoint is reached. If you have more than one debugging session open, all of them will appear here.

The example shown in Figure 2-21 contains one debug session on the NPL system. You can see on it information about the line and place of breakpoint, as well as the whole call stack. You can use this call stack to navigate to the previous levels of the call by simply clicking them.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig21_HTML.jpg
Figure 2-21

Debug view with a call stack

When you want to terminate the session, you need to right-click the breakpoint description and choose one of these actions:
  • Terminate: Stop current debugger session and close application

  • Disconnect: Stop current debugger session, but continue with application

  • Terminate and Remove: Stop debugger, close application, and remove the session from the Debug view list

  • Terminate/Disconnect All: Stop all active debugger sessions and close all applications

I am not sure why the terminated debugger sessions are still kept in the view, but if you want to get rid of them, simply choose the Remove All Terminated action from the context menu.

Breakpoints

When you set up a breakpoint in the editor using the vertical ruler (not by using the BREAK-POINT statement in ABAP), all the breakpoints will be collected into the Breakpoints view. They will be visible there, no matter if you are logged onto the system or not.

All of the breakpoints set in Eclipse are external breakpoints, but in comparison to SAP GUI, they last until you remove them by demand. Figure 2-22 shows the checkboxes on the left side of the view. You can use them to deactivate the breakpoint until you want it back. Deactivated breakpoints will have a white icon as well. You can also delete certain breakpoints using the Remove Selected Breakpoints button or remove all of them at once using the Remove All button.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig22_HTML.jpg
Figure 2-22

Breakpoints view with default settings and four breakpoint types

You can also create statement and exception breakpoints. To do so, click the Add ABAP Breakpoint button and choose one of the two breakpoint types. If you have a statement breakpoint, you will need to select one of the existing ABAP statements. Whenever this statement is called, the debugger will stop in this place. It works similarly to the exception breakpoints. You choose where the debugger should stop and whenever it will be raised, it will stop.

Conditions are a very nice feature of the Eclipse debugger. You can set them for each standard breakpoint (manually added in the editor). They work like the watchpoints in the SAP GUI debugger, so they stop only on certain conditions. That means you don’t need to click the F7 key repeatedly and check the variables’ values in order to see where your code is failing. In order to set them, you simply select the existing breakpoint in the view. Then, in the Condition input field, you set up the rules for this breakpoint. The rules are logical expressions, which can use variables, literals, and some built-in functions; see Table 2-3.
Table 2-3

Possibilities for Breakpoint Conditions

Type

Usage

Variables

You can use any variable, field symbol, structure or structure component, internal table or static class attributes that are available in the current scope of code.

For example:

variable = 5

<field-symbol> CP 'AB*'

structure-component > 15

structure-string(1) = 'A'

object->attribute IS NOT INITIAL

itab[9]-component CS 'PP'

{C:class_name}-static_attr = 'X'

Literals

There are three literals you can use:

'' for character literals

`` for string literals

• Numeric literals with or without the ‘-‘ sign

Built-in functions

So far only four functions are available for conditions in breakpoints:

LINES( itab ): Returns the number of table lines

STRLEN( string ): Returns the string length

XSTRLEN( xstring ): Returns the xstring length

INEXACT_DF( ): Returns ‘X’ when the result of an operation (for example, COMPUTE or MOVE) is inexact due to rounding

Operators

Possible types of operators are:

• Comparison: =, <, >, <=, >=, <> or EQ, LT, GT, LE, GE, NE

• Logical: NOT, AND, OR and brackets () to combine several conditions

• String analysis: CO, CN, CA, NA, CS, NS, CP, NP

• Binary: IS [NOT] INITIAL, IS [NOT] BOUND, IS [NOT] ASSIGNED

Knowing the possibilities , you could create a condition for your breakpoint similar to the one in Listing 2-2.
( sy-subrc <> 0 AND lines( sales_orders ) > 0 AND sales_orders[1]-auart CS 'ABC' ) OR ( <header>-waers = 'EUR' )
Listing 2-2

Sample Breakpoint Condition

Two last possibilities of the Breakpoints view are to skip all breakpoints and to group them. Skipping All Breakpoints is nice when you want to continue running your code until the end, but you don’t want to remove the breakpoints. You just activate this by using the button on the toolbar. Until you deactivate it, the debugger will not care about the set breakpoints.

Grouping allows you to keep some order in your breakpoints, as in other cases it could be a bit messy. One of the grouping types that I use is Grouping by Projects, which in the case of ABAP means by system. You can see an example of this grouping in Figure 2-23.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig23_HTML.jpg
Figure 2-23

Breakpoints with grouping by project

Variables

This view is available during debugging. You can watch and change variables values from here. When it starts, you will have the following entries: SY-SUBRC, Locals and/or Globals nodes, ME (if the debugger stopped in a class object), and the <Enter Variable> field, which allows you to enter variable names manually.

Locals will show you the local variables in the method, form, and function module. Globals will show the global variables for the program or function group. ME will show you the whole object and all of its attributes.

You can add the variables manually to the view or by double-clicking the variable name in the editor during debugging. When you add them manually, you can use dirty assignments or table lines directly. For example, Figure 2-24 shows the dirty assignment of (ZDEMO_FALV01)SFLIGHT, table line FCAT[1], or directly via the component NO_OUT of the first line of FCAT.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig24_HTML.jpg
Figure 2-24

Variables view on a class object with a few variables

When you have the proper authorizations, during debugging you should be able change the variable value. To do so, just click the Value field next to the variable name. This will highlight the value and you will be able to put in your desired value. Confirm the change by pressing the Enter button.

When you are debugging a class in the default view, the ME node shows only the attributes that can be found directly in this class. No inherited attributes or constants will be shown. You can change that behavior by going to the View menu and choosing ABAP ➤ Show Inherited Attributes or ABAP ➤ Show Constants. You can see an example of the Variables view with this settings turned on in Figure 2-25.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig25_HTML.jpg
Figure 2-25

Variables with (right side) and without (left side) additional settings

ABAP Exception (Debugger)

Exception debugging can be useful to get an idea where an exception was raised. If you’re catching a few exceptions at a time and want to see the type and text without going into exception object details, this is the way to go.

In order to activate the update of the view, you need to add the name of the exception object to the input field and press or click Enter. When you stop the debugger inside the catch statement, the exception object name, text, and raise location will be shown in the view, as shown in Figure 2-26. The most common name for the exception object is E, and this is also used here.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig26_HTML.jpg
Figure 2-26

ABAP Exception view while in a catch statement

When you use the context menu of the object, you can jump into the raise location or you can add the object to the Variables view from here.

ABAP Internal Table (Debugger)

One of the most common things you’ll do while debugging is check the internal table entries after a SELECT statement or after its manipulation some other way. The ABAP Internal Table view comes in handy here.

This view, if not already visible in your perspective, is activated when you double-click the internal table name during debugging. You can, of course, manually change the name of the table to watch the one here. As shown in Figure 2-27, the column headers are always internal field names and descriptions are not used.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig27_HTML.jpg
Figure 2-27

ABAP Internal Table view with SFLIGHT internal table entries

From this view, you can also delete or add rows, you can sort the entries and filter them (but only on certain NetWeaver releases), and you can export the table into TXT, CSV, or XLS files. All these functions are available from the View menu and/or from context menu for the row entry.

There are two buttons that can be very useful. The first one is the Pin button, which will help you see the table entries all the time. The second one is the Automatic Refresh button, which may help if you have a slow connection.

Tip

Eclipse debugger refreshes this view each step, so this can be very expensive, especially if you have a slow connection. That is why, if you don’t need to see the updated values during each step, you can disable the automatic refresh and you will see a huge difference in the performance of the debugger.

Transport Organizer

There is no work in ABAP without transport requests and tasks. They have been with us since the beginning and will probably stay with us until the end. The Transport Organizer view helps you check and manage the transport requests you are involved with.

The view shows a list of all ABAP projects. They will not show an entry until you expand the project folder on it. Once you do this, you will see all the transport requests that you can find with an SE01 transaction. The only difference is that you will not be able to see all the released transports requests on demand there, but the one that was released during last two weeks will be visible in a separate subfolder. You can see all of this in Figure 2-28.

When you start to expand the transport orders, you will notice all the objects that are currently in it or inside the task. But that is not the only way to find the objects inside transport orders. What you can do is use the filter field. You can put the full or partial name of the object that you want to find. If any transport requests are in it, it will be shown on the view.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig28_HTML.jpg
Figure 2-28

Transport Organizer view with two projects

Of course, you can do much more with this view. For example, you can create new transport requests, change the owner and the type of the request, add a task for any user, and release the task and request. Not all of these functions are available in each system, availability depends on the backend as usual.

If your system is newer, when you double-click the transport request, it opens in Eclipse view, as shown in the Figure 2-29, not in SAP GUI.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig29_HTML.jpg
Figure 2-29

Transport Request details in Eclipse

Note that the creation button is active on the view toolbar. Once it’s used, you will be moved to the Transport Request wizard, which you can also see in Figure 2-30.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig30_HTML.jpg
Figure 2-30

New transport request window

ABAP Language Help

Whether you are a newbie or an experienced ABAP developer, you will need to use the ABAP syntax help from time to time, either to learn how to use the syntax or to remind yourself about any additions you can use.

The ABAP Language Help view can be called by pressing the F1 button on any ABAP statement. You can also open it manually from the list of available views and use it on demand. When used with F1, it will directly show the help for the selected statement. When you have it open, you can manually type the statement or any other text into the search field and the view will open the information for you. As an example, Figure 2-31 shows the help for the FIELD-SYMBOL inline declaration.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig31_HTML.jpg
Figure 2-31

ABAP Language Help view with Field-Symbol help for inline declarations

One of the nice functions of this vie is that you can navigate through it like a web page, using the breadcrumbs and hyperlinks in the text.

Console

With ABAP development, you probably will use the Console view only when developing the cloud systems, or when developing the class if you want to test the output in addition to the unit tests. It is also useful during Eclipse plugin development, but this process is described in the next chapters.

To use the console with ABAP, you need to implement the MAIN method of the IF_OO_ADT_CLASSRUN interface, and use the OUT object to put values into the console. IF_OO_ADT_CLASSRUN has been available since NetWeaver 7.51 and can be also used on on-premise systems. Listing 2-3 shows a sample code for a class that outputs data to the Console view. When you copy it to the Eclipse editor and run it using the F9 button, it will display the output shown in Figure 2-32.
CLASS zcl_console_app DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
  PUBLIC SECTION.
    INTERFACES if_oo_adt_classrun .
ENDCLASS.
CLASS zcl_console_app IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    out->write_text( 'This is the first line'  ).
    out->write_text( 'This is the second line'  ).
    out->write_text( 'This is the third line'  ).
  ENDMETHOD.
ENDCLASS.
Listing 2-3

Sample Console Application in ABAP Using IF_OO_ADT_CLASSRUN

../images/504993_1_En_2_Chapter/504993_1_En_2_Fig32_HTML.jpg
Figure 2-32

Console view output

ABAP Element Info

This is one of my favorite views, although you can get the same information directly from the editor using the F2 key on any ABAP object. What makes me like it so much? Well, I like to get rid of unnecessary steps when coding and debugging and I also like to have all the information available directly. This view enables me to have direct information about selected objects.

Of course I use it with the Link with Editor function enabled; that is why whenever I put the cursor on a function module, method, variable, constant, table, structure, data element, or any other ABAP object, I see the details and description of that object.

The details can be the method or function signature, including ABAP doc comments, or simply the components of the structure. If long text documentation is available, you can also navigate to it from this view, as shown in Figure 2-33.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig33_HTML.jpg
Figure 2-33

ABAP Element Info with the SAPGUI_SET_FUNCTIONCODE function module

In the case of structures or dictionary tables, you will see all the components and their type and description, as shown in Figure 2-34. Of course, each ABAP object type will show information that relates to its type. So with classes, for example, you will see methods and attributes.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig34_HTML.jpg
Figure 2-34

ABAP Element Info with SFLIGHT table

In addition to the displayed information, you can navigate through the elements of the view to get more detailed information about that part of the object.

ABAP Type Hierarchy

When you are wondering what the whole hierarchy of a class is, there is no better view than ABAP Type Hierarchy. You can learn from this view the clear information about the classes that are super-classes to yours, or you can see where your class is inherited from.

This view allows you to see the type hierarchy in three ways:
  • Type hierarchy

  • Supertype hierarchy

  • Subtype hierarchy

Type hierarchy shows your object with the super-classes and with subclasses on the same view. It also shows all interfaces that your object uses directly or by inheritance. Figure 2-35 shows how it will be displayed; class ZCL_FALV inherits the CL_GUI_ALV_GRID class, which has its own superclass CL_GUI_ALV_GRID_BASE. Additionally, below the ZCL_FALV class, you can see all of its subclasses, including local classes in reports.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig35_HTML.jpg
Figure 2-35

ABAP Type Hierarchy with type hierarchy for class ZCL_FALV

When you choose to see only the Supertype hierarchy , then as shown in Figure 2-36, you will see your class at the top of the tree. Each lower level represents a superclass of the upper level. You can also see all the inherited interfaces.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig36_HTML.jpg
Figure 2-36

ABAP Type Hierarchy with supertype hierarchy of class ZCL_FALV

The last way to display data in this view is by Subtype hierarchy , which will display only subclasses of the checked class. This behavior is presented in Figure 2-37, where you see all the subclasses of ZCL_FALV.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig37_HTML.jpg
Figure 2-37

ABAP Type Hierarchy with subtype hierarchy of class ZCL_FALV

ABAP Unit

ABAP developers finally started to recognize the added value that Test Driven Development (TDD) and unit tests bring to the development and maintenance processes. The OpenSAP course titled “Writing Testable Code for ABAP1” helped introduce unit tests to many thousands of ABAP developers, so it is important to know how to run unit tests in the Eclipse environment.

There are different ways to run the unit tests:
  • From the Project Explorer, Outline, or Editor: Choose Run As ➤ ABAP Unit Test.

  • From the Eclipse menu bar: Choose Run ➤ Run As ➤ ABAP Unit Test.

  • From the Eclipse toolbar button: Choose Run ➤ Run As ➤ ABAP Unit Test.

  • Use the Ctrl+Shift+F10 shortcut.

Once you select an object or package that contains test classes, you will see the results of the test in this view. You will be able to see how many tests were successful, how many failed, and how many were not executed. You can also see all test methods in this view and you can navigate to the source of the test by double-clicking. To show you the results of the unit tests, I ran the checks for package $ABAP2XLSX, which is my local package for the abap2xlsx2 project. This package contained 30 test methods, but only 18 were executed. As you can see in Figure 2-38, in one of the test classes LCL_TEST of the ZCL_EXCEL_READER_HUGE_FILE class, no risk level information was given, which is why the execution of all 12 test methods were not completed and its state was set to warning.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig38_HTML.jpg
Figure 2-38

ABAP Unit run results for the abap2xlsx project package

When test methods fail, their icon will turn red and the status bar in this view, which in Figure 2-38 was yellow, will turn red. You will have to correct the part of code that’s checked by the test method or update the test method itself. Once you fix it, you can use the context menu of the view to rerun the selected tests.

If you use the context menu to rerun the tests, you will see that there are some additional options: Rerun with Coverage and Rerun with Profiling. Rerun with Coverage runs the tests again and opens a new view called ABAP Coverage, which displays information about the percentage of the code that is covered with unit tests. You can read more about the ABAP Coverage view in the next section of this chapter.

Rerun with Profiling is useful when your tests are taking a long time and you want to determine what could be corrected to get better performance. When you use this option, after completing the tests run, Eclipse will open a new view called ABAP Trace Requests, on which you will find the request for your test methods. ABAP Trace Requests and linked ABAP Trace views are described in more detail in the next sections.

ABAP Coverage

Full or partial coverage of the unit tests can be one of your goals during development in ABAP. The ABAP Coverage view gives you an opportunity to check the current status of the coverage as well as to identify which statements are not covered with the tests.

To run a coverage check, you have several options:
  • From the Project Explorer, Outline, or Editor: Choose Coverage As ➤ ABAP Unit Test.

  • Use the Ctrl+Shift+F11 shortcut.

  • Use the toolbar or context menu in the ABAP Unit view and choose the Rerun with Coverage function.

As a result, the standard run of the ABAP unit tests will be done. Additionally, you will notice detailed information in the ABAP Coverage view about each part of the development, for both global and local parts. Figure 2-39 shows the result of the Coverage run. Here you can see the methods of the ZCL_EXCEL_COMMON class, coverage with the progress bar, and detailed information about what was covered and what was missed by the checks statements. Using the More button, you can switch to show the branch and procedure coverage.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig39_HTML.jpg
Figure 2-39

ABAP Coverage for the ZCL_EXCEL_COMMON class of abap2xlsx

But that is not all that the ABAP Coverage view can give you. Directly after the coverage run, your code in the editor will be highlighted depending on the selected coverage type (statement, branch, procedure). The covered code will be highlighted in green, and code that’s not covered is in red. Figure 2-40 shows this highlighting, where only the CATCH statement is so far left without test coverage. When you do not want to see the highlighting, you can switch it off by closing the ABAP Coverage view or by clicking the Hide Highlighting button on the view toolbar.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig40_HTML.jpg
Figure 2-40

ABAP Editor with coverage highlighting turned on

ATC Problems

Among other things, the ABAP Test Cockpit (ATC) helps developers follow company rules and find performance issues inside the code. Depending on the system configuration, you may be forced to use it, but even if the ATC findings are not blocking you from releasing your transports, it is still good to run it in order to correct your code according to best practices.

ATC can be run in similar ways to the ABAP unit test:
  • From the Project Explorer, Outline, or Editor: Choose Run As ➤ ABAP Test Cockpit or Run As ➤ ABAP Test Cockpit With….

  • From the Eclipse menu bar: Choose Run ➤ Run As ➤ ABAP Test Cockpit or Run ➤ Run As ➤ ABAP Test Cockpit With….

  • From the Eclipse toolbar button: Choose Run ➤ Run As ➤ ABAP Test Cockpit or Run ➤ Run As ➤ ABAP Test Cockpit With….

  • Use the Ctrl+Shift+F2 shortcut.

After you run ATC, the ATC Problems view will be shown automatically. After the ATC run is finished (it can take some time), you will be notified about all findings. There are three types of findings: error, warning, and information. They correspond to the priority 1, 2, and 3.

Besides the finding type, you will also see the finding message, the check group, the place where the finding was recognized, and information about the exemption status. After selecting the message, you will also see the detailed text of the message, where you can often find the pragmas or pseudo-comments that you can use to hide the finding, or the information about how you can change your code to fulfill the rule.

Figure 2-41 shows the default ATC Problems grouping, which is by priority. Using the View menu, you can change the grouping to object or check.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig41_HTML.jpg
Figure 2-41

ATC Problems view with error and warning findings

If you double-click the finding, you can navigate to the place of the finding, which helps you more easily correct the code. Once you’re done, you can use the context menu and the Recheck function to rerun the ATC and see the updated results.

If you are working on a S/4HANA custom code adaptation project, you may find a very helpful functionality in the context menu, called Recommended Quick Fix. This function calls the wizard to help you adjust the findings to the state in which they will no longer stop you from using your code on S/4HANA system.

Another very important option on the context menu is to ask for an exemption. To do so, you just select the Request Exemption function. The exemption wizard will open, as shown on the left side of Figure 2-42. You will then be able to select the scope of the exemption.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig42_HTML.jpg
Figure 2-42

Request Exemption wizard screens (scope and approver selection)

The next step is to select the approver and give justification for the exemption. You can indicate if you want to be notified after the exemption status changes.

ATC Result Browser

When you want to come back to an earlier ATC check, you can use the ATC Result Browser view. It will show you the ATC checks for your user (Local Check Runs), as well as the results of Central Check Runs if you have access to the central ATC system. Information is presented in the form of a tree, as shown in Figure 2-43.

This view is useful when you want to come back to earlier results of an ATC because you were interrupted when solving the findings and additional ATC runs might take a long time in your environment.

Being able to view central ATC runs is also helpful when you are responsible for the code quality at your company or during an S/4HANA conversion project, as this can give you overall information about code quality.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig43_HTML.jpg
Figure 2-43

ATC Result Browser for local and central runs

When you double-click the run (local or central), details about all the findings for the run are displayed in this view.

Data Preview

As a developer, you will occasionally need to look at database entries. When you are using SAP GUI, you run transaction SE16 or SE16N for that. But in Eclipse, there is no point in launching these transactions, as we have Data Preview view.

To run Data Preview view, you must have the database table, database view, or CDS view opened in your editor and then press the F8 button. The other option is to use the Project Explorers context menu. You do this by selecting any of these objects and choosing Open With ➤ Data Preview. By using one of these two ways to open Data Preview, you will see a new tab with 100 entries from the selected object.

Once it is displayed you can change the number of displayed rows up to 99,999 and adapt filters to display only data that you want to see. You can also select which columns should be displayed, check the total number of entries, open the preview of the data in another system, or export entries into local files. You can do all of this by choosing the proper button on the view toolbar, which you can see in Figure 2-44.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig44_HTML.jpg
Figure 2-44

Data Preview of the SFLIGHT table

You can also use the context menu to set a quick filter on the selected cell or see the decomposition of the values in a selected column. For example, Figure 2-45 displays distinct values of the CARRID column.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig45_HTML.jpg
Figure 2-45

Distinct values on the CARRID field of the SFLIGHT table with 100 entries

There is one more very powerful function, which allows you to copy all displayed rows as a ABAP VALUE statement . You can do that from the context menu or you can save them in a text file using the Export button. When you are not using unit tests, you may find this function less than useful. It’s a perfect way to prepare mockup data for your test classes. As an example, Figure 2-46 shows the inline declaration of the mockup table with the SFLIGHT table entries that was created using this function.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig46_HTML.jpg
Figure 2-46

Table data inline declaration for entries copied from Data Preview

One last option of Data Preview, which we should not forget, is calling the SQL Console view.

SQL Console

I just mentioned that you can call the SQL Console from the Data Preview, but there is also another way to call it. You right-click the project name in Project Explorer view and select the SQL Console function.

This view contains the data display part, which looks exactly like the one in the Data Preview and the SQL editor part where you can test your SELECT statements. This is one of my favorite views, as I can test my SQL statements before putting them into the code. The SQL editor can only use literals and SY structure component variables in the WHERE clause, but it is enough to check your joins and the output with sample WHERE conditions. As an example, Listing 2-4 shows how to use literals and the current date inside a WHERE clause of a SELECT statement.
  SELECT * FROM sflight
    WHERE fldate LT @sy-datum
    AND   carrid = 'AA'.
Listing 2-4

Sample SQL Statement That Will Work with the SQL Console

When you use the code in Listing 2-4 in the SQL Console and click the Run button, you should see similar entries on the right side of the view, as shown in Figure 2-47. On Data Preview, you can use the context menu on the displayed data in order to copy the entries as ABAP value statements. So can you use this view to prepare mockup data for your unit tests.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig47_HTML.jpg
Figure 2-47

SQL Console view with a sample SQL statement

You can also see the historical SQL calls here, which will be cleared after you close the view. They will remain in the history of the calls, which you can check and reuse from the Down Arrow button next to Run. You can also save your current SQL statement as a favorite for future use.

Feed Reader

When you start using Eclipse and you are logged onto several systems, you will notice that from time to time, a small popup in the bottom-right corner of the Eclipse window will inform you about your recent short dumps or short dumps of objects that you have created. This information comes from the Feed Reader and can be customized according to your preferences.

When you open Feed Reader, you will see all the systems that you are currently logged onto. When you expand one of them, you will see that you have three groups of feeds:
  • Runtime errors caused by me

  • Runtime errors for objects I am responsible for

  • System messages

Your view will look similar to the one shown in Figure 2-48. As you can see, there are three short dumps caused by me on the NPL system. When you select one of the unread notifications, the details will appear on the right side of the view.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig48_HTML.jpg
Figure 2-48

Default Feed Reader view

You can resize the preview of the message view to see more details. If you do, with short dumps, you will see the same information that you can get with transaction ST22, but in HTML view, you can navigate through hyperlinks. A sample short dump is shown in Figure 2-49; it presents the top of the message that contains the links to all areas of the short dump and two additional links:
  • Show in SAP GUI

  • Show where terminated

When you click the Show in SAP GUI link, the embedded GUI screen will appear in the place of the editor and the short dump will be opened, just like you would navigate through ST22.

When you click the Show Where Terminated link, the object in which the dump occurred will be opened on the line of termination in the Eclipse ABAP editor.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig49_HTML.jpg
Figure 2-49

Short dump view in Feed Reader

I do not know how about you, but I usually know when I created a dump, so I do not need the notification from Eclipse. Fortunately, there is a way to switch off these notifications, or even completely delete the feed so they are not refreshed by Eclipse’s background jobs. To do so, simply select the feed that you want to change and right-click it to bring up the context menu. You will then have the options to delete it or to edit the feed.

When you use the Edit the Feed function on the runtime errors feeds, you can not only disable the notifications display and change the refresh interval, but you can also set these filters: user, package, package hierarchy, package owner, object owner, person responsible, object name, component, runtime error, or exception. Those filters, which you can see in Figure 2-50, are set to your username. You can create a filter combination using OR and AND logic, so you should be able to adjust this to your needs.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig50_HTML.jpg
Figure 2-50

Edit of the Runtime Errors feed

Nevertheless, I’m deleting those two standard feeds for runtime errors and keeping the System Messages feed, where system admins inform me about restart of the system or the next system copy.

I also activated the SAP Gateway Log and native RSS feeds to follow the SAP Community.

Activating the SAP Gateway Log is very helpful when you develop or deploy a Fiori application or oData services. Select the Down Arrow button from the view toolbar and choose Add Feed from Repository. When you do this, you will have to select the project (system) from which you want to receive the error log and select from the available feeds’ SAP Gateway Error Log. This is shown in Figure 2-51.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig51_HTML.jpg
Figure 2-51

New Feed query from the ABAP Repository

The next step is to configure how frequent you want to get the information about the gateway errors. I set this to one minute during the testing phase and disable it after it is on a productive system for a while.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig52_HTML.jpg
Figure 2-52

Configuring the SAP Gateway Error Log

After you set up all the preferences and click the Finish button, you will notice the SAP Gateway Error Log feed in the folder of the applicable system.

But using Feed Reader for only backend feeds would be a sin. You can also use it to read the standard RSS feeds and I do follow the SAP Community using it. If you want to do the same, you need to find the proper RSS feed link of the SAP Community website and use the Down Arrow button on the Feed Reader toolbar. But this time, choose Add Atom/RSS Feed from URL. A popup will appear where you will have to enter the proper URL, as shown in Figure 2-53. In my example, I used RSS for the ABAP Development tag of the SAP Community.3
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig53_HTML.jpg
Figure 2-53

New Feed Query for the RSS of the SAP Community

When you set up the refresh interval and you confirm the creation of the feed, you will see it in the Native Feeds node of the Feed Reader, together with the last 20 feeds from that tag, as shown in Figure 2-54. This is one of the ways I stay in touch with all the new blog posts that are posted on the SAP Community.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig54_HTML.jpg
Figure 2-54

The latest blog post about ABAP developments on SAP Community

When you double-click a native feed entry, you will be moved to the SAP Community website and this particular blog post.

Quick Assist

In most cases, I do not use the Quick Assist view. I use Quick Assist on the ABAP editor directly, but if you have to work on legacy code, you may want to have it active all the time.

This view shows the quick fixes that are available for your code when you place the cursor on a line, as shown in Figure 2-55. You would get the same list of proposals by using the Ctrl+1 shortcut on the code, but then you have to call it on demand.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig55_HTML.jpg
Figure 2-55

Quick Assist view

Once you select the proposal that you want to accept, it will be applied to your code. In some cases, a popup will appear before the change in order to confirm all changes that will be applied in the current object and all that are affected. This is very visible, especially when refactoring the public class attributes or methods that are used in several places in your SAP environment.

The proposals that come from the ABAP backend can differ between the SAP NetWeaver versions, but all of the systems should contain several basic functions like renaming, changing visibility, pulling up or down, extraction of methods, and extraction of literals and constants. Quick Assist is covered in more detail in later chapters.

Relation Explorer

When your system is at least on NetWeaver version 7.54 or you are using SAP CP ABAP Environment 1908 or higher, you can use the Relation Explorer to get an overview of relations between the objects. The relations are displayed as a tree and grouped by the type of the related objects, which you can see in Figure 2-56.

You can open the object in Relation Explorer in a few different ways:
  • By using the Alt+Shift+W shortcut in the editor

  • By using the editor context menu Show In ➤ Relation Explorer

  • By selecting the object using the Other Object view toolbar button

  • By linking the Relation Explorer with the active editor

  • By using the History List button on the view toolbar, to use previously used objects

../images/504993_1_En_2_Chapter/504993_1_En_2_Fig56_HTML.jpg
Figure 2-56

Relation Explorer with used object context for the CL_ABAPGIT_APP_LOG class

The following contexts are available on this view:
  • Business objects (for Data Definition Language Sources, Behavior Definitions, Behavior Implementation Classes, and CDS Views)

  • Core data services (for CDS Views and Access Controls)

  • Used objects (for most of the objects)

  • Using objects (for most of the objects)

  • Extended objects (for enhancement implementations)

  • Extending objects (for objects that support the Enhancement Framework)

Each context displays different relation types; they can be selected from the toolbar menu using the Other Context button. You will not have to remember which of the contexts you can use for which object, because the list of the contexts are limited only to the ones that you can use.

ABAP Communication Log

You will not likely run into this view until you want to create your own plugin for Eclipse that communicates with the ABAP backend. This view displays information about communication between Eclipse and your SAP instance.

The log is not collected automatically, but you can manually launch it with the Start Logging button on the view toolbar. Once you activate it and start using the ABAP editor or other views that are fetching data from the backend, you will notice a HTTP session appearing, as shown in Figure 2-57. In addition to the request message, you can see information such as the status of the call, elapsed time, server time, and request and response size.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig57_HTML.jpg
Figure 2-57

ABAP communication log with activated logging

When you double-click the HTTP session line, you will access the details of the call, which include the request, response, stack trace on Eclipse side, and destination properties. Details of a sample call are shown in Figure 2-58. This should be your first place to check if something is wrong with the communication between your plugin and the backend.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig58_HTML.jpg
Figure 2-58

Details of an HTTP call to the SAP backend

If this fails, use the View menu or toolbar button to activate ABAP tracing for the HTTP calls. While activated, it will generate trace requests and collect the trace information in the system. You can use ABAP Traces view to read the trace information.

Even if everything is going correctly with your calls, you can test the behavior of Eclipse when only a slow connection to the system is available. To do so, use the Snail button on the view toolbar and select one of the preconfigured delays, or set up your own custom delays for the calls. This might help you determine if you want to do your HTTP call synchronously or asynchronously.

ABAP Trace Requests

Every ABAP developer has to check the performance of the code, but sometimes you are not able to repeat the steps the user took on the production system. In this case, you need to activate tracing in order to get detailed information about the runtime of the code.

The ABAP Trace Requests view was prepared to create and manage tracings, especially when you cannot run profiling directly on an object. To create a new request, simply click the Create Trace Request button and the wizard for trace scheduling will open, as shown in Figure 2-59.

You first need to select the scope of the tracing between the following:
  • Web requests (HTTP)

  • Reports and transactions (dialog)

  • Remote function calls (RFCs)

  • Background jobs (batch)

  • Shared objects area

  • Any (trace object with all possible scopes)

When you choose the proper scope, you will need to select the object type from the following:
  • Report

  • Transaction

  • Function module

  • Area constructor

  • Any (which you will be able to use, for example, for class tracing)

../images/504993_1_En_2_Chapter/504993_1_En_2_Fig59_HTML.jpg
Figure 2-59

Scheduling a new trace request: scope selection

After object type selection, you will have to choose which object you want to trace, for which user and client, and on which server. If you want to run tracing for any user, just leave the user field empty. Additionally, you need to choose for how long the tracing will be active and after how many catches of the trace will the system stop collecting them. It is also important to set a proper name for the tracing, especially if you run lots of traces at the same time.

There are six trace parameter groups that you can use to customize your trace request. They are presented in Figure 2-60. They allow you to set the aggregation type, ABAP statements scope, time of the trace start, its maximum size and execution time, or AMDP tracing with HANA-based systems. Most of these settings should be familiar from the SAT transaction, which is used for profiling in SAP GUI.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig60_HTML.jpg
Figure 2-60

Scheduling a new trace request: parameters

You can also set up default profiling parameters by using the Configure Defaults hyperlink on that screen, which is quite helpful if you are focused only on parts of the ABAP statements.

The trace request will appear on the requests list with all basic configuration information and with the number of trace executions; see Figure 2-61. The executions are not refreshed automatically when the view is open, so you need to click the Refresh button to see whether new executions took place.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig61_HTML.jpg
Figure 2-61

ABAP Trace Request view

In order to see the trace details, you need to open ABAP Traces view or double-click the trace request. Then the ABAP Traces view will be opened automatically, highlighting the linked traces on the view.

ABAP Traces

Traces can be created in several ways in ADT. I already mentioned that they can be created from the ABAP Communication Log and from the ABAP Trace Requests view, yet there are some additional options:
  • From the Project Explorer, Outline, or Editor using the context menu: Choose Profile As ➤ ABAP Application or Profile As ➤ ABAP Unit Test.

  • From the Eclipse menu bar: Choose Run ➤ Profile As ➤ ABAP Application or Run ➤ Profile As ➤ ABAP Unit Test.

  • From the Eclipse toolbar button: Choose Profile As ➤ ABAP Application or Profile As ➤ ABAP Unit Test.

  • Use the Ctrl+F9 shortcut, which will call profiling as an ABAP application.

After a successful run, the trace will be listed on the ABAP Traces view with basic information about it, including the date and time of execution, checked object, aggregation or runtime, and size information. The columns visible in Figure 2-62 are exactly the same as in a SAT transaction. Traces created in ADT are also visible in a SAT transaction and vice versa.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig62_HTML.jpg
Figure 2-62

ABAP traces lists

You are not limited to your own traces; you can change the user filter by using the context menu on the project name and choosing the Change User Filter option.

When you double-click the trace, a new window will open with the details of the trace. This window contains two or more tabs, depending on the aggregation level of your trace. The Overview tab, which is shown in Figure 2-63, will give you general information about trace, like the time spent on ABAP, and the database and system calls.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig63_HTML.jpg
Figure 2-63

ABAP Trace details

The rest of the tabs show detailed information, just like the SAT tool does. For example, Figure 2-64 displays a condensed hit list of the ZDEMO_FALV01 program, with accumulated information about the number and runtime of the called units (methods, forms, function modules, screens, etc.).
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig64_HTML.jpg
Figure 2-64

Condensed hit list of an ABAP trace

Tasks

You have seen the Bookmarks view before, which can help you follow an unfinished task or mark some special coding. If you use bookmarks, you have to remove them manually when you finish the implementation.

The Task view is very similar to the Bookmarks view, but it allows you to indicate that the work is done. Additionally, you can store the tasks that are not related to ABAP development here. You can also set up a priority for a task, which can help you sort tasks accordingly.

You create a task linked to a development object from the editor’s vertical ruler. You right-click in the line for which the task should be created. A new window will appear; it allows you to set up a task description and priority. Looking at Figure 2-65, you can see that the link to the development object is filled and grayed out to avoid manual modifications. After clicking the Add Button, your task will appear on the list with details.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig65_HTML.jpg
Figure 2-65

New task linked to an ABAP Development Object

From the view, you can create tasks that are not linked to development objects. To do so, use the context menu and choose the Add Task... option. The same window as in Figure 2-65 will appear, but this time with the element, path, and location fields empty. On the list of tasks, you will see that the resource and path entries are empty and the location is set to Unknown, just like the second task in Figure 2-66.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig66_HTML.jpg
Figure 2-66

Task view with tree tasks of different priorities

As I mentioned, you can sort the task by priority, as well as by any other column available on the list. You can also filter the entries to show tasks that include specific text, or create a separate view with a customized filter. You should not be surprised that after double-clicking a task that’s linked to a development object, you will be moved into the linked line of the object.

Error Log

When your IDE is not acting as you expect, it may be time to look at the Error Log view, where the whole log for the IDE is displayed. The log information is collected regardless if the view is opened or not, but the view gives you the possibility to clean it, export or import the log, and view the details of the log.

Not all of the messages on this log are errors. You will also find warnings and information, which you can see in Figure 2-67. You will also see the plugin that raised the message and the date of the error.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig67_HTML.jpg
Figure 2-67

Error log view

If you want to see the details of the message, just double-click the message text. The details will be shown, including the stack trace and some session data. An example of the details you can find are shown in Figure 2-68.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig68_HTML.jpg
Figure 2-68

Error details

You may wonder why you would need to check these details, but the answer is very easy—ADT and Eclipse are frequently updated and some of the functionality can contain bugs after an upgrade. This details view sent to the Eclipse community or SAP support can raise awareness of the issue and can speed up resolution time. It can also be helpful, when you create your own Eclipse plugin, to see where your code is failing.

Progress

Normally, you should not be concerned about the background calls that are happening in Eclipse, but if there are some issues with your IDE or one of its plugins, this view can help you figure out where the error is coming from.

Progress view shows information about the current background jobs in Eclipse. This could be checking update sites as well as calling the where-used list or the search function. The name of the process and its progress will be shown, as shown in Figure 2-69. If the process will take too long or there are too many processes waiting in the queue, it can slow down your work with Eclipse. That is why you can kill the process by using the Stop button, which can be found at the end of the progress bar. I hope you will never have to use this view.
../images/504993_1_En_2_Chapter/504993_1_En_2_Fig69_HTML.jpg
Figure 2-69

Checking for possible updates to Eclipse

Summary

Many views were described in this chapter. It can be difficult to remember what all of them do, but you should have an idea about what information you can get in ADT without using the SAP GUI. You can come back to this chapter whenever you see one of the views on your screen and need more information.

The next chapter focuses on the ABAP Editor and the possibilities that it gives every developer to work faster and more efficient with ABAP code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.193.172