Your First ABAP ProgramΒ 

Your First ABAP Program in 2026 (Hello World Step-by-Step) | ABAP Zero to Hero
ABAP Zero to Hero

Chapter 03  Β·  Foundations

Your First ABAP Program

Write, activate, and run your very first ABAP program β€” the Hello World moment that makes everything click. Both ABAP Cloud and Classic ABAP covered.

Chapter 3 of 20 18 min read Part 1: Foundations 5 Interview Q&A

Your environment is ready. In Chapter 2, you set up your ABAP environment β€” either a free BTP Trial ABAP Cloud instance or a paid company SAP system β€” and connected Eclipse ADT to it.

This is the chapter where you finally write code. Not a demo, not a screenshot β€” your own ABAP program, running on your own system, activated and executed within the next 20 minutes.

It will be a simple “Hello World” program. But the journey of activation, syntax checking, and console output that you go through here is the exact same journey you will follow for every ABAP program you ever write, from simple reports to full RAP business objects. And this chapter shows you both paths: ABAP Cloud and Classic ABAP.

What you will produce by the end of this chapter A working ABAP program that prints a greeting to the screen β€” with your own name in it. Free learners will do it in ABAP Cloud; paid learners will do it in both ABAP Cloud and Classic ABAP.

🎯 Who Is This Chapter For?

This chapter serves both types of ABAP learners. Here is how to read it:

  • If you are on the FREE BTP Trial β†’ follow the 🟒 green dual path boxes. You will write Hello World as an ABAP Cloud class in Eclipse ADT using cl_demo_output.
  • If you have PAID SAP access (company or institute) β†’ follow the πŸ”΅ blue dual path boxes. You will write Hello World both ways: as an ABAP Cloud class in Eclipse ADT (modern approach) and as a Classic ABAP report in SE38 using WRITE (traditional approach).
  • Both paths teach the same core concept: write, activate, run. The tooling differs; the workflow and thinking are identical.

🎯 What You Will Learn in This Chapter

  • How ABAP Cloud organizes code β€” packages, classes, and the object model
  • How to create a package in Eclipse ADT β€” both paths
  • How to create an ABAP Cloud class and write Hello World in it β€” both paths
  • How to write Classic ABAP Hello World in SE38 using WRITE β€” paid path
  • How to activate code and interpret syntax check messages
  • How to run your program and see the output
  • How the same concept maps across two different editors

🧭 Which Path Should I Choose?

Before writing code, decide which path applies to you. This chapter has two tracks running in parallel.

Two learner types β€” find yourself

🟒
1. Free BTP Trial learner You write Hello World in ABAP Cloud inside Eclipse ADT using cl_demo_output. This is the modern, upgrade-safe approach and what most new SAP development uses in 2026.
πŸ”΅
2. Paid SAP access learner You write Hello World both ways: first in ABAP Cloud (Eclipse ADT, same as free path), then in Classic ABAP (SAP GUI SE38 using WRITE). Learning both makes you a more versatile developer and prepares you for interviews that test either approach.
The universal rule Whichever path you take, the rhythm is the same: write, activate, run. Only the editor and the output method change.

What You Can Do With Each Path

Task🟒 Free Path (BTP Trial)πŸ”΅ Paid Path (SAP System)
Hello World in ABAP Cloudβœ… Eclipse ADTβœ… Eclipse ADT
Hello World in Classic ABAP❌ Not availableβœ… SAP GUI SE38
Output method (Cloud)cl_demo_output=>write( )cl_demo_output=>write( )
Output method (Classic)N/AWRITE statement
Editor for CloudEclipse ADTEclipse ADT
Editor for ClassicN/ASAP GUI (SE38, SE80)
Activation shortcut (Cloud)Ctrl + F3Ctrl + F3
Activation shortcut (Classic)N/ACtrl + F2
Run shortcut (Cloud)F9F9
Run shortcut (Classic)N/AF8

πŸ“˜ How ABAP Organizes Code

Before writing a single line, you need to understand how ABAP structures its code. It is very different from writing a script.

In Classic ABAP, you can write a simple report in SE38 and run it directly. In ABAP Cloud, everything is structured. Think of it as a hierarchy:

LevelWhat it isAnalogy
PackageA folder that groups related development objectsA project folder on your desktop
ClassA container for code β€” methods, variables, logicA file inside that folder
MethodA block of code that does one jobA single chapter inside the file
StatementA single instruction ending with a periodA single sentence
The golden rule of ABAP Cloud Every piece of code lives inside a class, and every class lives inside a package. No exceptions. This is what makes ABAP Cloud clean and upgrade-safe.

