Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mamikee
Developer Advocate
Developer Advocate

Introduction


Happy New Year! I hope you were all able to stay safe and enjoy your holiday. As always, I want to thank everyone who has been following this series. I hope you find it helpful and follow these steps to get you started as an ABAP Developer. 

This is the third post in this series. Here is the previous blog post: Get Started with Your SAP ABAP Journey: Part 2.

In the previous blog post, we continued the installation process by running our Docker container and creating an ABAP package to structure our development objects. We will now build and run an ABAP application.

This exercise is based on tables of the SAP NetWeaver Demo sample EPM Model so that you can complete the tutorial on any SAP NetWeaver system. The EPM (Enterprise Procurement Model) is a demo application that integrates many SAP NetWeaver technologies used by SAP S/4HANA applications. It is based on a common business process model and follows the business object (BO) paradigm to support well-defined business logic.

This blog post also follows up with a video that walks you through the steps I will be going over.


Video version of the Get Started with ABAP Development tutorials


Prerequisites:

Creating new ABAP Program


Before creating an ABAP program, we need to make sure that our Docker Container is running and we have the SAP GUI system connected. Once we have done so, it is now time to launch Eclipse.

ABAP programs are objects of the Repository. Each repository object is assigned to a package. You maintain them by using an ABAP Workbench tool - in this case, the ABAP Editor.

Please refer to SAP Help Portal to learn more about the ABAP Workbench Tools.


 

To create a new ABAP program, we must first choose ABAP Program in the toolbar above. There are many ways we can do this. In the above example, I chose Local Objects > Programs...



New ABAP Program


When we create a new ABAP program, it is important to know that the program name must adhere to the customer naming conventions, meaning that here we must use the letter Z. In this instance, the program will be named ‘Z_invoice_items_euro', which should be typed into the ‘name field.’ Afterward, an editor will be opened, which shows the empty report where we will be writing our code.

Create an ABAP local class


A class that is defined and implemented in a program is known as Local Class. This acts as a client and asks the prototype to clone itself. In the screenshot below, you will see that we have created a local class and adjusted the name lcl_main using inline editing.



ABAP local class


The first set of lines visible here are comment lines. These five lines can be used to begin commenting the program. In ABAP, comments can appear in two ways. If a * is placed at the beginning of a line, it turns everything to its right into a comment. The following line of code begins with the word REPORT. This is called a STATEMENT, and the REPORT statement will always be the first line of any executable program created.

As a newbie, it's important to note that a complete stop or period must follow every statement in ABAP. As you see in our above code, we closed out all our statement with a period. This allows the statement to take up as many lines in the editor as it needs.

Activate ABAP program



Activate ABAP program


Once we have successfully made our ABAP program runnable following the interactive tutorial or video above, we will save and activate our ABAP program by clicking Save and Activate in the toolbar.

Run ABAP program


To run our program, we choose F8 or Cmd +1 on Mac. Our output now includes our username and today’s date. 

Run Program


 

Check code


 

The final code should look like this after we have successfully followed the tutorial and video above.




What’s Next: Display Database Content and Run SQL Queries


We have now successfully created and run our first ABAP application. Now that you are familiar with the program, we will display database content and run SQL queries using Data Preview in the next blog post.

Follow my profile to be notified of the next blog post. Please feel free to ask any questions in the comments section below.
1 Comment