Developing the First ABAP Program

Summary: In this tutorial, we show you how to develop the first simple but famous ABAP program called “Hello World” in ABAP editor.

Step 1. From SAP first screen type SE38 in the command field to call ABAP Editor.

abap hello world 1 Developing the First ABAP Program

SE38

 

Step 2. In the ABAP Editor, type program name ZDEMO_HELLOWORLD. As the SAP naming convention, every customer’s program must start with Z or Y.

abap hello world 2 300x208 Developing the First ABAP Program

ABAP Hello World Program

Step 3. Click Create button to create a new program. SAP will popup a new window and ask you fill some program’s attributes such as program title and program type… Just fill the program title  “Hello World”, program type  “Executable program” and click Save button.

abap hello world 3 300x262 Developing the First ABAP Program

ABAP Program Attributes

Step 4. System will ask you for “Object directory entry” of the new program.  To make it simple, just click on “Local Object” button. Basically by doing this, you specify that you don’t want to import this program to another SAP systems such as QA or Production system.

abap hello world 4 300x33 Developing the First ABAP Program

ABAP Hello World Program - Object Directory Entry

Step 5. System will display ABAP Editor for you to start writing ABAP code.

abap hello world 5 300x132 Developing the First ABAP Program

ABAP Hello World Program - Code Editor

Step 6. You just type the code as below and click on Activate button. When you activate the program, SAP system checks the program syntax and generates run-time version. You can click on the “Direct Processing” button to run the program.

*&---------------------------------------------------------------------*
*& Report  ZDEMO_HELLOWORLD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  zdemo_helloworld.
 
WRITE 'Hello World'.

We will examine the ABAP Hello World program in details as below:

  • The REPORT keyword indicate that this program is a report or executable program. Meaning you can invoke it directly from SE38. Followed by the keyword REPORT is the program name.
  • Every ABAP statement ends with a full-stop (.)
  • The WRITE statement is used to write a message on screen.  In this case, WRITE statement accept a string ‘Hello World” as a data object.

Here is the output of the program. As you see, you have program title “Hello World” and a message Hello World on screen.

abap hello world 6 Developing the First ABAP Program

ABAP Hello World Program - Output

 

 

Congratulation! You’ve developed the first ABAP program that generate a greeting message “Hello World”.

In this tutorial, you’ve learned how to launch ABAP Editor by using transaction code SE38 and developed a simple but famous ABAP program called “Hello World”.