ABAP (Advanced Business Application Programming) is a 4GL, object oriented programming language that developed for SAP by SAP. With ABAP, we can develop business application programs within SAP systems. It supports multi-language applications and Open SQL which turns database independent statements into the statements understood by the underlying database. SAP can work with a wide variety of databases and the same ABAP program can run on all of those.
Before starting ABAP development, it is helpful to learn SAP system architecture of R/3 on a three-tier client/server structure:
- Presentation: Simply, it is user-interfaces. It could be SAP GUI, web browser, mobile application and so on.
- Application: Where ABAP runs and all processing is done. Whenever a program needs a data, application server send a request to database to retrieve.
- Database: All data resides here.
ABAP Development Environment (ABAP Workbench) is placed in SAP GUI and you need to SAP server and an developer user account to access it. There is trial versions of SAP products you can use to kickstart your abap development. One of those is SAP NetWeaver AS ABAP 7.50 SP02 and you can grab it from here.
There many ways to implement ABAP code in workbench but we will start from report programs (SE38):
First of all, we need to start the transaction SE38:
This opens up ABAP Editor: Initial Screen. From here, we can create/edit abap report programs.
Enter a name for your ABAP Program and click Create.In all SAP systems, the other names that not starting with prefix "Y" or "Z" is allocated for SAP. So, you need to add it for all programs/tables etc.
In the upcoming popup, enter a title, choose "Executable Program" for Type attribute and click Save.
If you are working on application server, SAP will ask a package assignment from you. Packages are very helpful concept in SAP development; you can get more information from these series of blog.
Since we are doing tutorial program, we can select Local Object and continue.
Now we reach the editor screen, we are ready to write our first lines of ABAP code.
In the toolbar, you can see some usable actions:
Pretty Print: This simply tidy up and format your code, makes it easy to read and understand. (Shift + F1)
Check: Scans your code for sytanx error and if found, shows them at the bottom of screen. (Ctrl+ F2)
Activite: Save & Build. The Inactive programs can't be seen or run from another users. (Ctrl + F3)
Run: You can run programs before activating them. (F8)
You can see "Inactive/Active/New" label after report name.
The line in ABAP, consists of ABAP statements and ends with "." character.
All report programs starts with same line of code:
For writing the "Hello World" string to output we use "WRITE" statement;
WRITE 'Hello World'.
Finally we can check for Sytanx Errors ( Ctrl + F2 ) & Activate our report ( Ctrl + F3 ). To see the output we can run the report with (F8).