You will learn classes and methods in detail in Chapter 8. For now, we just need one class with one method to run our Hello World.

🟒 Free Path

Cloud Structure Only

In ABAP Cloud you only work with packages and classes. There is no “report program” concept in the classic sense.

  1. Create a package
  2. Create a class inside it
  3. Write a method
  4. Activate and run

Both Structures

In Classic ABAP you can also write a standalone report program in SE38 β€” no package or class required. You will write both versions.

  1. Cloud structure (same as free path)
  2. Plus Classic report program in SE38
  3. Two ways, same concept

πŸ“¦ Step 1: Create Your First Package

Every development object in ABAP Cloud must belong to a package. Think of the package as your project’s home address. This step is the same for both free and paid learners (working in ABAP Cloud).

1 Open your ABAP Cloud Project in Eclipse

Launch Eclipse and expand your ABAP Cloud Project in the Project Explorer on the left side.

2 Right-click and create a new package

Right-click on your project folder, then go to New β†’ ABAP Package.

3 Name your package

Enter a name like ZHELLO_WORLD. The Z prefix is the standard naming convention for custom objects in SAP β€” it tells the system this is customer-developed, not SAP standard.

Add a short description like “Chapter 3 Hello World Practice”.

4 Assign to a transport and activate

When prompted, use the default transport request (or create a new one). Click Finish. Your package is now created and active.

What just happened You created a container for all your future development objects. Every class, interface, and CDS View you build in this series will live inside this package.
🟒 Free Path

Package Created in Cloud

Your package ZHELLO_WORLD is ready. Move to Step 2 to create your first class.

Package Created in Cloud + Classic Next

Your package is ready in your ABAP Cloud project. You will also do a Classic ABAP version in Step 6 using SE38 β€” no package needed there.

πŸ—οΈ Step 2: Create Your First ABAP Cloud Class

In ABAP Cloud, code lives inside classes. This is not optional. Even a simple Hello World program is a class with a method that runs it. Both paths do this step.

1 Right-click the package

In the Project Explorer, right-click on ZHELLO_WORLD, then go to New β†’ ABAP Class.

2 Name your class

Enter a name like ZCL_HELLO_WORLD. The ZCL_ prefix is the convention for classes (Z for custom, CL for class).

Add a description like “My first ABAP class”.

3 Accept the class template

Eclipse will generate a default class skeleton with a definition and an implementation section. Click Finish.

The ABAP editor opens with your new class. Notice the two main parts:

  • Definition: declares what the class contains (methods, variables)
  • Implementation: contains the actual code of each method
If your class name shows a syntax warning Make sure the name follows the ZCL_ convention and that it is unique in your system. Names are case-sensitive in the definition but the compiler will resolve them.

✍️ Step 3: Write the ABAP Cloud Hello World (Both Paths)

Now for the moment you have been waiting for. Replace the default class skeleton with the following code. Type it out rather than copy-pasting β€” muscle memory matters more than you think at this stage.

CLASS zcl_hello_world DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.

  PUBLIC SECTION.
    CLASS-METHODS run.

ENDCLASS.

CLASS zcl_hello_world IMPLEMENTATION.

  METHOD run.
    cl_demo_output=>write( 'Hello World from ABAP Cloud!' ).
    cl_demo_output=>display( ).
  ENDMETHOD.

ENDCLASS.

Let’s break it down line by line.

The Definition Section

CLASS zcl_hello_world DEFINITION PUBLIC FINAL CREATE PUBLIC.

  • PUBLIC: The class can be used from anywhere in the system
  • FINAL: Nobody can inherit from this class (fine for now)
  • CREATE PUBLIC: Anyone can create an instance of this class

CLASS-METHODS run. declares a single static method called run. A static method can be called without creating an object β€” perfect for our simple program.

The Implementation Section

METHOD run. begins the actual logic.

cl_demo_output=>write( 'Hello World from ABAP Cloud!' ). calls a built-in SAP utility class that collects output.

cl_demo_output=>display( ). opens a window and shows everything collected.

ENDMETHOD. closes the method.

Why cl_demo_output? In Classic ABAP you would use WRITE directly. In ABAP Cloud, cl_demo_output is the modern, upgrade-safe way to display simple output. It is available in every ABAP Cloud system without any configuration.

⚑ Step 4: Activate Your Class (Both Paths)

