Analyzing ABAP Coding

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Work With An Object In ADT

Analyzing ABAP Coding

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.

Here are the steps to add a package to your favorites.

Opening Objects

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

Analyzing an Object

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

Create an ABAP Cloud Project and Analyze ABAP Coding

You must already have an SAP BTP account with an ABAP service and service key. You must also have installed Eclipse and the SAP ABAP Development Tools.

Task 1: Create an ABAP Cloud Project

In your local installation of SAP ABAP Development Tools (ADT) in Eclipse, create an ABAP Cloud Project and link it to the ABAP Instance in your SAP BTP subaccount.

Steps

  1. Log on to your subaccount in SAP BTP and copy the ABAP service key into your clipboard.

    1. Start the SAP BTP Cockpit and choose the subaccount containing your ABAP service.

    2. Choose Instances and Subscriptions.

    3. In the Instances box, select the Key(s) entry under Credentials.

    4. Choose Copy JSON, and then select Close.

  2. 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.

    4. Choose FileNewABAP Cloud Project.

    5. Select Use a Service Key and choose Next

    6. Paste the service key into the editor with the key combination, Ctrl + V, and choose Next.

    7. Choose Open Logon Page in Browser. When you see the message, You have been successfully logged on, close the browser window and return to Eclipse.

    8. To finish creating the project, choose Finish.

Task 2: Analyze ABAP Class /DMO/CL_FLIGHT_LEGACY

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

Note
You are not supposed to actually read the code you are going to see in this exercise. Concentrate on the navigation and display functions in the development environment.

Steps

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

    Note
    If you cannot find class /DMO/CL_FLIGHT_LEGACY or any other development object starting with /DMO/, you have to import the ABAP Flight Reference Scenario for the ABAP RESTful Application Programming Model into your system. To do so, please follow the instructions under the following link:https://github.com/SAP-samples/abap-platform-refscen-flight
    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/CLFLIGHT_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 ABAP class /DMO/CL_FLIGHT_LEGACY in the Project Explorer view on the left.

    1. Place the cursor anywhere in the source code of 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 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 anywhere in the source code of class /DMO/CL_FLIGHT_LEGACY.

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

    3. In the input field labelled 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/bookingafter 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 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 Structured Query Language (SQL) you can have a look at the first paragraph in section Effect.

Save progress to your learning plan by logging in or creating an account