How to create ABAP console application in SAP Cloud Platform ABAP Environment

0
21

Dear SAPLearners, in this blog post we will learn to create an ABAP class in SAP Cloud Platform Cloud Foundry environment.

Prerequisites

Before you start, make sure you have

I know you are very much exited to write your first ABAP program/class in SAP Cloud Platform and also got few questions in your mind. Lets get answers to those first

What will be the IDE which i am going to use with ABAP in Cloud system?

The answer is Eclipse ABAP Development Tools

Can i create all ABAP repository objects like in on-premise in ABAP cloud system?

No, you cannot.

Below is the list of ABAP Repository Objects you can create in ABAP system in cloud.

1. Dictionary

  • Data Element
  • Database Table
  • Domain
  • Dynamic Cache
  • Lock Object
  • Structure
  • Table Type

2. Message Classes

3. ABAP Package

4. Source Code Library

  • ABAP Class
  • ABAP Function Group
  • ABAP Function Module
  • ABAP Interface

5. Transformations

6. Core Data Services (CDS)

  • Data Definition
  • Access Control
  • Metadata Extension
  • Behavior Definition

7. Connectivity

  • HTTP Service

8. Cloud Communication Management

  • Communication Scenario

9. Cloud Identity and Access Management

  • Business Catalog
  • Identity & Access Management(IAM) App
  • Restriction Field
  • Restriction Type

10. Business Services

  • Service Definition
  • Service Consumption Model
  • Service Binding

11. Authorizations

  • Authorization Field
  • Authorization Object
  • Default Authorization Values

The above list may change and new repository objects get added in new releases.

Now that you have understanding of what you can do in cloud ABAP system. Lets create demo ABAP application.

Step-by-Step Procedure

#Create ABAP Package

1. Right-click on ZLOCAL package and choose New -> ABAP Package from the context menu

Create ABAP Package in SAP Cloud Platform

2. Provide Name and Description of the ABAP package and click Next

Create ABAP Package in SAP Cloud Platform

3. Hit Next

Create ABAP Package in SAP Cloud Platform

4. Choose the Transport Request and hit Finish.

Create ABAP Package in SAP Cloud Platform

5. A new ABAP Package is created. Navigate to the package, right-click and choose New -> ABAP Class.

Create ABAP Class in SAP Cloud Platform

6. Provide Name and Description of the ABAP class and click Next

Create ABAP Class in SAP Cloud Platform

7. Select the transport request and hit Finish

Create ABAP Class in SAP Cloud Platform

8. A new ABAP class is created, copy and paste the below code

CLASS zcloud_demo DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES if_oo_adt_classrun.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.


CLASS zcloud_demo IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    out->write('Hello ABAP in Cloud!').
  ENDMETHOD.
ENDCLASS.

In above code interface IF_OO_ADT_CLASSRUN provides a light-weight solution for executing an ABAP program without launching the integrated SAP GUI.

9. Save and activate code changes.

10. Finally run the ABAP class to see the output in ABAP Console.

Create ABAP Class in SAP Cloud Platform

Output:

Create ABAP Class in SAP Cloud Platform

Congrats!!! you have successfully created and ABAP Class in SAP Cloud Platform ABAP Environment.

Please feel free to comment and let us know your feedback. Subscribe for more updates.

if you liked it, please share it! Thanks!

Other References

How to create trial ABAP system on SAP Cloud Platform Cloud Foundry environment

How to create ABAP Cloud Project in SAP Cloud Platform