ABAP Stands for Advanced Business Application Programming. ABAP is a programming language created and used by SAP for the development of application programs,including: Reports, Screens, Interfaces & Data conversions. All of SAP applications and even parts of its basis system were developed in ABAP. ABAP is an event driven programming language.User actions and system events control the execution of an application.
The Advanced Business Application Programming / 4GL (ABAP/4, commonly referred to as ABAP) is SAP’s proprietary language. More than 80% of SAP R/3 is developed using ABAP. The ABAP Program code is “generated” into Byte-code at the time of Activation of the program and is processed by the ABAP Processor which is part of the Kernel and Basis Services (a set of core programs developed in C) at the time of execution. Any ABAP Program, because it requires the BASIS modules, can run only within an SAP environment.
Many features of the programming language and ABAP editor environment resemble the COBOL / IBM Mainframe environment although much of it has been scaled down somewhat to give the language a modern look. The language is case-insensitive and each statement terminates with a period.
ABAP programs are event-driven to an extent though the event handling capabilities are not similar to full-fledged object-oriented languages such as Java or even Visual Basic. ABAP objects or classes can be defined and implemented using the “Class Builder” for use in report and dialog programs.
Report programs produce lists and can be classified as conventional reports and interactive reports.
Conventional reports do not allow interaction by the user; therefore; the basic list contains extensive information that the user must often sort through to find the relevant data.
Interactive reports allows for interaction (and drilldown) with the user;therefore the user can produce secondary, detailed lists off of the basic list by choosing the relevant data and requesting more information.
ALV Reports also allows interaction by the user, it can display large amount of data at one short in the form of excel sheet.
Components of ABAP Program
An ABAP program contains the following components:
Source code: containing the ABAP statements
Screens: Consist of the screen layout and associated flow logic. You normally create the layout of a screen using the Screen Painter However, there are special kinds of screens, called selection screens and lists, whose layout and flow logic are designed exclusively using ABAP statements.
Interface: contains all of the entries in the menus, the standard toolbar, the application toolbar, and function key settings. It contains titles and statuses. A status is a collection of function key settings and menus.
Text elements: are language-specific. They can be translated either directly from the text element maintenance tool, or using a special translation tool.
Documentation: is also language-specific. Always write documentation from the user’s point of view. If you want to document the programming techniques you have used, use comments in the program code instead.
Variants: allow you to predefine the values of input fields on the selection screen of a program.
Structure of ABAP Program
ABAP is an event-driven programming language, and as such is suited to processing user dialogs. The source code of an ABAP program consists of two parts:
Declarations: Declarations include the statements for global data types and objects, selection screens, and (in ABAP Objects) local classes and interfaces within the program.
Processing Blocks (indivisible program units)Each processing block must be programmed as a single entity. There are two basic kinds of processing blocks:
Event Blocks:Event blocks are introduced by an event keyword. They are not concluded explicitly, but end when the next processing block starts.
Dialog Modules and Procedures:Dialog modules and procedures are introduced and concluded using keywords. The contents of all processing blocks form the processing logic.
When you generate the program, these parts are compiled to form the load version. This is interpreted at run time.
ABAP Terms to Remember
A Report is normally an ABAP Program which outputs a list. Some people refer to the List as the Report and to the ABAP report as a report program.
A Module Pool is a non-executable program which contains “modules” that control dialog processing.
A List is an output of an ABAP Report program.
There are Programs of other types such as “Include” (a non-executable block of code that can be included into a main program), Subroutine Pool (a pool of subroutines or
FORMs which can be executed from another executable block), a function pool which contains a group of related functions, and so on.
- The ABAP Editor is used to create ,maintain, and execute ABAP programs.
- You could navigate to the ABAP Editor through the SAP menu for ABAP Workbench or by typing in the transaction code SE38 in the command input field.
- More details about the features of the ABAP editor is covered later.
- Some methods for executing ABAP programs include:
- The ABAP Editor: Tools -> ABAP Workbench ->ABAP Editor (pushbutton)
- The Reporting function: System->Services->Reporting
- ABAP programs that you create must start with a “Y” or A “Z” and can be up to 30 characters in length.
The editor combines a character based text entry capability with graphical icons and menu options to perform many of the functions necessary to build complex ABAP applications.The ABAP development environment provides a wide variety of tools required by the programmer for developing and testing of applications.
Pictured above is the online debugging tool which enables the programmer to step into the program line by line. The online debugging tool provides the programmer with the capability to designate watch variables. These variables once chosen can be viewed as their values change from statement to statement while the program executes. The programmer can even change their values to simulate different processing scenarios.
The ABAP program editor provides many functions through the use of graphical push-buttons. Among these functions are:
- Toggle from display mode to edit mode
- Syntax check –with limited auto correction
- Activation –activates the program.
- Execution- Executes the program
- Where used list- to find the tables, statements, data elements used in the programs.
- Find and repeat find.
- ABAP help.
ABAP Programming Execution
The individual processing blocks are called in a predetermined sequence at runtime, regardless of the position in which they occur in the program. Once a processing block has been called, the statements within it are processed seqeuentially.
If the system program or a user triggers an event for which the corresponding event block has been written in the processing logic, that event block is processed. The program flow is controlled either by the system or the user.
When the system encounters a modularization unit call within a processing block, it calls the corresponding processing block. In this case, the program flow is controlled by the programmer.
Assigning transaction codes
To allow a module pool to be executed, you must assign a transaction code to it. You can (but do not have to) assign a transaction code to an executable (type 1) program.
Basic ABAP Program Syntax
- An ABAP program is comprised of a series of individual ABAP statements
- Each statement must end with a period.( full –stop)
- Key words are always the first word in a statement.
- Words must be separated by at least one blank.
- ABAP statements can be indented and extend over several lines.
ABAP Program Structure
ABAP programs must start with either the PROGRAM or REPORT statement.
- This statement is produced automatically when the program is created through the Repository Browser.
- The REPORT statement is used for ABAP reports programs.
- The PROGRAM statement is used for general ABAP programs( for example, module pool programs).
All global data declarations must be grouped together at the beginning of the program in a declaration section.
The statement section can consist of various processing blocks.This subject is dealt with in the remaining chapters of this course.
Always Adhere to ABAP program naming standards dictated by the client.
Chaining Statements in ABAP
- To avoid repeating key words,ABAP allows you to “chain” statements together if these statements begin with the same key word.
- The key word is followed by a colon.
- Each chained statement component is separated by a comma.
- Blanks can be inserted before and after the separators (which may be colons,commas or periods).
Comments are inserted into the program in two ways:
- By placing an asterisk(*) in column 1,the complete line is designated as a comment line.
- By placing a double quotation mark(“) within a line the remainder of the line is considered a comment.
ABAP Program Attributes
One way to create a new program is:
- Go into the program menu from the ABAP Editor: Initial Screen.
- Select the Create menu option or use the Create function key.
You can also create , maintain ,and execute programs from the Repository Browser ( this is the recommended method for creating programs). The program attributes must be maintained before proceeding. ABAP programs must be assigned to a development class or ,if applicable, identified as a local ,private object. (This is a requirement of SAPs Correction
and Transport System.) The application, class and type attributes are used for the management of ABAP programs.
The application, title, status and type attributes are used for the management of ABAP programs. The application,title,status and type attributes are required. Other attributes are optional requirements. F1 and F4 are help keys which allow you to search for the significance of the attributes or a list of allowed input values.
The ABAP editor’s Execute functionis used to start an ABAP program directly from the editor. An ABAP module pool program is executed using transaction codes.
Navigate back to ABAP tutorials.