Developing your First ABAP


After completing this lesson, you will be able to Explain ABAP Language at a basic level.

Eclipse Preferences

Eclipse Preferences allow you to make general settings about how you want Eclipse to operate. You can access Preferences by choosing WindowPreferences.

The figure, Eclipse Preferences, shows you the Source Code Editors section of the Eclipse Preferences window.

If ABAP Development Tools are installed, a specific section for settings related to ABAP Development exists. Settings that can be controlled here include the following:

  • Whether the system ID is displayed in the Editor tab page, and, if so, where
  • Settings relating to Debugging, for example, whether system programs are debugged
  • Settings specific to source code, for example, whether brackets are automatically closed, and whether the automatic syntax check is performed
  • Settings related to editors, for example, font size and color options

In case you want to discard the settings that you have made, there is a Restore Defaults button.

Project Properties

You can adjust the properties of a specific ABAP project, just as you can adjust preferences for Eclipse in general. To do this, choose Properties from the project’s context menu. One useful collection of settings is found under ABAP DevelopmentEditorsSource Code EditorsFormatter (as shown in the figure, ABAP Format Settings).

The options displayed here roughly correspond to the settings that can be made using the Pretty Printer in the ABAP Workbench. You can control the code style of the formatter, including whether source code is indented (for example, when programming an IF or CASE construct), and whether keywords and identifiers are in uppercase or lowercase.

When you have made and applied these settings in the project properties, the formatting can be applied by choosing SHIFT + F1 (on your keyboard) to format the code in the source code editor.

Creating a Hello World App

The main user interface technology you will use in modern ABAP programming is SAP Fiori. However, ADT provides a console that allows you to create output quickly and simply in test applications.

For more information on SAP Fiori, view the Learning Journey Learning the Basics of SAP Fiori at
  1. Write your ABAP code in a class, and choose FileNewABAP Class.
  2. A dialog box appears where you verify the project is correct.
  3. Enter the name of the package that you have already created.
  4. Enter a name for your Class, remembering to start with Z or Y. It can be up to 30 characters and letters A–Z, the digits 0–9, and the underscore symbol.
  5. Choose the Add option to add an interface to a class (in our example, it is IF_OO_ADT_CLASSRUN) so that the user can use it in a particular way.
  6. Use the Filter field to restrict the number of entries in the list.
  7. Double-click the interface (IF_OO_ADT_CLASSRUN).
  8. The new interface appears When you return to the ABAP Class dialog box.
  9. Choose Next.
  10. Next, assign the class to a Transport Request.
  11. Under Choose from Requests in which you are involved, mark the request you used to create your package.
  12. Choose Finish.

The interface IF_OO_ADT_CLASSRUN allows you to run a class in ADT using the F9 key. When you do this, the system executes the code between METHOD if_oo_adt_classrun~main and ENDMETHOD. In this code block, you can output information in the ADT console.

In your code block, you can use out->write( ) to display information in the console. The line out->write( "Hello World" ). prints "Hello World" to the console. Crucially, you do not have to know at this point how it works; you just have to type in the code, ensuring the following:

  • There is no space between write and the opening parenthesis
  • There is at least one space after the opening parenthesis
  • There is at least one space before the closing parenthesis
  • There is a period at the end of the line

ADT checks your code as you go along and flags up errors in the left-hand margin of the editor with a white cross on a red background.

You can see the corresponding error messages in the Problems view below the editor. ADT also displays the same message as a pop-up when you move the mouse over the error symbol in the editor.

To run an ABAP object, you must activate it. To do this, choose the Activate icon in the toolbar or use the keyboard shortcut Ctrl + F3 (on your keyboard). You can see whether an object is active or not by looking in the Properties view, which is usually located in the tab below the ABAP Editor. During the activation, the system compiles the object into a form that the ABAP runtime system can understand.

To run the class, select F9 on your keyboard, or right-click in the editor, and choose Run asABAP Application (Console). The output, "Hello World", appears in the console. If you cannot see the console view, choose WindowShow ViewOther..., and select the Console view.

Using the Eclipse Editor

There are four key functions you must know when writing code in the ABAP Editor.

SAVE – This option saves your code but does not check the syntax for correctness or activate the program. It is good practice to save your work regularly.

Create a Hello World Application

Business Example

You are a programmer for an SAP customer and work with the new ABAP Development Tools. You want to create an ABAP program in Eclipse, then activate it and run it as an ABAP application.

As an example, you can consider the package created before, ZS4D100_01, create a new ABAP class. Let the class implement interface IF_OO_ADT_CLASSRUN so that you can use the class as main program for an Eclipse console app.


  1. In your package, create a new ABAP class with the name, ZCL_01_HELLO_WORLD. Ensure that it uses the interface, IF_OO_ADT_CLASSRUN. When you are prompted to assign the class to a transport request, use the transport request that you created in the previous task.

    1. Choose FileNewABAP Class.

    2. Enter your package, ZS4D100_01, where ## is your group number. 

    3. Enter the name, ZCL_01_HELLO_WORLD, where ## is your group number and enter a description for your class.

    4.  Choose Add... (next to the Interfaces group box).

    5. Enter the filter text, IF_OO_ADT_CLASSRUN. Double-click the matching entry in the hit list.

    6. Choose Next.

    7. Select Choose from requests in which I am involved and your own transport request.

    8. Choose Finish.

  2. In the if_oo_adt_classrun~main( ) method, use out->write( ) to output the phrase Hello World.

    1. In the editor, enter the following coding between METHOD if_oo_adt_classrun~main and ENDMETHOD.: out->write( 'Hello World' ).

  3. Activate and test your class.

    1. Activate the class with the keyboard shortcut Ctrl + F3.

    2. Run the class with the F9 key.

  4. Check the output in the Console view of Eclipse.

    1. Check the Console view that should have opened as a new tab below the editor view.

    2. If the Console view is not visible, open it by choosing WindowShow viewOther. Double-click Console in the hit list.

      Code Snippet
      Copy code
      Switch to dark mode
      * Full Solution Code CLASS zcl_s4d100_hello_world_sol DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. INTERFACES IF_OO_ADT_CLASSRUN. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_s4d100_hello_world_sol IMPLEMENTATION. METHOD if_oo_adt_classrun~main. out->write( | Hello World! | ). ENDMETHOD. ENDCLASS.


Log in to track your progress & complete quizzes