Taking a First Look at ABAP

Objective

After completing this lesson, you will be able to work with a development object

Investigation of ABAP Code

Working in the Project Explorer

To work with ABAP development objects, you usually display the contents of a package in the project explorer. Packages are containers for development objects that logically belong together.

To add a package to your favorites, right-click the Favorite Packages node in the project explorer and choose Add Package. A dialog box appears, in which you can enter a filter term. The system then displays only the packages that contain this term. Double-click the package that you want to add to your favorites.

Opening Development Objects

There are two ways to open a development object in ADT.

The first is to locate the object name in the project explorer and double-click it. The other is to use the keyboard shortcut, Ctrl + Shift + A. This opens a dialog box in which you can enter part of the name of an object.

Investigating a Development Object

When you are working with ABAP code, there are certain function keys in ADT that will help you.

Let's look at these function keys.

F1
The F1 key displays the ABAP language help for the current statement. A statement is the name for a command in ABAP.
F2
The F2 key displays information about the element on which the cursor is placed.
F3
The F3 key navigates to the definition of the object on which the cursor is placed. You can return from there to the original object using the key combination, ALT + LEFT ARROW, on your keyboard.

Create an ABAP Cloud Project and Investigate ABAP Coding

In this exercise, you start your ABAP cloud project and analyze some existing ABAP code to get familiar with some basic features of the ABAP development environment.

Prerequisites

If you want to do the exercises as described in this learning journey, you have to book the dedicated hands-on practice system. Follow this link for details: https://learning.sap.com/practice-systems/basic-abap-programming.

In addition to the service key, which you will receive during the booking process, you need a local installation of the Eclipse IDE with the ABAP Development Tools plug-in installed on top. Follow this link for a step-by-step instruction https://developers.sap.com/tutorials/abap-install-adt.html.

Task 1: Create an ABAP Cloud Project

Open Eclipse, switch to the ABAP perspective and create an ABAP cloud project.

Steps

  1. Open Eclipse and switch to the ABAP perspective.

    1. Open Eclipse and close all tabs.

    2. Choose WindowPerspectiveOpen PerspectiveOther.

    3. In the dialog box, double-click ABAP.

  2. Create an ABAP Cloud Project.

    1. Choose FileNewABAP Cloud Project.

    2. Select Use a Service Key and choose Next.

    3. Choose Import and select the file containing the service key that you have been given.

    4. Choose Open Logon Page in Browser.

    5. You will be prompted to logon to the system.

      Enter the user and password that you used to register to SAP Learning Hub.

    6. When you see the message, You have been successfully logged on, close the browser window and return to Eclipse.

    7. To finish creating the project, choose Finish.

Task 2: Analyze ABAP Class /DMO/CL_FLIGHT_LEGACY

Use some functions of the ABAP Development Tools to analyze the source code of ABAP class /DMO/CL_FLIGHT_LEGACY.

Note

You are not required to read the code in this exercise. Instead, concentrate on the navigation and display functions in the development environment.

Steps

  1. Open the ABAP class /DMO/CL_FLIGHT_LEGACY in the editor view.

    1. In the Eclipse menu, choose NavigateOpen ABAP Development Object ... or press Ctrl + Shift + A

    2. In the input field, enter /DMO/CL_FLIGHT as search string.

    3. In the list of matching items, click on /DMO/CL_FLIGHT_LEGACY (Global Class) and choose OK.

  2. Open the Properties tab to display the administrative data of development object /DMO/CL_FLIGHT_LEGACY.

    1. Place the cursor anywhere in the source code of class /DMO/CL_FLIGHT_LEGACY.

    2. In the tab strip below the editor view, navigate to tab Properties.

    3. Analyze the administrative data that are displayed there, for example the original language, the time stamp of the last change or the user that at first created the object.

  3. Locate the ABAP class /DMO/CL_FLIGHT_LEGACY in the Project Explorer view on the left of the display.

    1. Place the cursor anywhere in the source code of the class /DMO/CL_FLIGHT_LEGACY.

    2. On the tool bar of the project explorer, choose Link with Editor. This should expand a part of the tree under your ABAP project with the ABAP class /DMO/CL_FLIGHT_LEGACY as its end point.

  4. Find the string get_instance( )->get in the source code of ABAP class /DMO/CL_FLIGHT_LEGACY.

    Note

    There has to be exactly one blank between the brackets.
    1. Place the cursor in the first row of the source code of class /DMO/CL_FLIGHT_LEGACY.

    2. Press Ctrl + F to open the Find/Replace dialog.

    3. In the input field labeled with Find: enter get_instance( )->get and choose Find.

  5. Navigate to the definition of code element get(.

    1. In the current code line, place the cursor on get( and choose NavigateNavigate to. Alternatively, press F3.

  6. A few code lines down there is a line starting with SELECT. Without navigating away, display some information about code element /dmo/travel after keyword FROM.

    1. In the code line starting with SELECT, place the cursor on /dmo/booking and choose Source CodeShow Code Element Information. Alternatively, press F2.

  7. Display the ABAP Language help for the keyword SELECT.

    1. At the beginning of the current code line, place the cursor on SELECT and choose Source CodeShow ABAP Language Help. Alternatively, press F1.

      Note

      There is no need to read or understand the documentation at this point. If you are familiar with the Structured Query Language (SQL) you can have a look at the first paragraph in section Effect.

Log in to track your progress & complete quizzes