- ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor = general report creation processor)
As you can see it's roots are similar to RPG (Report Program Generator) In that both languages started as a way of creating reports.
- ABAP has no format restrictions.
- You can enter statements in any format, so a statement can be indented, you can write several statements on one line, or spread a single statement over several lines.
- The only requirement is that every statement ends in a period.
- You must separate words within a statement with at least one space.
- The system also interprets the end of line marker as a space.
The following is a very simple example of a ABAP program written two different ways.
Example 1
PROGRAM TEST.
WRITE 'Hello World'.
Example 2
PROGRAM TEST. WRITE 'Hello World'.
The true power of ABAP is its close connection to the SAP Data Dictionary.
To create an Internal Table of all of the fields in a program use the following command.
DATA itab_kna1 LIKE kna1.
The run time environment will create a table that lives only while the program is executing and the program will be know it as ITAB_KNA1. The internal table tables can be called anything.
You can also cherry pick what fields from a table you might want.
DATA:
BEGIN OF itab_Customer OCCURS 0,
bukrs TYPE knb1-bukrs,
kunn2 TYPE knvp-kunn2,
break TYPE char2,
address TYPE char2,
END OF itab_Customer.
Check out this link for further explantion of the DATA command.
In my example I am defining an internal table the table has 4 fields called bukrs, kunn2, break, and address.
The definition for the field bukrs comes from table KNB1 field bukrs. The field CHAR2 is actually in the data dictionary defined as Character 2 but is not part of a table. Another point to keep in mind is the validation criteria for these fields is defined by the Data Dictionary. So your program inherits a lot of information when you use the the Data Dictionary.
Tables and Structures are an integral part of ABAP and if you really want to program in ABAP correctly you need to have a firm understanding of this topic.
Simple data Types.
Can be used to define tables and structures as well.
The following table shows the data types ABAP supports.
Type | Description | Initial Value |
C | Character | Space |
D | Date | '00000000' |
F | Floating Point | 0.0 |
I | Integer | 0 |
N | Numeric Text | '0' |
P | Packed Decimal | 0.0 |
T | Time | '000000' |
X | Hexadecimals | X00 |
Global and Local Variables
To define a Global Variable declare it outside of any subroutines. Conversely to define a Local Variable define it within a subroutine
Example Program

Comments
If you want to make a whole line a comment then place an "*" in the first position a " in a line will make the rest of that line a comment.
Program Start
Typical ABAP Program starts with Report followed by program name.
Alternately you can use Program followed by program name.