In ABAP Cloud, nothing runs until it is activated. Activation is the compiler’s way of checking your code is correct and making it available to the runtime.

1 Save the file

Press Ctrl + S. Eclipse auto-saves, but this also triggers a background syntax check.

2 Activate the class

Press Ctrl + F3 (or click the Activate icon on the toolbar, which looks like a small flame).

If everything is correct, you will see a green “Activation successful” message in the status bar.

3 Handle any errors

If activation fails, Eclipse shows the errors in the Problems view at the bottom. Common causes:

  • Missing period: Every ABAP statement ends with a period.
  • Wrong class name: Make sure the name in the definition and implementation sections match exactly.
  • Typo in cl_demo_output: The method is write, not writeln or output.

Fix the issue, save, and activate again.

▢️ Step 5: Run Your ABAP Cloud Program (Both Paths)

Your code is activated. Now it is time to see it come alive.

1 Open the Run dialog

Press F9, or right-click anywhere in the class editor and choose Run As β†’ ABAP Application (Console).

2 See your output

Eclipse will open a console view at the bottom of the screen showing:

Hello World from ABAP Cloud!
Congratulations! You just wrote, activated, and ran your first ABAP Cloud program on a real system. That green output is not from a tutorial screenshot β€” it is your own code running on SAP infrastructure.

Take a moment to appreciate what just happened. You connected to an SAP system, wrote code in SAP’s enterprise language, compiled it, and executed it. This is exactly what ABAP developers do every day.

🟒 Free Path

You Are Done With the Cloud Version

Skip Step 6 (Classic ABAP) and go to the Bonus section to personalize your output. Then take the practice task and quiz.

Now Try Classic ABAP

You have run the Cloud version. Now let’s do the same thing in Classic ABAP using SAP GUI and SE38 β€” the traditional way 70% of ABAP jobs still work today.

πŸ”΅ Step 6: Classic ABAP Hello World in SE38 (Paid Path Only)

Free path learners: skip this section. You do not have SAP GUI access, so you cannot do this. That is fine β€” the Cloud version you already ran is what modern development uses.

Paid path learners: This is your bonus. You will now write the same Hello World in Classic ABAP. This is how 70% of ABAP developers still work today, and it is essential for interviews that test classic skills.

1 Log in to SAP GUI

Open your SAP GUI client and log in with your credentials. You will see the SAP Easy Access menu screen.

2 Open transaction SE38

In the command field at the top of the screen, type SE38 and press Enter. This opens the ABAP Editor.

3 Create a new report program

In the Program field, type a name like ZHELLO_WORLD_REPORT. Click Create.

In the dialog that appears:

  • Title: My First ABAP Report
  • Type: Executable program
  • Status: Save as a test object (or assign to a transport if your company requires it)

Click Save.

4 Write the Classic ABAP code

In the editor that opens, type the following code:

REPORT zhello_world_report.

WRITE: 'Hello World from Classic ABAP!',
       / 'I am learning ABAP in 2026.'.

Notice the differences from the Cloud version:

  • There is no class β€” the program is standalone
  • We use REPORT at the top to declare the program type
  • We use the WRITE statement to output text
  • The slash (/) at the start of the second line means “new line”
  • The colon after WRITE: lets you chain multiple statements
Why the difference? Classic ABAP allows direct WRITE statements because programs are self-contained. ABAP Cloud requires the modern structure to enforce Clean Core principles. Same concept, different syntax.
5 Check syntax and activate

Press Ctrl + F2 to perform a syntax check. If there are errors, they will appear at the bottom.

Press Ctrl + F2 again (or click the Activate icon) to activate the program. You will see a confirmation message.

6 Run the program

Press F8 (or click the Execute icon). The output appears on screen:

Hello World from Classic ABAP!
I am learning ABAP in 2026.
You have now done it both ways You wrote Hello World in ABAP Cloud (Eclipse ADT) and Classic ABAP (SAP GUI SE38). Same concept β€” write, activate, run β€” but through two completely different tools.
🟒 Free Path

Cloud Only β€” That Is Fine

You have learned ABAP Cloud, which is where all new SAP development is heading. In interviews you will be tested on Cloud for modern roles and can describe Classic conceptually.

You Now Know Both

You have hands-on experience with both ABAP Cloud and Classic ABAP. This makes you a more versatile candidate and covers 100% of ABAP interview topics.

🎨 Bonus: Make It Yours

Before you move on, personalize the program. Change the strings to include your name.

🟒 Free Path β€” ABAP Cloud

