SAP ABAP — Environment

Nirushi Wijesiri
6 min readAug 25, 2022

--

Let me guess, ABAP is not your first ever programming language right? Of course it can’t be. Maybe you are new to ABAP. But that’s alright! Trust me, this is a very simple language which is very human-friendly.

Feel lost? Oh don’t worry! I will guide you slowly. By any chance if you missed my first article on SAP ABAP Overview, you are very welcome to pay a visit there and gather some knowledge.

Remember how you started your previous programming language? You printed “Hello World” right? Well, there’s no difference when it comes to ABAP. The only thing is, there will be some new words and phrases that you never used before. Not to worry! Let’s start with baby steps!

In ABAP, one of the main output types is a report. Reports are a good starting point to get yourself familiar with the general ABAP principles and tools. You will see how much we will be using ABAP reports in the future. Now, let’s see how to write a simple ABAP report. Trust me, it’s super easy!

Hello ABAP

PERFECT! Now it’s time to start your journey in ABAP coding. Why not start with the most simple program in every programming language, “Hello World”? Oh, wait! It’s gonna be “Hello ABAP”.

But, still everything is just blank! We know NOTHING about ABAP coding!

Well, let me tell you what ABAP is like. What you should know before start ABAP coding.

  • Each ABAP statement starts with an ABAP keyword and ends with a period.
  • Keywords are separated by at least one space.
  • You can use one or several lines for an ABAP statement.
  • You write your code using the ABAP editor. This comes with the SAP NetWeaver Application Server ABAP (also known as ‘AS ABAP’).

Okay, so far, so good! WOAH, wait! AS ABAP? What is that?

It is nothing but the SAP application server you have on your machine right now. It has its own database, ABAP run-time environment, and ABAP development tools such as ABAP Editor. What is so special about AS ABAP? The AS ABAP offers a development platform that is independent of hardware, operating system, and database. COOL!

Create Your First ABAP Report

Step 01: Log in to the SAP Logon by giving your login details.

Step 02: Start the transaction SE38 to navigate to the ABAP Editor. ( I know the word transaction and navigate confuse you. But keep going, and I promise you that things will start to make sense once you get used to this! ) Now, we are ready to create our first ABAP report.

Step 03: Once you are navigated to the initial screen of the ABAP editor, you can specify the name you are to give to your first ABAP report in the input field PROGRAM. I’m naming my report program as “ZMYFIRSTREPORT_NW”.

What a weird name. Why did I start with Z out of nowhere?

There’s nothing to be confused. Z ensures that the report resides in the customer namespace. Let me make it clearer to you. Programs starting with A to X are STANDARD PROGRAMS. Programs starting with Y and Z are CUSTOM GENERATED PROGRAMS. But why did I use Z, instead of Y? Well, Program names starting with Y are used for LOCAL DEVELOPMENT and program names starting with Z are used for ACTUAL DEVELOPMENT. Simple as that!

Another interesting fact is that the names of ABAP objects are ‘NOT’ case sensitive. If you typed the report name in lower case letters, the editor would change it to upper case.

Step 04: Once you specified the name of the report, click the CREATE button.

Step 05: And here you have a pop-up window ABAP: PROGRAM ATTRIBUTES. Enter an appropriate title. I entered “My First ABAP Report”. And choose “Executable Program” as the report type. Hit SAVE.

Step 06: BOOM! Another pop-up here! CREATE OBJECT DIRECTORY ENTRY. You are asked to provide a package to the particular program you are creating. But, since this is just a local object you create to practice yourself, you don’t have to provide any package. You can leave that field blank and hit LOCAL OBJECT.

Just like that, here you have your first ABAP report on your screen!

Now let’s start writing your report!

This is a report and we don’t print them, we WRITE. So, let’s complete our first ABAP report by entering the WRITE statement below.

REPORT ZMYFIRSTREPORT_NW.
WRITE ‘Hello ABAP!’.

Now you need to save your changes. You can use the keyboard shortcut Ctrl + S or the save icon which is in the bottom right corner of the screen. The location of the save icon depends on the UI you use. But it’s easy to find.

Saving the changes is not enough. You have to activate the saved program. It is as simple as saving the changes. Just one click on the ACTIVATION button (see the below figure) or use Ctrl + F3.

Once you try to activate it will pop up another box. Just like the below figure. Just make sure that you have ticked your program and all you have to do is click on the green tick in the bottom of the box. If your program does not have any error, it will be activated right after.

It’s saved and activated and now let’s execute the program!

Executing the program is way easier, because it’s just one click thing. There’s an icon right next to the activation icon. (See the screenshot below) Click on it or simply press F8.

SIMPLE AS THAT!

Now you can see your output!

Here’s an important fact. As long as you do not activate a new report or activate a change to an existing report, it is not relevant to their users. This is important in a central development environment where you may work on objects that other developers use in their projects.

View or Change an Existing ABAP Code

It’s very simple to view or change an existing ABAP Code.

  • Go to the transaction SE38
  • Enter the source Code name.
  • To view the code, click on the “Display” button.
  • To Change the code, Click on the “Change” button.

That’s it! It’s simple isn’t it?

CONGRATULATIONS! You just finished your first ABAP program. I am so proud of you. See, baby steps! See you with another exciting ABAP topic. Till then, keep trying to be the best version of yourself. Good luck!

--

--