Skip to Content

Create Your First ABAP Console Application

test
0 %
Create Your First ABAP Console Application
Details
// Explore More Tutorials

Create Your First ABAP Console Application

04/10/2019

Create an ABAP package and an ABAP class in the SAP Cloud Platform 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

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


Step 1: Open Eclipse

Open Eclipse on your desktop.

Open Eclipse
Log on to answer question
Step 2: Create ABAP Cloud project in ADT
  1. Go to ADT and 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. In the next wizard screen, select SAP Cloud Platform Cloud Foundry Environment and click Next.

    Select service instance connection
  4. Maintain the SAP Cloud Platform Foundry connection information and click Next:

    • Region: <your_region>
    • Email: <your_email_address>
    • Password: <your_password>
    Setup connection settings
  5. Maintain the required Service Instance details by selecting the appropriate values from the drop-down lists and move on with Next.

    • Organization: <your_organization>
    • Space: <your_space>
    • Service Instance: <your_service_instance>
    Select service instance details
  6. Now provide your login credentials of the SAP Cloud Platform Identity Authentication Service (IAS) tenant to connect to the system and press Log On.

    Enter login credentials
  7. Connect to service instance by selecting Next.

    Connect to Service Instance
  8. At this stage you may add your favorite packages and click Finish to complete your setup.

    Add favorite packages
Log on to answer question
Step 3: Create ABAP package
  1. Right-click on the ZLocal package 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
    Create ABAP package
  3. Move on with Next.

    Select package properties

  4. Provide a description for the transport request and click Finish.

    Select transport request
    The ABAP package is now created.

Log on to answer question
Step 4: Create new ABAP class
  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
    Add new ABAP class
  3. Provide a transport request and click Finish.

    Select transport request

  4. Your class is now created.

    Select transport request

Log on to answer question
Step 5: Implement Interface
  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!').

      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

Log on to answer question
Step 6: Execute ABAP application
  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

Log on to answer question
Step 7: Test yourself

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

×

Next Steps

Prerequisites

  • SAP Cloud Platform ABAP Environment user
  • ADT version 2.96 or higher
Back to top