cl_demo_output=>write( 'Hello World, my name is Rahul!' ).
cl_demo_output=>write( 'I am learning ABAP in 2026.' ).
cl_demo_output=>display( ).

πŸ”΅ Paid Path β€” Classic ABAP

REPORT zhello_world_report.

WRITE: 'Hello World, my name is Rahul!',
       / 'I am learning ABAP in 2026.'.

Notice that you can call write or WRITE multiple times. Each call adds a new line to the output.

Save, activate (Ctrl + F3 for Cloud, Ctrl + F2 for Classic), and run again (F9 for Cloud, F8 for Classic). Your name is now printed by an SAP system.

Take a screenshot Save this output. When you look back at Chapter 20, this screenshot will remind you where you started.

🧠 What Just Happened Under the Hood

Understanding the mechanics behind those three steps β€” write, activate, run β€” will help you debug faster and think like a developer. The table below shows both paths.

PhaseWhat SAP DoesCloud (Free)Classic (Paid)
WriteNothing yet β€” code is just textType in Eclipse ADTType in SE38
Syntax CheckReads your code, flags errorsAuto on saveCtrl + F2
ActivateCompiles, stores the active versionCtrl + F3Ctrl + F2
RunLoads active version and executes itF9F8
OutputSends result to the console/screenConsole viewClassic list

The active version is what runs. If you edit the code but forget to activate, the old version runs. This trips up beginners constantly. Remember the rule: save, activate, run.

πŸ“ Chapter Summary

  • ABAP Cloud organizes code in a strict hierarchy: package β†’ class β†’ method β†’ statement.
  • Classic ABAP also allows standalone report programs in SE38 with direct WRITE statements.
  • Every Cloud class belongs to a package. Custom objects use the Z prefix.
  • Cloud Hello World: cl_demo_output=>write( ) and cl_demo_output=>display( ).
  • Classic Hello World: REPORT and WRITE statements.
  • Both use the same rhythm: save, activate, run. Only the shortcuts differ.
  • Free path learners master the Cloud version. Paid path learners master both.

🎀 Interview Questions & Answers

These are the most common ABAP beginner interview questions. Being able to explain Hello World in both Cloud and Classic forms signals you understand the fundamentals.

1 What is the difference between a package and a class in ABAP?

A package is a container that groups related development objects β€” it is like a folder. A class is a single object that contains code. Every class must belong to a package.

Think of it this way: a package is the project folder; a class is a file inside that folder; a method is a chapter inside the file.

2 Why is activation required in ABAP?

Activation is the compilation step. When you activate, SAP checks your code for syntax errors and stores a compiled version in the system. Only the active version can run.

If you edit code and forget to activate, the previous active version still runs. This is why the rhythm of ABAP development is always save, activate, run. In Cloud this is Ctrl + F3, in Classic it is Ctrl + F2.

3 What does the Z prefix mean in ABAP class names?

The Z prefix is the standard SAP naming convention for customer-developed objects. It tells the system that the object is not part of SAP standard delivery β€” it is created by the customer.

Common prefixes include ZCL_ for classes, ZIF_ for interfaces, and Z_ or ZR_ for other custom objects. Following naming conventions is mandatory in real SAP projects because it keeps custom development separate from SAP standard during upgrades.

4 What is the difference between CL_DEMO_OUTPUT and the WRITE statement?

WRITE is the classic ABAP statement for output. It works only in classic report programs and on-premise systems. It is not permitted in ABAP Cloud.

cl_demo_output is a modern utility class that works in both Classic ABAP and ABAP Cloud. It collects output and displays it in a formatted window. In ABAP Cloud, it is the standard way to produce simple console output for learning and testing.

For real production applications, output is usually delivered through Fiori apps and OData services, which we cover in Chapter 19.

5 What is a static method and why did we use one for Hello World?

A static method belongs to the class itself, not to an instance of the class. This means you can call it without creating an object.

We used CLASS-METHODS run because Hello World does not need any object state β€” it just prints a string. For a simple program, a static method is the simplest possible structure.

In contrast, an instance method requires you to create an object with CREATE OBJECT or NEW before calling it. Instance methods are used when the method needs access to instance-specific data.

6 Can you write a Hello World program in both ABAP Cloud and Classic ABAP?

Yes. In ABAP Cloud, you write a class with a static method that calls cl_demo_output=>write( ) and cl_demo_output=>display( ), then activate with Ctrl + F3 and run with F9.

