Skip to Content

Create Your First ABAP Console Application

Create an ABAP package and an ABAP class in the SAP BTP, ABAP Environment with the ABAP Development Tools (ADT) in Eclipse.
You will learn
  • How to create an ABAP cloud project in ADT
  • How to create an ABAP package
  • How to create an ABAP class
  • How to execute the application console
mervey45Merve TemelNovember 30, 2022
Created by
mervey45
September 3, 2018

Prerequisites

For ABAP license:
- You have set up your ABAP environment as described in Getting Started with a Customer Account: Workflow in the ABAP Environment
- You have a user in the ABAP Environment Connect to the ABAP System
- You have downloaded the ABAP Development Tools (ADT). SAP recommends the latest version of ADT, available from ABAP Development Tools
For ABAP Trial:
- You need an SAP BTP, ABAP environment trial user.
- You have downloaded the ABAP Development Tools (ADT). SAP recommends the latest version of ADT, available from ABAP Development Tools

In this tutorial, wherever XXX appears, use a number (e.g. 000) or your initials.

For more information, see:
- SAP Help Portal: What is SAP BTP

  • Step 1

    Open the ADT and change to the ABAP perspective, using the menu.

    adt-abap-menu

    And select ABAP and click Open.

    perspective

    Or select the icon.

    adt-abap-icon
  • Step 2
    1. In the ADT, select the menu path File > New > Other.

      Create an ABAP Cloud project in ADT
    2. Search for ABAP Cloud Project, select it and click Next.

      Select ABAP Cloud Project
    3. Select Use Cloud Foundry Environment in section SAP BTP Cloud Foundry Environment and click Next >

      Create ABAP cloud project
    4. Enter your connection settings:

      • Region: choose your SAP BTP Cloud Foundry Environment region, for e.g. Europe (Frankfurt)
      • Email: your email address
      • Password: your password
      Create ABAP cloud project
      Click Next >.
    5. Set your service instance details:

      • Organization: <your_organization>
      • Space: dev
      • Service instance: <your_service_instance>
      Create ABAP cloud project

      Click Next >.

      HINT: Your service instance is default_abap-trial when you use the ABAP trial booster on SAP BTP. If you create a manual instance, use your own instance name.

    6. Click Open Logon Page in Browser.

      Create ABAP cloud project
    7. Now you’ve been authenticated automatically. Provide your credentials if requested. The credentials are the same you used to create your trial account on SAP BTP.

      Go back to ADT.

      Create ABAP cloud project

      Click Finish.

  • Step 3
    1. Right-click on the ZLOCAL and select New > ABAP Package from the context menu.

      Add ABAP package
    2. Provide the required information and move on with Next.

      • Name: ZPACKAGE_XXX
      • Description: My Package XXX
      • Check Add to favorite packages.
      Create ABAP package
      Click Next >.
    3. Create a new request and click Finish.

      Select transport request

      The ABAP package is now created.

  • Step 4
    1. Add a new ABAP class to your package.

      Add new ABAP class
    2. Maintain the required information and click Next to move on:

      • Name: Z_CLASS_XXX
      • Description: My class XXX
      Add new ABAP class
      Click Next >.
    3. Click Finish.

      Select transport request
    4. Your class is now created.

      Select transport request
  • Step 5
    1. In the class definition, specify the interface IF_OO_ADT_CLASSRUN in the public section as shown on the screenshot. Now go to the class implementation and provide the implementation of the method IF_OO_ADT_CLASSRUN~MAIN. As shown on the screenshot, it should output the text Hello World! using the code line below
      out->write('Hello World!').

      ABAP
      Copy
      CLASS z_class_xxx DEFINITION
        PUBLIC
        FINAL
        CREATE PUBLIC .
      
        PUBLIC SECTION.
          INTERFACES if_oo_adt_classrun.
        PROTECTED SECTION.
        PRIVATE SECTION.
      ENDCLASS.
      
      CLASS z_class_xxx IMPLEMENTATION.
        METHOD if_oo_adt_classrun~main.
          out->write( 'Hello world!' ).
        ENDMETHOD.
      ENDCLASS.
      
    2. Save and activate your changes.

      Implement an Interface
  • Step 6
    1. Right-click your class and select Run As > ABAP Application (Console) or select your class and press F9.

      Execute ABAP application
    2. Check your result.

      Execute ABAP application
  • Step 7

    Write only the write statement with following information: Hello SAP Cloud Platform ABAP Environment!

Back to top