
ABAP Tools - Work with Eclipse (Informations)
If you're new to ABAP development tools, obtaining the necessary information about an object isn't always easy. In this article, we'll show you a few sources for this.
Table of contents
In this article, we'll discuss various views and shortcuts so you have the best possible information at your fingertips during development.
Introduction
A large portion of development time is often spent retrieving information. We navigate through objects to obtain a type, length, documentation, or other information. The ABAP Development Tools in Eclipse offer various options and views for accessing this information more quickly. Therefore, let's take a look at a few views and their capabilities.
Element Info
The first shortcut we recommend is using F2 on any object you want to get information about. This displays the Element Info and gives you information about the currently selected object. For example, if we look at a Core Data Service in the source code, we get information such as client handling, how we can extend the object, and of course, the various columns in the view. We can then navigate further using the contained objects, such as data elements, without opening the object. If you then want to open an object in the editor, you can use the highlighted button and the object will open.
In the next example, we retrieve information about various variables that we use in the GET_COUNTRY_FROM_INPUT method. Since we are using Clean ABAP, its use may not always be clear at first. If we open a variable via the Element Info, we receive information about the type and an icon with the variable type. Since you probably won't be familiar with all the icons at first, you'll find a descriptive description when you hover over them.
Many developers also pin the view to an easily accessible area and display it constantly. If you enable marked synchronization, all you have to do in the editor is place the cursor over an object, variable, or something else with context, and the information will be displayed immediately. This saves you from pressing the F2 key, but it does cost some performance, as the information is always requested.
Where-used list
In the next step, we want to obtain information about the use of an object. Where-used list has always been a central component of ABAP development, allowing you to find further examples in the system or to check who else is using your objects. To do this, select the object and use the keyboard shortcut CTRL + SHIFT + G or right-click to access the context menu.
Depending on your backend system, you may be given a preselection of the objects you want to search in to further narrow down the search results. You won't find this feature in older releases.
The result is then displayed in the search view. There you have the option to view the implementation by expanding the object. The result is always available in the view, so you can browse the objects at your leisure. Additional options are available in the view, such as navigation, additional filters, and display by packages. This allows you to further narrow down the number of objects to find the right ones.
Relation Explorer
Would you like an overview of the objects and relationships used? Then you can use the Relation Explorer. This gives you a quick overview of the different objects your current object uses. Let's take a look at our class, for example:
This way we can see, for example, which standard data elements we use if we want to migrate the class to another system or ensure that we work decoupled from the standard.
Outlines
You can generally find the outlines under a class in the Project Explorer, but you have to open them first. For example, if the object is not synchronized because you have a standard class open, several steps would be necessary to obtain the information.
It is easier to use the outline view, as this loads the information about the current object. You also have various options for configuring the view, such as sorting the methods and types by name or hiding private methods/attributes if you're only working with the public part.
Type Hierarchy
For example, if we want to look at the corresponding implementations for the IF_XCO_CP_TM_DATE_FORMAT interface, we can do so using the Type Hierarchy. To do this, use the keyboard shortcut F4 (ABAP Type Hierarchy) or CTRL + T (Quick Type Hierarchy). You can also find the option quite high up in the context menu. Here is an example of the Quick Type Hierarchy.
The difference between the two views is that after navigating with the Quick Type Hierarchy, we don't have any persistence of the information in a view. If we only want to navigate to a specific object, then this view is sufficient. If we want to search through different classes, you should use the ABAP Type Hierarchy.
Example
Here you can find the example we used for our test. If you use the class in your system, you will be able to understand our examples better. We also use our own implementation of the system fields, if you would like the class or further information.
CLASS zcl_bs_demo_tool_info DEFINITION
PUBLIC FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PRIVATE SECTION.
METHODS get_country_from_input
IMPORTING country_id TYPE land1
RETURNING VALUE(result) TYPE i_country.
METHODS validate_country
IMPORTING country_id TYPE land1
RETURNING VALUE(result) TYPE abap_boolean.
ENDCLASS.
CLASS zcl_bs_demo_tool_info IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA(country) = get_country_from_input( 'US' ).
IF validate_country( country-Country ) = abap_false.
out->write( `Country is not home` ).
ENDIF.
out->write( country-BankPostalCheckRule ).
DATA(date) = xco_cp=>sy->date( )->as( xco_cp_time=>format->abap )->value.
out->write( date ).
ENDMETHOD.
METHOD get_country_from_input.
SELECT SINGLE FROM I_Country
FIELDS *
WHERE Country = @country_id
INTO @result.
IF zcl_syst=>create( )->return_code( ) <> 0.
CLEAR result.
ENDIF.
ENDMETHOD.
METHOD validate_country.
RETURN xsdbool( country_id = 'DE' ).
ENDMETHOD.
ENDCLASS.
Conclusion
There are many different ways to quickly access information during development. If you use them effectively during development, you can save a lot of time and avoid having to navigate between different objects frequently.