In Classic ABAP, you write a standalone report program in SE38 with a REPORT statement at the top and WRITE statements for output, then activate with Ctrl + F2 and run with F8.

Both follow the same rhythm β€” write, activate, run β€” but use different tools. Knowing both makes you a stronger and more versatile ABAP developer.

πŸ›  Practice Task for This Chapter

Complete the tasks for your path before moving to Chapter 4. Each takes about 20 minutes and solidifies everything you just learned.

🟒 Free Path (BTP Trial)

  1. Create a new class called ZCL_PRACTICE_CH3 inside your package.
  2. Add a static method called run.
  3. Inside the method, print three lines using cl_demo_output=>write( ):
    • Your name
    • Your city
    • The reason you are learning ABAP
  4. Save (Ctrl + S), activate (Ctrl + F3), and run (F9).
  5. Take a screenshot of the output as proof of completion.

πŸ”΅ Paid Path (SAP System)

  1. Complete all the free path steps above in ABAP Cloud (Eclipse ADT).
  2. Then open SE38 in SAP GUI and create a report called ZPRACTICE_CH3_REPORT.
  3. Inside the report, use WRITE to print the same three lines: your name, your city, and your reason for learning ABAP.
  4. Check syntax (Ctrl + F2), activate (Ctrl + F2), and run (F8).
  5. Screenshot both outputs β€” Cloud and Classic β€” as proof you can work in both environments.
Why this matters Interviewers often ask “Show me what you built while learning.” Having screenshots of your first ABAP programs in both Cloud and Classic is a stronger answer than any certificate.
🎯 Chapter 3 Challenge

Test: Kon Banega Crorepati?

5 questions. β‚Ή1 Crore. Prove you understood Chapter 3. No pressure β€” restart anytime.

β‚Ή1,000 β‚Ή10,000 β‚Ή1,00,000 β‚Ή10,00,000 β‚Ή1 Crore
Question 1 of 5
Score: 0
Q1
πŸ†
You Did It!
0/5 Correct Answers
You won β‚Ή0
➑️ Next Chapter

➑️ Next Chapter

You have written your first program in both Cloud and Classic forms. In Chapter 4, you will learn data types, variables, and system fields β€” the building blocks that let your programs store, change, and display real data.

Chapter 4 Data Types, Variables & System Fields β†’
Want to Learn Faster?

Explore Our Instructor-Led SAP & IT Courses

Self-study works. But if you want guided training, real project practice, and placement support β€” here are the courses we offer. Book a free demo before you decide.

S SAP Courses

SAP ABAP Training β†’ SAP ABAP: Core programming language of SAP β€” reports, enhancements, interfaces, and modern RAP development.
SAP SD (Sales & Distribution) β†’ SAP SD: Sales and Distribution β€” order-to-cash, pricing, billing, and shipping processes.
SAP HR / HCM β†’ SAP HR HCM: Human Capital Management β€” personnel admin, payroll, and org management.
SAP FICO β†’ SAP FICO: Finance and Controlling β€” GL, AP, AR, asset accounting, and cost centers.
SAP RAP β†’ SAP RAP: RESTful ABAP Programming model for modern Fiori and S/4HANA apps.
SAP GRC β†’ SAP GRC: Governance, Risk, and Compliance β€” access control and process control.
SAP BTP β†’ SAP BTP: Business Technology Platform for integration, extension, and data-to-value.
SAP PP β†’ SAP PP: Production Planning β€” MRP, capacity planning, and shop floor control.
SAP MM β†’ SAP MM: Materials Management β€” procurement, inventory, and invoice verification.
SAP WM β†’ SAP WM: Warehouse Management β€” storage bins, transfer orders, and inventory tracking.
SAP HANA β†’ SAP HANA: In-memory database for real-time analytics and applications.
All SAP Courses β†’ Browse the complete catalog of SAP training programs with certification.

T Technology & Other Courses

Oracle Courses β†’ Oracle training for database, PL/SQL, and enterprise applications.
Salesforce Training β†’ Salesforce Admin and Developer training for CRM mastery.
Full Stack Development β†’ Full Stack Development β€” frontend, backend, and databases.
Software Testing β†’ Software Testing: manual and automation testing for QA careers.
AWS (Amazon Web Services) β†’ AWS: Amazon Web Services cloud certification and training.
Cloud Computing β†’ Cloud Computing fundamentals and advanced cloud architecture.
Data Science β†’ Data Science: Python, ML, and analytics for data-driven roles.

WhatsApp WhatsApp us
Call Now Button